diff --git a/CHECKSUMS.txt b/CHECKSUMS.txt index 3316bcc84deb4d523e0a55b711d2f1f9ec3e1187..e5de055d431b3a512f4698fee92ae131c4783b52 100644 --- a/CHECKSUMS.txt +++ b/CHECKSUMS.txt @@ -1,23 +1,23 @@ -Cover Charge v0.3.12.205: 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.205. +Cover Charge v0.3.12.206: 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.206. SHA-256 of each web app's start page, service worker, manifest and logo: -e62634bb7948960fd8454799214d06084a7b69cf63523f85580287bdb30866c4 owner-app/index.html -f87b4314018e452d2dd270bc8059834bc5503c3856c635e2af73526d0654e20a owner-app/sw.js +fb594b2f10337915f81e519e3aba23f0c6b8344b61aa95be5277dba424c0a012 owner-app/index.html +ed970e72f5fb17d6f247192c65e22db3c654ea85d273fe207da10a8fda77293f owner-app/sw.js e305c44d11a9c25f37372f3fa4d329d4ffb04df2edee6e7b4b9ac91f3875ac67 owner-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 owner-app/brand-logo.png -e2a5d83157ccadcde5bd8a64d19b02845ae7f2cdc71037e5555657c8b8e97390 staff-app/index.html -84237e25ac2121b70ffcf2fe682079c313e98c6103ae0e143314ca6d2ca5c7a5 staff-app/sw.js +62da63ba99292aff4ee2eae9e4f010b8bed6168b5395f1f4281aea7938e4ceee staff-app/index.html +866e9cb150724337a8063279c06f064c52718c379f0192f1d7a8dd769b6b76a0 staff-app/sw.js bd1d310ebf8e2a80808e100c41fb7fe1c4369d3026478f3ad8eececaeadaf4ac staff-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 staff-app/brand-logo.png -73823d19e000f6c7057778bd04720ae0c4c04bc447c85eab4cfdf0ec445f7ba8 customer-app/index.html -22511d2bc9fb8e64a99960e997b7aeaeaecbbc0c9694aa13c962940403b3e7c9 customer-app/sw.js +0692cbdd1a64ad62860fcb8dd08dd4a19c96a204b95d58c6a8faf20b15779545 customer-app/index.html +ff5f22e873268ac4ff9ecf90e7ff9f2a0829b45ebbce1cbe5db31f65d59179c2 customer-app/sw.js 3bfb1fd10cc13f09ca6be65c461e1f6b5750ae51a3ece12e079750b2a066052e customer-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 customer-app/brand-logo.png -927edace3b2cf2993d4f79ff313892673e9cca2c121f888bb318e4b55c7de4cd display-app/index.html -28222b5e4d306a341fc241281976e07538e81ac1d8a691e3ffe2277445b7e3f8 display-app/sw.js +0f8a0976b9ee43d0781ecf3dad14f9f5ecbb26b72316dc283a81ca385f63ecda display-app/index.html +2544f3d16fbe53a11dd523c75146e93af8b88e7fc3f546427abcd5c82c0c67aa display-app/sw.js 35e2721b86eb1ae1605e55bee64177adcee72f4e53a24ac417d19ea2873434a1 display-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 display-app/brand-logo.png -30820fea9ce0995d3777e7a4efd3c672a269065c805851b41d615cc48b33d159 chef-app/index.html -b59fc678b5a8ec165f8264d98dd1789a112359707b357043348368708cef9680 chef-app/sw.js +86044820d0b212209cd8c847a29db4e573e951ee00100251bf6bbfbca284307c chef-app/index.html +601af3bd4da60e5b9855532af14d8b74e245bedd9e77bddd2f69e202f51d9e16 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 d6b64dc34b1ff6ee0afc6abd392d705309a3061d..95862060fda1c2beed60e3636f3ffe854e953f3e 100644 --- a/car-app/_expo/static/js/web/bundle.js +++ b/car-app/_expo/static/js/web/bundle.js @@ -1058,7 +1058,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.205'},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.206'},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 c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},979,[980,981,928,972,976]); __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]); @@ -1166,17 +1166,17 @@ __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,"useChatOpen",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)()(t=>({request:n=>t({ch:n})}))},1083,[831]); __d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},1084,[912,17,1010,876,816,913,927,1066,916,1065]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:u}){const h=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const f=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==u||'seated'!==s.status||s.date!==(0,c.venueYmd)(new Date)||!(0,l.hasAllergens)(s)||h.current.has(s.id))continue;const n=f.get(s.id);n&&'seated'!==n&&(h.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} Covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[u]),null},e.useKitchenTodoChime=function(t,c,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=c&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,u.soundAllowed)()&&(0,u.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} Covers \xb7 ${t.date===c?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6])},1085,[843,17,916,858,1053,863,1016]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:s,today:o,by:S,app:j}){const $=(0,n.useBookings)(s).filter(e=>e.date===o&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),w=$.reduce((e,t)=>e+(t.diet?.vegan??0),0),T=$.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,x.jsxs)(a.default,{style:{gap:12},testID:"todays-bookings",children:[(0,x.jsx)(p.CoversToday,{rid:s}),(0,x.jsx)(b.PlattersBooked,{rid:s,date:o,label:"Platters booked today"}),w||T?(0,x.jsxs)(l.T,{colour:h.colours.ok,children:["\u24cb ",w?`${w} vegan`:'',w&&T?' \xb7 ':'',T?`${T} vegetarian`:''," today"]}):null,(0,x.jsx)(b.KitchenSignoffs,{rid:s,today:o,by:S,app:j,showAll:!0}),$.length?$.map(o=>(0,x.jsxs)(a.default,{testID:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?`kitchen-seated-${o.id}`:`kitchen-booking-${o.id}`,style:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?{gap:6,padding:14,borderRadius:16,...(0,c.seatedHighlightStyle)()}:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface,opacity:'finished'===o.status?.55:1},children:[(0,x.jsxs)(l.T,{weight:"semibold",colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,accessibilityLabel:`${o.time}, ${o.walkIn?`Walk-in ${o.ref}`:o.name}, ${o.partySize} Covers${o.table?`, ${(0,e.tableNumbersA11y)(o.table)}`:''}`,children:[o.time," \xb7 ",o.walkIn?`Walk-in ${o.ref}`:o.name," \xb7 ",o.partySize," Covers",o.table?` \xb7 ${(0,e.tableNumbers)(o.table)}`:'']}),(0,x.jsx)(t.DepositChip,{b:o,money:!0,testID:`kitchen-deposit-${o.id}`}),(0,x.jsx)(k.BookingTableButton,{rid:s,booking:o,readOnly:'chef'===j}),'chef'!==j&&o.walkIn?(0,x.jsx)(y.CancelWalkInButton,{rid:s,b:o,small:!0}):null,o.notes?(0,x.jsxs)(l.T,{size:16,colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,testID:`kitchen-notes-${o.id}`,children:["Notes: ",o.notes]}):null,(0,x.jsx)(f.BookingEditButton,{rid:s,booking:o,who:S,inStaffApp:'staff'===j}),(0,x.jsx)(b.BookingNeeds,{b:o}),'seated'===(0,u.shownStatus)(o)?(0,x.jsx)(l.T,{weight:"semibold",colour:c.SEATED_FG,children:"Seated"}):'finished'===o.status?(0,x.jsx)(l.Muted,{children:"Finished"}):null]},o.id)):(0,x.jsx)(l.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var s,o=r(d[3]),a=(s=o)&&s.__esModule?s:{default:s},l=r(d[4]),n=r(d[5]),u=r(d[6]),h=r(d[7]),c=r(d[8]),b=r(d[9]),k=r(d[10]),y=r(d[11]),f=r(d[12]),p=r(d[13]),x=r(d[14])},1086,[843,1087,17,85,777,858,1053,804,1088,1076,1089,1114,1119,1070,8]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:s,today:o,by:S,app:j}){const $=(0,n.useBookings)(s).filter(e=>e.date===o&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),w=$.reduce((e,t)=>e+(t.diet?.vegan??0),0),T=$.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,x.jsxs)(a.default,{style:{gap:12},testID:"todays-bookings",children:[(0,x.jsx)(p.CoversToday,{rid:s}),(0,x.jsx)(b.PlattersBooked,{rid:s,date:o,label:"Platters booked today"}),w||T?(0,x.jsxs)(l.T,{colour:h.colours.ok,children:["\u24cb ",w?`${w} vegan`:'',w&&T?' \xb7 ':'',T?`${T} vegetarian`:''," today"]}):null,(0,x.jsx)(b.KitchenSignoffs,{rid:s,today:o,by:S,app:j,showAll:!0}),$.length?$.map(o=>(0,x.jsxs)(a.default,{testID:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?`kitchen-seated-${o.id}`:`kitchen-booking-${o.id}`,style:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?{gap:6,padding:14,borderRadius:16,...(0,c.seatedHighlightStyle)()}:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface,opacity:'finished'===o.status?.55:1},children:[(0,x.jsxs)(l.T,{weight:"semibold",colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,accessibilityLabel:`${o.time}, ${o.walkIn?`Walk-in ${o.ref}`:o.name}, ${o.partySize} Covers${o.table?`, ${(0,e.tableNumbersA11y)(o.table)}`:''}`,children:[o.time," \xb7 ",o.walkIn?`Walk-in ${o.ref}`:o.name," \xb7 ",o.partySize," Covers",o.table?` \xb7 ${(0,e.tableNumbers)(o.table)}`:'']}),(0,x.jsx)(t.DepositChip,{b:o,money:!0,testID:`kitchen-deposit-${o.id}`}),(0,x.jsx)(k.BookingTableButton,{rid:s,booking:o,readOnly:'chef'===j}),'chef'!==j&&o.walkIn?(0,x.jsx)(y.CancelWalkInButton,{rid:s,b:o,small:!0}):null,o.notes?(0,x.jsxs)(l.T,{size:16,colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,testID:`kitchen-notes-${o.id}`,children:["Notes: ",o.notes]}):null,(0,x.jsx)(f.BookingEditButton,{rid:s,booking:o,who:S,inStaffApp:'staff'===j}),(0,x.jsx)(b.BookingNeeds,{b:o}),'seated'===(0,u.shownStatus)(o)?(0,x.jsx)(l.T,{weight:"semibold",colour:c.SEATED_FG,children:"Seated"}):'finished'===o.status?(0,x.jsx)(l.Muted,{children:"Finished"}):null]},o.id)):(0,x.jsx)(l.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var s,o=r(d[3]),a=(s=o)&&s.__esModule?s:{default:s},l=r(d[4]),n=r(d[5]),u=r(d[6]),h=r(d[7]),c=r(d[8]),b=r(d[9]),k=r(d[10]),y=r(d[11]),f=r(d[12]),p=r(d[13]),x=r(d[14])},1086,[843,1087,17,85,777,858,1053,804,1088,1076,1089,1115,1120,1070,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DepositChip=function({b:e,money:o,big:n,testID:b}){const f=(0,s.depositView)(e,o);if(!f)return null;const h={gold:[t.colours.goldTint,t.colours.goldLight,t.colours.gold],amber:[t.colours.amberBg,'#FFE2A8',t.colours.amber],red:[t.colours.redBg,'#FFD9D4',t.colours.red],neutral:[t.colours.surface2,t.colours.muted,t.colours.border]}[f.kind];return(0,u.jsxs)(l.default,{accessible:!0,accessibilityRole:"text",accessibilityLabel:f.a11y,testID:b??'deposit-chip',style:{alignSelf:'flex-start',maxWidth:'100%'},children:[(0,u.jsx)(l.default,{style:{backgroundColor:h[0],borderColor:h[2],borderWidth:n?2:1,borderRadius:8,paddingHorizontal:n?12:8,paddingVertical:n?6:3},children:(0,u.jsx)(c.T,{size:16,weight:"semibold",colour:h[1],children:f.label})}),f.note?(0,u.jsx)(c.Muted,{size:12,children:f.note}):null]})},r(d[0]);var e,o=r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),c=r(d[4]),u=r(d[5])},1087,[17,85,841,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEATED_BG",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SEATED_FG",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEATED_MUTED",{enumerable:!0,get:function(){return u}}),e.isSeatedHighlight=function(t,o){return'seated'===t&&!o?.otherDay},e.seatedHighlightStyle=function(u){return{backgroundColor:o,borderColor:t.colours.goldLight,borderWidth:1.5,borderLeftWidth:8,borderLeftColor:n,...u}};var t=r(d[0]);const o=t.colours.gold,n=t.colours.onGold,u='#3F3218'},1088,[804]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f,canClear:h=!0}){const[j,k]=(0,t.useState)(!1),x=(0,s.tableButtonLabel)(l.table),_=f??`table-btn-${l.id}`;if(y)return(0,b.jsx)(n.default,{testID:_,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,b.jsx)(u.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:x})});return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u.Button,{kind:"secondary",label:x,testID:_,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>k(!0),style:{minHeight:44}}),j?(0,b.jsx)(c.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>k(!1),canClear:h}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6])},1089,[17,85,1090,804,1091,777,8]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const u={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(u)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(u,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}}),e.splitChoices=function(t){const n=String(t??'').split('+').map(t=>t.trim()).filter(Boolean);return n.length>1?[...new Set(n)]:[]};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1090,[843,1074]); -__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,t,s){const l=(0,p.tableKey)(s);if('finished'===t.status&&l)return void await(0,j.restoreFinishedToTable)(e,t,s);const o=(0,g.tablesOf)(t.table);await h.repo.bookings.update(t.id,(0,y.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(t=>g.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,m.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:m=90,onClose:T,onSaved:S,onPickOnPlan:L,canClear:P=!0}){const W=(0,g.usePlan)(e),z=(0,h.useBookings)(e),[D,I]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),R=(0,l.useMemo)(()=>(0,p.pickGroups)(W),[W]),B=z.filter(e=>e.date===y.date),O=(0,p.seatsOf)(W,D),N=(0,p.seatLine)(O.total,y.partySize),F=(0,p.pickClashes)(y,D,B,m),M=e=>(0,p.pickClashes)(y,[e],B,m)[0]?.with,Y=(0,p.tableKey)(D)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,C.useBlocks)(e=>e.blocks),A=(0,C.blockAt)(_,e,y.date,y.time),[G,K]=(0,l.useState)(null),E=e=>{K(null),I(t=>(0,p.toggleTable)(t,e))},[H]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{H&&(0,c.announce)(`Tables can't be saved: ${H}.`)},[H]);const[U,V]=(0,l.useState)(!1),[q,J]=(0,l.useState)(!1),Q=async t=>{(0,o.guardBookingChange)(S,{b:y,tables:t})?(V(!0),T(),await(0,o.saveTablesReported)(e,y,t,f,(0,p.seatsOf)(W,t).total,e=>S?.(e))):T()},X=(0,w.jsxs)(u.default,{style:{gap:8},children:[(0,w.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(D)} picked. ${N.text}.`,children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(D)}),(0,w.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:N.text})]}),A?(0,w.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,w.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,F.length?(0,w.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(F)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,w.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(F)," You can still save."]})}):null,q?(0,w.jsx)(j.RestoreSeatedConfirm,{prompt:(0,v.restoreSeatedPrompt)(f,(0,p.tableKey)(D)),onYes:()=>{J(!1),Q(D)},onNo:()=>J(!1)}):null,G?(0,w.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:G,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,w.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:G}),(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(D)} for ${f}, ${y.partySize} people`,disabled:U,onPress:()=>{Q(D)},style:[$,{flexGrow:1}]}),(0,w.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>K(null),style:$})]})]}):null,(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[G?null:(0,w.jsx)(x.Button,{testID:"table-pick-save",label:U?'Saving\u2026':F.length?'Save anyway':'Save tables',disabled:!Y||!D.length||U,accessibilityLabel:`${F.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(D)} for ${f}. ${N.text}.${F.length?` ${(0,p.clashWords)(F)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(S,{b:y,tables:D}))return void T();const e=(0,p.overCapacityAsk)(D,O.total,y.partySize);!e||G?'finished'!==y.status||!D.length||q?Q(D):J(!0):K(e)},style:[$,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&P?(0,w.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:U,onPress:()=>Q([]),style:$}):null,(0,w.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:T,style:$})]})]});return(0,w.jsxs)(x.Sheet,{visible:!0,onClose:T,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:X,children:[(0,w.jsx)(t.TableNumberWarning,{plan:W}),H?(0,w.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${H}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,w.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${H}.`})}):null,(0,w.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),L?(0,w.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>L(D),style:$}):null,R.map(e=>(0,w.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,w.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,w.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=D.includes(e.name),l=M(e.name);return(0,w.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,t,l),onPress:()=>E(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",colour:t?k.colours.onGold:k.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,w.jsxs)(x.T,{size:14,colour:t?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),R.length?null:(0,w.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),m=r(d[15]),j=r(d[16]),v=r(d[17]),C=r(d[18]),w=r(d[19]);const $={minHeight:56}},1091,[1092,843,17,1093,899,1095,385,85,858,996,1090,1094,804,863,777,1096,1112,1111,993,8]); +__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,t,s){const l=(0,p.tableKey)(s);if('finished'===t.status&&l)return void await(0,j.restoreFinishedToTable)(e,t,s);const o=(0,g.tablesOf)(t.table);await h.repo.bookings.update(t.id,(0,y.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(t=>g.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,m.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:m=90,onClose:T,onSaved:S,onPickOnPlan:L,canClear:P=!0}){const W=(0,g.usePlan)(e),z=(0,h.useBookings)(e),[D,I]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),R=(0,l.useMemo)(()=>(0,p.pickGroups)(W),[W]),B=z.filter(e=>e.date===y.date),O=(0,p.seatsOf)(W,D),N=(0,p.seatLine)(O.total,y.partySize),F=(0,p.pickClashes)(y,D,B,m),M=e=>(0,p.pickClashes)(y,[e],B,m)[0]?.with,Y=(0,p.tableKey)(D)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,C.useBlocks)(e=>e.blocks),A=(0,C.blockAt)(_,e,y.date,y.time),[G,K]=(0,l.useState)(null),E=e=>{K(null),I(t=>(0,p.toggleTable)(t,e))},[H]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{H&&(0,c.announce)(`Tables can't be saved: ${H}.`)},[H]);const[U,V]=(0,l.useState)(!1),[q,J]=(0,l.useState)(!1),Q=async t=>{(0,o.guardBookingChange)(S,{b:y,tables:t})?(V(!0),T(),await(0,o.saveTablesReported)(e,y,t,f,(0,p.seatsOf)(W,t).total,e=>S?.(e))):T()},X=(0,w.jsxs)(u.default,{style:{gap:8},children:[(0,w.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(D)} picked. ${N.text}.`,children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(D)}),(0,w.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:N.text})]}),A?(0,w.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,w.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,F.length?(0,w.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(F)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,w.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(F)," You can still save."]})}):null,q?(0,w.jsx)(j.RestoreSeatedConfirm,{prompt:(0,v.restoreSeatedPrompt)(f,(0,p.tableKey)(D)),onYes:()=>{J(!1),Q(D)},onNo:()=>J(!1)}):null,G?(0,w.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:G,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,w.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:G}),(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(D)} for ${f}, ${y.partySize} people`,disabled:U,onPress:()=>{Q(D)},style:[$,{flexGrow:1}]}),(0,w.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>K(null),style:$})]})]}):null,(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[G?null:(0,w.jsx)(x.Button,{testID:"table-pick-save",label:U?'Saving\u2026':F.length?'Save anyway':'Save tables',disabled:!Y||!D.length||U,accessibilityLabel:`${F.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(D)} for ${f}. ${N.text}.${F.length?` ${(0,p.clashWords)(F)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(S,{b:y,tables:D}))return void T();const e=(0,p.overCapacityAsk)(D,O.total,y.partySize);!e||G?'finished'!==y.status||!D.length||q?Q(D):J(!0):K(e)},style:[$,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&P?(0,w.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:U,onPress:()=>Q([]),style:$}):null,(0,w.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:T,style:$})]})]});return(0,w.jsxs)(x.Sheet,{visible:!0,onClose:T,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:X,children:[(0,w.jsx)(t.TableNumberWarning,{plan:W}),H?(0,w.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${H}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,w.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${H}.`})}):null,(0,w.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),L?(0,w.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>L(D),style:$}):null,R.map(e=>(0,w.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,w.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,w.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=D.includes(e.name),l=M(e.name);return(0,w.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,t,l),onPress:()=>E(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",colour:t?k.colours.onGold:k.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,w.jsxs)(x.T,{size:14,colour:t?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),R.length?null:(0,w.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),m=r(d[15]),j=r(d[16]),v=r(d[17]),C=r(d[18]),w=r(d[19]);const $={minHeight:56}},1091,[1092,843,17,1093,899,1095,385,85,858,996,1090,1094,804,863,777,1096,1113,1111,993,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},1092,[17,842,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.guardBookingChange=w,_e.saveTablesReported=async function(e,t,n,o,s,u){if(!w(u,{b:t,tables:n}))return!1;const v=n.length?(0,h.notSavedWhat)({...t,name:o,table:n.join('+')}):`Taking the table off ${o}`;u(`Saving ${v}\u2026`);try{await(0,b.saveBookingTables)(e,t,n)}catch(e){const t=`${v} did not save: ${String(e?.message??e).slice(0,120)}`;return u(t),(0,l.announce)(t),!1}const y=await(0,c.waitForBookingSave)(t.id);if('saved'===y.state||'local'===y.state){const e=(0,r.savedWords)(o,t.partySize,n,s);return u(e),(0,l.announce)(e),!0}const k='waiting'===y.state?`${v}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${v} did not save. ${f("why"in y?y.why:"the shared system did not take it")}. Tap the red banner to try again.`;return u(k),(0,l.announce)(k),!1},_e.reportBookingSave=async function(e,t,n,o){const s=await(0,c.waitForBookingSave)(e);if('saved'===s.state||'local'===s.state)return o(t),(0,l.announce)(t),!0;const r='waiting'===s.state?`${n}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${n} did not save. ${f('why'in s?s.why:'the shared system did not take it')}. Tap the red banner to try again.`;return o(r),(0,l.announce)(r),!1},_e.BookingSaveBanner=function({rid:e,testID:r="booking-save-banner",margin:c}){const b=(0,h.useBookingSaves)(e=>e.notSaved),w=(0,s.useBookings)(e).filter(e=>b[e.id]).map(e=>void 0!==b[e.id].want?{...e,table:b[e.id].want||void 0}:e),{msg:S,retry:$}=k(),m=(0,t.useRef)(''),p=w.map(e=>(0,h.notSavedLine)(e)),B=w.map(e=>e.id).sort().join(',');if((0,t.useEffect)(()=>{B&&B!==m.current&&(0,l.announce)(1===w.length?p[0]:`${w.length} booking changes did not save. Tap the red banner to try again.`),m.current=B},[B]),!w.length)return null;const j=1===w.length?p[0]:`${w.length} booking changes did not save. Tap to try again.`;return(0,y.jsx)(n.default,{testID:r,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${j}${w.length>1?` ${w.map(e=>(0,h.notSavedWhat)(e)).join('. ')}.`:''} ${f(b[w[0].id].why)}.`,onPress:$,style:{...c??{},alignSelf:'stretch',gap:4,padding:12,borderRadius:12,borderWidth:2,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:(0,y.jsxs)(o.default,{accessibilityRole:"alert",style:{alignItems:'center',gap:4},children:[(0,y.jsx)(v.T,{testID:`${r}-title`,size:17,weight:"semibold",center:!0,colour:"#FFD2CC",children:j}),w.length>1?w.slice(0,6).map(e=>(0,y.jsx)(v.T,{testID:`${r}-line`,size:15,center:!0,colour:"#FFD2CC",children:(0,h.notSavedWhat)(e)},e.id)):null,(0,y.jsx)(v.T,{testID:`${r}-why`,size:14,center:!0,colour:"#FFB3AA",children:w.length>1?`${f(b[w[0].id].why)}${w.length>6?` \xb7 and ${w.length-6} more`:''}`:f(b[w[0].id].why)}),S?(0,y.jsx)(v.T,{testID:`${r}-msg`,size:14,center:!0,colour:u.colours.goldLight,children:S}):null]})})},_e.BookingNotSavedLine=function({b:e}){const t=(0,h.useBookingSaves)(t=>t.notSaved[e.id]),{msg:o,retry:s}=k();if(!t)return null;void 0!==t.want&&(e={...e,table:t.want||void 0});return(0,y.jsxs)(n.default,{testID:`booking-not-saved-${e.id}`,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${(0,h.notSavedLine)(e)} ${f(t.why)}.`,onPress:s,style:{alignSelf:'stretch',padding:8,borderRadius:10,borderWidth:1.5,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:[(0,y.jsx)(v.T,{size:15,weight:"semibold",center:!0,colour:"#FFD2CC",children:(0,h.notSavedLine)(e)}),o?(0,y.jsx)(v.T,{size:13,center:!0,colour:u.colours.goldLight,children:o}):null]})};var t=_r(d[0]),n=e(_r(d[1])),o=e(_r(d[2])),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),b=_r(d[9]),v=_r(d[10]),y=_r(d[11]);const f=e=>e.charAt(0).toUpperCase()+e.slice(1);function w(e,t){const n=(0,c.bookingSaveBlocker)();if(!n)return!0;t&&h.useBookingSaves.getState().mark({id:t.b.id,table:t.b.walkIn?'walk_ins':'bookings',why:n,...t.tables?{want:t.tables.join('+')}:{}});const o=`${t?(0,h.notSavedWhat)({...t.b,...t.tables?{table:t.tables.join('+')||void 0}:{}}):'This change'} did not save: ${n}.`;return e?.(o),(0,l.announce)(o),!1}function k(){const[e,n]=(0,t.useState)('');return{msg:e,retry:async()=>{n('Saving\u2026'),(0,l.announce)('Saving');const e=await(0,c.saveBookingsNow)(!0),t=e?`Not saved: ${e}.`:h.useBookingSaves.getState().count()?'Sent again. The banner clears when the shared system takes it.':'Nothing is left waiting. Check the plan and make the change again if it is not there.';n(t),(0,l.announce)(t)}}}},1093,[17,385,85,858,1094,1095,899,983,804,1091,777,8]); __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=u,e.requestedFreeTable=function(t,n,a,s,l=90){const o={id:n.id??'new',status:'confirmed',...n};for(const n of t)if(a.includes(n)&&!u(o,[n],s,l).length)return n;return null},e.overCapacityAsk=function(n,s,l){const u=a(o(n));if(!u.length||s>=l)return null;const c=u.map(n=>(0,t.tableNumbers)(n));return`${1===c.length?`Table ${c[0]} seats`:`Tables ${c.slice(0,-1).join(', ')} and ${c[c.length-1]} seat`} ${s} \u2013 this booking is ${l}. Use it anyway?`},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=c,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${c(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${c(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${c(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))}function c(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1094,[843,1074]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.primeAnnouncer=function(){u()},_e.announce=function(t){const e=String(t??'').trim();if(!e)return;{const t=u();if(!t)return;const n=++o;return t.textContent='',void setTimeout(()=>{n===o&&(t.textContent=e)},80)}},Object.defineProperty(_e,"lastAnnounced",{enumerable:!0,get:function(){return c}});var t,e=r(d[0]);(t=e)&&t.__esModule;r(d[1]);let n=null,o=0;function u(){if('undefined'==typeof document||!document.body)return null;if(n&&document.body.contains(n))return n;const t=document.createElement('div');return t.id='cc-announcer',t.setAttribute('aria-live','assertive'),t.setAttribute('aria-atomic','true'),t.setAttribute('role','status'),t.setAttribute('data-testid','cc-announcer'),Object.assign(t.style,{position:'absolute',width:'1px',height:'1px',margin:'-1px',padding:'0',overflow:'hidden',clip:'rect(0 0 0 0)',whiteSpace:'nowrap',border:'0'}),document.body.appendChild(t),n=t,t}const c=()=>n?.textContent??''},1095,[264,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,"TABLES",{enumerable:!0,get:function(){return A}}),_e.useTableNames=R,_e.resetTableLive=W,_e.seatBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'seated'),W(e,t.table)},_e.finishBookingNow=async function(e,t){const s=(new Date).toISOString();await k.repo.bookings.update(t.id,(0,N.finishClearPatch)(s,t.table)),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=E,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return _}}),_e.TablePicker=H,_e.WalkInSheet=q,_e.AssignTableSheet=G,_e.undoNotice=Y,_e.NewBookingSheet=V,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[n,i]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>i({b:e}),combineTables:e=>i({b:e,combine:!0}),elements:(0,L.jsxs)(L.Fragment,{children:[s?(0,L.jsx)(q,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,L.jsx)(V,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,L.jsx)(G,{booking:n.b,combine:n.combine,onClose:()=>i(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),z=_r(_d[29]),B=_r(_d[30]),M=_r(_d[31]),N=_r(_d[32]),L=_r(_d[33]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),A=Array.from({length:12},(e,t)=>String(t+1));function R(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function W(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function E(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=R(e),a=(0,v.useFloor)(t=>t.live[e])??{},n=(0,v.usePlan)(e),i=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(i,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const _=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function H({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=n?6:8,f=n?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(i??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,L.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],i=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!i,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,L.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:i?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,L.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,L.jsx)(C.T,{weight:"bold",size:22,colour:i?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,L.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,L.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,L.jsx)(C.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const U=[1,2,3,4,5,6,7,8];function q({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:r,r:d,now:u}=(0,y.useCtx)(15e3),x=E(r,u),[T,I]=(0,c.useState)(2),[P,$]=(0,c.useState)(!1),[O,z]=(0,c.useState)(i??null),B=(0,v.usePlan)(r),N=(0,k.useBookings)(r),A=(0,D.useBlocks)(e=>e.blocks),R=(0,D.closedAreasAt)(A,r,(0,w.ymd)(u),(0,w.hm)(u)),_=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(x).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(B,N.filter(e=>e.date===(0,w.ymd)(u)),e,T,u,(0,j.turnFor)(T,d.settings.turnMins),90,void 0,{closed:R})?.table??null},[B,N,x,T,R.size,u.getTime()]);(0,c.useEffect)(()=>{O&&(0,v.tablesOf)(O).some(e=>'Closed'===x[e]?.label)&&z(null)},[O,R.size]);const[q,G]=(0,c.useState)(!1),[Y,V]=(0,c.useState)(''),K=(e,t=String(e),s=()=>{$(!1),I(e)})=>{const o='9+'===t?P:!P&&T===e;return(0,L.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,L.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},Q=(0,L.jsx)(s.PartySizeInput,{value:T,onChange:I,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),X=(0,L.jsxs)(m.default,{style:{gap:8,width:n?256:void 0},children:[(0,L.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,L.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[U.map(e=>K(e)),K(9,'9+',()=>{$(!0),I(e=>e>=9?e:9)})]}),P?Q:null]}),[J,Z]=(0,c.useState)(!1),ee=async(t=O)=>{if(!J&&(0,M.guardBookingChange)(F)){Z(!0);try{const s=await k.repo.bookings.seatWalkIn(r,T,t??void 0,Y);W(r,t??void 0),a(s),e()}finally{Z(!1)}}},te=(0,L.jsxs)(m.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,L.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,L.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),O?(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>z(null)}):null]}),(0,L.jsx)(H,{use:x,value:O,onPick:e=>{x[e]&&!x[e].busy?ee(e):z(O===e?null:e)},big:n,dense:n,best:_,bestSet:(0,h.bestTables)(B)}),(0,L.jsxs)(C.Muted,{children:["Tap a free table to seat them there",_&&!O?` (suggested for ${T}: ${(0,l.tableNumbers)(_)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(u)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,L.jsx)(C.Button,{label:`Seat walk-in \xb7 ${T} ${1===T?'person':'people'}${O?` \xb7 ${(0,l.tableNumbers)(O)}`:''}`,disabled:J,onPress:()=>{ee()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,L.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[X,te]}):(0,L.jsxs)(L.Fragment,{children:[X,te]}),(0,L.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[q?(0,L.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:Y,onChangeText:V,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,L.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,L.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function G({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,y.useCtx)(15e3),i=E(o,n),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(n)),t,e.partySize,n,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,n.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),P=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,$=D.reduce((e,t)=>e+P(t),0),O=D.length>0&&${if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&W(o,l),t()},B=x?(0,L.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,L.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,L.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${$} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,L.jsx)(m.default,{testID:"combine-short",children:(0,L.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-$," more needed. Add another table."]})}):null,(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,L.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,L.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,L.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,L.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${_(e)}`,testID:"assign-table-sheet",footer:B,children:[f&&!x?(0,L.jsx)(m.default,{testID:"assign-suggested",children:(0,L.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,L.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,L.jsx)(H,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function Y(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${_(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function V({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:N}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const A=(0,w.ymd)(p),[R,W]=(0,c.useState)(ee.blocks),[H,U]=(0,c.useState)(!1),[q,G]=(0,c.useState)(''),[Y,V]=(0,c.useState)(2),[K,Q]=(0,c.useState)(0),X=Math.min(K,Math.max(0,Y-1)),[J,Z]=(0,c.useState)(null),[ee,te]=(0,c.useState)(''),[se,oe]=(0,c.useState)(''),[le,ae]=(0,c.useState)(''),[ne,ie]=(0,c.useState)(!1),[re,de]=(0,c.useState)('phone'),[ue,ce]=(0,c.useState)((0,P.emptyNeeds)()),be=(0,P.needsMissing)(ue),[ge,he]=(0,c.useState)(null),pe=(0,v.usePlan)(b),me=(0,O.dogSetUp)(pe),fe=!0===ue.dog&&me,ye=ue.dog?ue.dogs:0,ke=(0,w.parseYmd)(R),xe=(0,j.turnFor)(Y,h.settings.turnMins),je=E.filter(e=>e.date===R),we=e=>(0,j.dogTablesAt)(pe,je,Y,(0,j.slotStart)(R,e),xe,h.settings.turnMins,(0,D.closedAreasAt)(_,b,R,e)),Se=fe&&J?we(J):[];(0,c.useEffect)(()=>{he(null)},[fe,J,Y]);const Te=(0,x.bookingSlots)(h,ke,e=>E.filter(t=>t.date===R&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Y,R===(0,w.ymd)(p)?p:(0,w.addMins)(ke,0),e=>E.filter(t=>t.date===R&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),Ce=(0,T.guestPhone)(se),[ve,De]=(0,c.useState)(!1),Ie=J?Te.find(e=>e.time===J):void 0,Pe=Ie&&Ie.left=2&&!!J&&(!Oe||ve)&&(0,o.validParty)(Y)&&Ce.ok&&(0,T.emailOk)(le)&&(!ze||Be&&H)&&(!fe||Se.length>0)&&!Me,Le=ue.wheelchair>0||ue.stepFree,Fe=(0,$.bookingRulesOf)(h),Ae=(0,$.largeGroupTables)(Fe,Y),Re=(0,$.dogPartyCheck)(Fe,Y,!0===ue.dog,ue.assistDog),We=(0,$.bookingDepositSplit)((0,n.depositOf)(h.settings),Y,X,(0,P.needsPatch)(ue),(0,O.reservablesOf)(h));return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(ke)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,L.jsx)(P.FirstQuestions,{rid:b,value:ue,onChange:ce,party:Y,audience:"staff"}),ue.dog&&!me?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,L.jsx)(I.BookingDatePicker,{r:h,today:p,value:R,onChange:e=>{e!==R&&(W(e),Z(null),U(!1))}}),(0,L.jsxs)(C.Row,{gap:6,children:[(0,L.jsx)(C.Chip,{label:"Phone",selected:'phone'===re,onPress:()=>de('phone')}),(0,L.jsx)(C.Chip,{label:"In person",selected:'in-person'===re,onPress:()=>de('in-person')})]}),(0,L.jsx)(C.Field,{label:"Name",value:q,onChangeText:G,placeholder:"e.g. Reid",testID:"nb-name"}),(0,L.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:se,onChangeText:oe,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!Ce.ok&&se?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:Ce.error}):null,(0,L.jsx)(C.Field,{label:"Email (optional)",value:le,onChangeText:ae,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email",testID:"nb-email"}),(0,T.emailOk)(le)?null:(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),le.trim()&&Fe.marketingOptIn?(0,L.jsx)(C.Toggle,{label:Fe.marketingWords,value:ne,onChange:ie,testID:"nb-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,L.jsx)(i.AdultsChildren,{value:(0,r.peopleOf)(Y,X),onChange:e=>{V(e.partySize),Q(e.children),De(!1)},depositsOn:(0,n.depositOf)(h.settings).on&&(0,n.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:Te.map(e=>{const t=fe&&e.available&&!we(e.time).length||!(0,P.dogTimeOk)(h,E,R,e.time,ye);return(0,L.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(_,b,R,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:J===e.time,onPress:()=>{Z(e.time),U(!1),De(!1)}},e.time)})}),Oe?(0,L.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[Pe?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Y,Pe.left,Pe.time)}):null,$e?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)($e.time,$e.cap)}):null,(0,L.jsx)(C.Chip,{label:ve?'Booking over the limit: on':'Book anyway (over the limit)',selected:ve,onPress:()=>De(e=>!e),testID:"nb-over-ok"})]}):null,fe&&J?(0,L.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,L.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,L.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",pe.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),Se.length?pe.areas.filter(e=>Se.some(t=>t.area===e.name)).map(e=>(0,L.jsxs)(m.default,{style:{gap:6},accessibilityLabel:e.name,children:[(0,L.jsxs)(C.T,{size:13,center:!0,colour:S.colours.muted,children:[e.name,e.outdoor?' (outdoor)':'']}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:Se.filter(t=>t.area===e.name).map(e=>{const t=Se[0]?.table===e.table;return(0,L.jsx)(C.Chip,{testID:`nb-dog-table-${(0,l.tableNumbers)(e.table)}`,label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.seats} seats${t?' \xb7 best':''}${Le&&(0,O.accessibleSetUp)(pe)&&!(0,O.isAccessible)(pe,e.table)?' \xb7 not step-free':''}`,selected:(ge??Se[0].table)===e.table,onPress:()=>he(e.table)},e.table)})})]},e.id)):(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Y," at ",J,". Try another time."]})]}):null,ze?(0,L.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,L.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",ze.from,"\u2013",ze.to,ze.reason?` (${ze.reason})`:'']}),Be?(0,L.jsx)(C.Chip,{label:H?'Manager override on':'Override and book anyway',selected:H,onPress:()=>U(e=>!e)}):(0,L.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,Te.length?null:(0,L.jsx)(m.default,{testID:"nb-closed",children:(0,L.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(ke)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,L.jsx)(P.MoreQuestions,{rid:b,r:h,value:ue,onChange:ce,party:Y,date:R,time:J,today:(0,w.ymd)(p),bookings:E,audience:"staff",showTables:!1!==h.settings.tableRequests}),Le&&!(0,O.accessibleSetUp)(pe)?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,Ae&&!fe?(0,L.jsxs)(C.T,{size:14,colour:S.colours.goldLight,testID:"nb-large-group",children:["Large group: tables ",Ae.join(' + ')," joined."]}):null,Re.ok?null:(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,testID:"nb-dog-cap",children:["Online, a dog booking is for up to ",Fe.dogMaxParty," people. You can still book it here: check where they can sit."]}),(0,L.jsx)(C.Field,{label:"Notes (optional)",value:ee,onChangeText:te,placeholder:Fe.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"nb-notes"}),We.preorders?(0,L.jsxs)(C.Muted,{testID:"nb-preorder-deposit",children:["Pre-order deposit: ",(0,a.gbp)(We.preorders),We.adults?`, plus the group deposit: ${(0,a.gbp)(We.total)} in total`:'',". Staff can waive it."]}):null,(0,n.depositDue)((0,n.depositOf)(h.settings),Y,X)?(0,L.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(h.settings),Y,X))," (",(0,a.gbp)((0,n.depositOf)(h.settings).perPersonPence)," per adult for tables of ",(0,n.depositOf)(h.settings).fromParty,"+ adults",X?`; ${X} ${1===X?'child':'children'} free`:'; children free, and they do not count towards the number that needs a deposit',"). Staff can waive it. Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,L.jsx)(C.Muted,{children:"CoverCharge confirms the guest by email automatically (preview mode: shown in the Outbox, not sent)."}),Me?(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",J,". Try another time: dogs are very welcome then."]}):null,(0,L.jsx)(C.Button,{label:be.length?be[0]:'Save booking',testID:"nb-save",disabled:!Ne,onPress:()=>{if(R<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,P.needsPatch)(ue),s=ue.tableReq.find(e=>!fe||Se.some(t=>t.table===e)),o=fe?null:(0,B.requestedFreeTable)(ue.tableReq,{date:R,time:J,partySize:Y},pe.tables.map(e=>e.name),je,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:q.trim(),partySize:Y,date:R,time:J,notes:ee.trim(),security:We.total?'deposit':'none',depositPaid:0,...X?{children:X}:{},...We.total?{...(0,$.depositFields)(We),depositPolicy:(0,n.depositWords)((0,n.depositOf)(h.settings),Y,h.name,X).join(' '),depositRefundable:(0,n.depositOf)(h.settings).refundable,depositCutoffHours:(0,n.depositOf)(h.settings).cutoffHours}:{},phone:Ce.pretty,email:le.trim()||void 0,...ne?(0,$.marketingChoice)(le,!0):{},source:re,...e,...Te.find(e=>e.time===J)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...fe?{table:ge??s??Se[0]?.table}:o?{table:o}:{}}).then(e=>(0,z.postNewBookingToKitchen)(e,N)).catch(()=>{}),u?.({date:R,time:J,name:q.trim()}),t()}})]})}},1096,[812,1097,1098,843,851,841,1099,1100,1101,1102,17,842,385,85,856,1055,858,1103,1074,863,804,848,777,996,993,1104,1105,1077,1053,1076,1094,1093,1111,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return R}}),_e.useTableNames=W,_e.resetTableLive=E,_e.seatBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'seated'),E(e,t.table)},_e.finishBookingNow=async function(e,t){const s=(new Date).toISOString();await k.repo.bookings.update(t.id,(0,N.finishClearPatch)(s,t.table)),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=_,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return H}}),_e.TablePicker=U,_e.WalkInSheet=G,_e.AssignTableSheet=V,_e.undoNotice=Y,_e.NewBookingSheet=K,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[n,i]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>i({b:e}),combineTables:e=>i({b:e,combine:!0}),elements:(0,A.jsxs)(A.Fragment,{children:[s?(0,A.jsx)(G,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,A.jsx)(K,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,A.jsx)(V,{booking:n.b,combine:n.combine,onClose:()=>i(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),z=_r(_d[29]),B=_r(_d[30]),M=_r(_d[31]),N=_r(_d[32]),L=_r(_d[33]),A=_r(_d[34]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),R=Array.from({length:12},(e,t)=>String(t+1));function W(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function E(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function _(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=W(e),a=(0,v.useFloor)(t=>t.live[e])??{},n=(0,v.usePlan)(e),i=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(i,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const H=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function U({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=n?6:8,f=n?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(i??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,A.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],i=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!i,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,A.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:i?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,A.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,A.jsx)(C.T,{weight:"bold",size:22,colour:i?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,A.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,A.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,A.jsx)(C.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const q=[1,2,3,4,5,6,7,8];function G({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:r,r:d,now:u}=(0,y.useCtx)(15e3),x=_(r,u),[T,I]=(0,c.useState)(2),[P,$]=(0,c.useState)(!1),[O,z]=(0,c.useState)(i??null),B=(0,v.usePlan)(r),N=(0,k.useBookings)(r),L=(0,D.useBlocks)(e=>e.blocks),R=(0,D.closedAreasAt)(L,r,(0,w.ymd)(u),(0,w.hm)(u)),W=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(x).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(B,N.filter(e=>e.date===(0,w.ymd)(u)),e,T,u,(0,j.turnFor)(T,d.settings.turnMins),90,void 0,{closed:R})?.table??null},[B,N,x,T,R.size,u.getTime()]);(0,c.useEffect)(()=>{O&&(0,v.tablesOf)(O).some(e=>'Closed'===x[e]?.label)&&z(null)},[O,R.size]);const[H,G]=(0,c.useState)(!1),[V,Y]=(0,c.useState)(''),K=(e,t=String(e),s=()=>{$(!1),I(e)})=>{const o='9+'===t?P:!P&&T===e;return(0,A.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,A.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},Q=(0,A.jsx)(s.PartySizeInput,{value:T,onChange:I,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),X=(0,A.jsxs)(m.default,{style:{gap:8,width:n?256:void 0},children:[(0,A.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,A.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[q.map(e=>K(e)),K(9,'9+',()=>{$(!0),I(e=>e>=9?e:9)})]}),P?Q:null]}),[J,Z]=(0,c.useState)(!1),ee=async(t=O)=>{if(!J&&(0,M.guardBookingChange)(F)){Z(!0);try{const s=await k.repo.bookings.seatWalkIn(r,T,t??void 0,V);E(r,t??void 0),a(s),e()}finally{Z(!1)}}},te=(0,A.jsxs)(m.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,A.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,A.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),O?(0,A.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>z(null)}):null]}),(0,A.jsx)(U,{use:x,value:O,onPick:e=>{x[e]&&!x[e].busy?ee(e):z(O===e?null:e)},big:n,dense:n,best:W,bestSet:(0,h.bestTables)(B)}),(0,A.jsxs)(C.Muted,{children:["Tap a free table to seat them there",W&&!O?` (suggested for ${T}: ${(0,l.tableNumbers)(W)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(u)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,A.jsx)(C.Button,{label:`Seat walk-in \xb7 ${T} ${1===T?'person':'people'}${O?` \xb7 ${(0,l.tableNumbers)(O)}`:''}`,disabled:J,onPress:()=>{ee()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,A.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[X,te]}):(0,A.jsxs)(A.Fragment,{children:[X,te]}),(0,A.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[H?(0,A.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:V,onChangeText:Y,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,A.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,A.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,A.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function V({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,y.useCtx)(15e3),i=_(o,n),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(n)),t,e.partySize,n,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,n.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),P=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,$=D.reduce((e,t)=>e+P(t),0),O=D.length>0&&${if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&E(o,l),t()},B=x?(0,A.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,A.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,A.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${$} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,A.jsx)(m.default,{testID:"combine-short",children:(0,A.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-$," more needed. Add another table."]})}):null,(0,A.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,A.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,A.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,A.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,A.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,A.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${H(e)}`,testID:"assign-table-sheet",footer:B,children:[f&&!x?(0,A.jsx)(m.default,{testID:"assign-suggested",children:(0,A.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,A.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,A.jsx)(U,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function Y(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${H(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function K({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:N}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const R=(0,w.ymd)(p),[W,E]=(0,c.useState)(ee.blocks),[U,q]=(0,c.useState)(!1),[G,V]=(0,c.useState)(''),[Y,K]=(0,c.useState)(2),[Q,X]=(0,c.useState)(0),J=Math.min(Q,Math.max(0,Y-1)),[Z,ee]=(0,c.useState)(null),[te,se]=(0,c.useState)(''),[oe,le]=(0,c.useState)(''),[ae,ne]=(0,c.useState)(''),[ie,re]=(0,c.useState)(!1),[de,ue]=(0,c.useState)('phone'),[ce,be]=(0,c.useState)([]),[ge,he]=(0,c.useState)(''),[pe,me]=(0,c.useState)((0,P.emptyNeeds)()),fe=(0,P.needsMissing)(pe),[ye,ke]=(0,c.useState)(null),xe=(0,v.usePlan)(b),je=(0,O.dogSetUp)(xe),we=!0===pe.dog&&je,Se=pe.dog?pe.dogs:0,Te=(0,w.parseYmd)(W),Ce=(0,j.turnFor)(Y,h.settings.turnMins),ve=_.filter(e=>e.date===W),De=e=>(0,j.dogTablesAt)(xe,ve,Y,(0,j.slotStart)(W,e),Ce,h.settings.turnMins,(0,D.closedAreasAt)(H,b,W,e)),Ie=we&&Z?De(Z):[];(0,c.useEffect)(()=>{ke(null)},[we,Z,Y]);const Pe=(0,x.bookingSlots)(h,Te,e=>_.filter(t=>t.date===W&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Y,W===(0,w.ymd)(p)?p:(0,w.addMins)(Te,0),e=>_.filter(t=>t.date===W&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),$e=(0,T.guestPhone)(oe),[Oe,ze]=(0,c.useState)(!1),Be=Z?Pe.find(e=>e.time===Z):void 0,Me=Be&&Be.left=2&&!!Z&&(!Le||Oe)&&(0,o.validParty)(Y)&&$e.ok&&(0,T.emailOk)(ae)&&(!Ae||Fe&&U)&&(!we||Ie.length>0)&&!Re,Ee=pe.wheelchair>0||pe.stepFree,He=(0,$.bookingRulesOf)(h),Ue=(0,$.largeGroupTables)(He,Y),qe=(0,$.dogPartyCheck)(He,Y,!0===pe.dog,pe.assistDog),Ge=(0,$.bookingDepositSplit)((0,n.depositOf)(h.settings),Y,J,(0,P.needsPatch)(pe),(0,O.reservablesOf)(h));return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(Te)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,A.jsx)(P.FirstQuestions,{rid:b,value:pe,onChange:me,party:Y,audience:"staff"}),pe.dog&&!je?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,A.jsx)(I.BookingDatePicker,{r:h,today:p,value:W,onChange:e=>{e!==W&&(E(e),ee(null),q(!1))}}),(0,A.jsxs)(C.Row,{gap:6,children:[(0,A.jsx)(C.Chip,{label:"Phone",selected:'phone'===de,onPress:()=>ue('phone')}),(0,A.jsx)(C.Chip,{label:"In person",selected:'in-person'===de,onPress:()=>ue('in-person')})]}),(0,A.jsx)(C.Field,{label:"Name",value:G,onChangeText:V,placeholder:"e.g. Reid",testID:"nb-name"}),(0,A.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:oe,onChangeText:le,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!$e.ok&&oe?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:$e.error}):null,(0,A.jsx)(C.Field,{label:"Email (optional)",value:ae,onChangeText:ne,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email",testID:"nb-email"}),(0,T.emailOk)(ae)?null:(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),ae.trim()&&He.marketingOptIn?(0,A.jsx)(C.Toggle,{label:He.marketingWords,value:ie,onChange:re,testID:"nb-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,A.jsx)(i.AdultsChildren,{value:(0,r.peopleOf)(Y,J),onChange:e=>{K(e.partySize),X(e.children),ze(!1)},depositsOn:(0,n.depositOf)(h.settings).on&&(0,n.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,children:Pe.map(e=>{const t=we&&e.available&&!De(e.time).length||!(0,P.dogTimeOk)(h,_,W,e.time,Se);return(0,A.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(H,b,W,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:Z===e.time,onPress:()=>{ee(e.time),q(!1),ze(!1)}},e.time)})}),Le?(0,A.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[Me?(0,A.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Y,Me.left,Me.time)}):null,Ne?(0,A.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)(Ne.time,Ne.cap)}):null,(0,A.jsx)(C.Chip,{label:Oe?'Booking over the limit: on':'Book anyway (over the limit)',selected:Oe,onPress:()=>ze(e=>!e),testID:"nb-over-ok"})]}):null,we&&Z?(0,A.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,A.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,A.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",xe.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),Ie.length?xe.areas.filter(e=>Ie.some(t=>t.area===e.name)).map(e=>(0,A.jsxs)(m.default,{style:{gap:6},accessibilityLabel:e.name,children:[(0,A.jsxs)(C.T,{size:13,center:!0,colour:S.colours.muted,children:[e.name,e.outdoor?' (outdoor)':'']}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,children:Ie.filter(t=>t.area===e.name).map(e=>{const t=Ie[0]?.table===e.table;return(0,A.jsx)(C.Chip,{testID:`nb-dog-table-${(0,l.tableNumbers)(e.table)}`,label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.seats} seats${t?' \xb7 best':''}${Ee&&(0,O.accessibleSetUp)(xe)&&!(0,O.isAccessible)(xe,e.table)?' \xb7 not step-free':''}`,selected:(ye??Ie[0].table)===e.table,onPress:()=>ke(e.table)},e.table)})})]},e.id)):(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Y," at ",Z,". Try another time."]})]}):null,Ae?(0,A.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,A.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",Ae.from,"\u2013",Ae.to,Ae.reason?` (${Ae.reason})`:'']}),Fe?(0,A.jsx)(C.Chip,{label:U?'Manager override on':'Override and book anyway',selected:U,onPress:()=>q(e=>!e)}):(0,A.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,Pe.length?null:(0,A.jsx)(m.default,{testID:"nb-closed",children:(0,A.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(Te)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,A.jsx)(P.MoreQuestions,{rid:b,r:h,value:pe,onChange:me,party:Y,date:W,time:Z,today:(0,w.ymd)(p),bookings:_,audience:"staff",showTables:!1!==h.settings.tableRequests}),Ee&&!(0,O.accessibleSetUp)(xe)?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,Ue&&!we?(0,A.jsxs)(C.T,{size:14,colour:S.colours.goldLight,testID:"nb-large-group",children:["Large group: tables ",Ue.join(' + ')," joined."]}):null,qe.ok?null:(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,testID:"nb-dog-cap",children:["Online, a dog booking is for up to ",He.dogMaxParty," people. You can still book it here: check where they can sit."]}),(0,A.jsx)(C.T,{size:16,center:!0,children:"VIP or regular"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:L.TAGS.map(e=>{const t=ce.includes(e);return(0,A.jsx)(C.Chip,{label:e,selected:t,testID:`nb-tag-${e}`,onPress:()=>be(t?ce.filter(t=>t!==e):[...ce,e].sort())},e)})}),(0,A.jsx)(C.T,{size:16,center:!0,children:"Occasion"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:L.OCCASIONS.map(e=>(0,A.jsx)(C.Chip,{label:e.label,selected:ge===e.id,testID:`nb-occasion-${e.id||'none'}`,onPress:()=>he(e.id)},e.id||'none'))}),(0,A.jsx)(C.Field,{label:"Notes (optional)",value:te,onChangeText:se,placeholder:He.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"nb-notes"}),Ge.preorders?(0,A.jsxs)(C.Muted,{testID:"nb-preorder-deposit",children:["Pre-order deposit: ",(0,a.gbp)(Ge.preorders),Ge.adults?`, plus the group deposit: ${(0,a.gbp)(Ge.total)} in total`:'',". Staff can waive it."]}):null,(0,n.depositDue)((0,n.depositOf)(h.settings),Y,J)?(0,A.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(h.settings),Y,J))," (",(0,a.gbp)((0,n.depositOf)(h.settings).perPersonPence)," per adult for tables of ",(0,n.depositOf)(h.settings).fromParty,"+ adults",J?`; ${J} ${1===J?'child':'children'} free`:'; children free, and they do not count towards the number that needs a deposit',"). Staff can waive it. Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,A.jsx)(C.Muted,{children:"CoverCharge confirms the guest by email automatically (preview mode: shown in the Outbox, not sent)."}),Re?(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",Z,". Try another time: dogs are very welcome then."]}):null,(0,A.jsx)(C.Button,{label:fe.length?fe[0]:'Save booking',testID:"nb-save",disabled:!We,onPress:()=>{if(W<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,P.needsPatch)(pe),s=pe.tableReq.find(e=>!we||Ie.some(t=>t.table===e)),o=we?null:(0,B.requestedFreeTable)(pe.tableReq,{date:W,time:Z,partySize:Y},xe.tables.map(e=>e.name),ve,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:G.trim(),partySize:Y,date:W,time:Z,notes:te.trim(),security:Ge.total?'deposit':'none',depositPaid:0,...J?{children:J}:{},...Ge.total?{...(0,$.depositFields)(Ge),depositPolicy:(0,n.depositWords)((0,n.depositOf)(h.settings),Y,h.name,J).join(' '),depositRefundable:(0,n.depositOf)(h.settings).refundable,depositCutoffHours:(0,n.depositOf)(h.settings).cutoffHours}:{},phone:$e.pretty,email:ae.trim()||void 0,...ie?(0,$.marketingChoice)(ae,!0):{},source:de,...e,...Pe.find(e=>e.time===Z)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...ce.length?{tags:ce}:{},...ge?{occasion:ge}:{},...we?{table:ye??s??Ie[0]?.table}:o?{table:o}:{}}).then(e=>(0,z.postNewBookingToKitchen)(e,N)).catch(()=>{}),u?.({date:W,time:Z,name:G.trim()}),t()}})]})}},1096,[812,1097,1098,843,851,841,1099,1100,1101,1102,17,842,385,85,856,1055,858,1103,1074,863,804,848,777,996,993,1104,1105,1077,1053,1076,1094,1093,1111,1112,8]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,S]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{S(String(e))},[e]);const T=e=>p((0,s.clampParty)(e,b,y)),$=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>T(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:u.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(c.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:u.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?$(-10,'\u221210',"10 fewer people"):null,$(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{S(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&T((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);S(String(e)),T(e)},returnKeyType:"done",blurOnSubmit:!0,onSubmitEditing:e=>{e?.target?.blur?.()},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:u.colours.border,color:u.colours.text,backgroundColor:u.colours.surface,textAlign:'center',fontSize:20,fontFamily:u.fonts.semibold}}),$(1,'+','One more person'),y-b>=20?$(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),u=r(_d[5]),c=r(_d[6]),d=r(_d[7])},1097,[17,385,395,85,1098,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"overCapacityNote",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"overPartiesNote",{enumerable:!0,get:function(){return b}});const t=100,n=1,o=`Bookings are for ${n} to ${t} people.`,u=o=>'number'==typeof o&&Number.isInteger(o)&&o>=n&&o<=t,c=(o,u=n,c=t)=>{const s=parseInt(String(o??'').replace(/\D/g,'').slice(0,4),10);return Math.max(u,Math.min(c,Number.isFinite(s)?s:u))},s=(o,u=n,c=t)=>Math.max(u,Math.min(c,Math.round(Number(o)||u))),f=(t,n,o)=>n<=0?`${o} is already full for booked Covers. Booking ${t} more goes over the venue\u2019s limit: check tables and staffing.`:`${t} is more than the ${n} Covers left at ${o}. Booking goes over the venue\u2019s limit by ${t-n}: check tables and staffing.`,b=(t,n)=>`${t} already has the most bookings we take at one start time (${n}). Booking another goes over the venue\u2019s limit: check tables and staffing.`},1098,[]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdultsChildren=function({value:e,onChange:t,depositsOn:h,testID:x="people"}){const p=e=>t((0,s.storedPeople)(e)),b=(0,s.totalLine)(e);return(0,o.jsxs)(l.default,{testID:x,style:{gap:8,alignItems:'center',width:'100%'},children:[(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",children:"Adults"}),(0,o.jsx)(n.PartySizeInput,{value:e.adults,min:1,max:(0,s.maxAdults)(e.children),onChange:t=>p({adults:t,children:e.children}),label:"Adults",testID:`${x}-adults`}),(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",children:"Children"}),(0,o.jsx)(n.PartySizeInput,{value:e.children,min:0,max:(0,s.maxKids)(e.adults),onChange:t=>p({adults:e.adults,children:t}),label:"Children",testID:`${x}-children`}),(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",colour:c.colours.goldLight,testID:`${x}-total`,accessibilityLabel:b,children:b}),h?(0,o.jsx)(u.Muted,{center:!0,children:"Children never pay a deposit."}):null]})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4]),c=r(d[5]),o=r(d[6])},1099,[17,85,1100,1097,777,804,8]); @@ -1192,18 +1192,18 @@ __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,"ARM_MS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SELECT_HINT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SELECTED_A11Y",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"TABLE_SELECT_HINT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isArmed",{enumerable:!0,get:function(){return l}}),e.releaseOn=function(n,o,c,u){const b=l(n,o,u);return c?b?{arm:null,action:'move'}:{arm:n&&u-n.at!!n&&n.id===o&&c-n.at!e.signOff),S=k.filter(e=>e.signOff),_=j.map(o.allergenLabel).join(', '),C=e=>e.map(e=>e.name).join(', ')||'none';return(0,f.jsxs)(l.default,{testID:"menu-allergy-check",style:{gap:6,borderWidth:1,borderColor:p.length?h.colours.red:h.colours.border,borderRadius:12,padding:10,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(u.T,{weight:"semibold",children:["Allergy check against the menu (",_,")"]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.red,children:["Contains: ",p.length," dish",1===p.length?'':'es']}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.amber,children:["May contain: ",M.length]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.ok,children:["Free from ",1===j.length?'it':'them'," (signed off): ",S.length]}),w.length?(0,f.jsxs)(u.Muted,{children:[w.length," more awaiting the head chef's sign-off, so not shown as safe."]}):null,(0,f.jsx)(n.default,{testID:"menu-allergy-details",accessibilityRole:"button",onPress:()=>y(!x),hitSlop:6,children:(0,f.jsx)(u.T,{size:14,colour:h.colours.gold,children:x?'Hide dishes':'Show dishes'})}),x?(0,f.jsxs)(l.default,{style:{gap:4},children:[(0,f.jsxs)(u.Muted,{children:["Contains: ",C(p)]}),(0,f.jsxs)(u.Muted,{children:["May contain: ",C(M)]}),(0,f.jsxs)(u.Muted,{children:["Free from: ",C(S)]})]}):null,(0,f.jsx)(u.Muted,{children:'guest'===m?'From the kitchen\u2019s signed-off recipe cards. Specials on the board are checked by staff on the day.':'From the signed-off recipe cards. Specials on the board have their own allergens. Still check with the guest and the kitchen.'})]})};var s=r(d[0]),n=e(r(d[1])),l=e(r(d[2])),t=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8])},1110,[17,385,85,858,845,847,804,777,8]); __d(function(g,r,i,_a,m,_e,d){"use strict";function t(t){return String(t??'').split('+').map(t=>t.trim()).filter(Boolean)}function e(t){return t.length<=1?t[0]??'':2===t.length?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`}function n(n){const o=t(n);return o.length>1?`tables ${e(o)}`:o.length?`table ${o[0]}`:''}Object.defineProperty(_e,'__esModule',{value:!0}),_e.tableWords=n,Object.defineProperty(_e,"RECENT_SEATED_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"FINISH_UNDO_MS",{enumerable:!0,get:function(){return a}}),_e.seatedAgoMs=s,_e.seatedAgoWords=u,_e.needsRecentSeatedWarning=c,_e.finishConfirmPrompt=function(t){const e=t.name.trim()||'This party',n=t.parties&&t.parties>1?t.parties:1,o=t.seated&&c({seatedAt:t.seatedAt},t.now),a=o?u(s({seatedAt:t.seatedAt},t.now)):'',l=f(t.table);if(!t.seated)return`Mark ${e} finished without seating?`;if(n>1){return`${n} parties seated here${o?`, including ${e} seated ${a}`:''}. Mark all finished${l}?`}return o?`${e} seated ${a}. Mark finished${l}?`:`Mark ${e} finished${l}?`},_e.restoreSeatedPrompt=function(t,e){return`${t.trim()||'This party'} is finished. Seat them at ${n(e)}?`},_e.lastTableFromAudit=l,_e.tableForUndo=function(t,e){const n=String(t.table??'').trim();if(n)return n;const o=String(t.lastTable??'').trim();return o||l(e)},_e.finishClearPatch=function(t,e){const n=String(e??'').trim();return{status:'finished',finishedAt:t,table:void 0,...n?{lastTable:n}:{}}},_e.finishUndoPatch=function(t){const e=String(t??'').trim();return{status:'seated',finishedAt:void 0,lastTable:void 0,...e?{table:e}:{table:void 0}}};const o=15,a=15e3;function s(t,e){if(!t.seatedAt)return null;const n=new Date(t.seatedAt).getTime();return Number.isFinite(n)?Math.max(0,e.getTime()-n):null}function u(t){const e=Math.round(t/1e3);if(e<1)return'just now';if(e<60)return`${e} second${1===e?'':'s'} ago`;const n=Math.round(e/60);if(n<60)return`${n} minute${1===n?'':'s'} ago`;const o=Math.round(n/60);return`${o} hour${1===o?'':'s'} ago`}function c(t,e){const n=s(t,e);return null!=n&&n<9e5}function f(t){const e=t?n(t):'';return e?` and set ${e} to needs clearing`:''}function l(t){if(!t?.length)return;const e=[...t].sort((t,e)=>String(e.at??'').localeCompare(String(t.at??'')));for(const t of e){if(t.action&&'tables'!==t.action)continue;const e=String(t.from_value??'').trim(),n=String(t.to_value??'').trim();if(e&&!n)return e.replace(/\+/g,'+')}for(const t of e){if(t.action&&'tables'!==t.action)continue;const e=String(t.to_value??'').trim();if(e)return e;const n=String(t.from_value??'').trim();if(n)return n}}},1111,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FinishConfirm=I,_e.RestoreSeatedConfirm=function({prompt:e,onYes:t,onNo:n}){return(0,k.jsxs)(s.default,{testID:"restore-seated-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:"Yes, seat them",testID:"restore-seated-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"restore-seated-no",onPress:n,style:w})]})},Object.defineProperty(_e,"finishBookingNow",{enumerable:!0,get:function(){return p.finishBookingNow}}),_e.undoFinishedNow=D,_e.restoreFinishedToTable=async function(e,t,s){const o=(0,b.tableKey)(s);await n.repo.bookings.update(t.id,{...(0,f.tablePatch)(o||null),status:'seated',finishedAt:void 0,lastTable:void 0}),o&&(0,p.resetTableLive)(e,o)},_e.offerFinishUndo=F,_e.finishAndOfferUndo=v,_e.finishUnseatedAndOfferUndo=N,_e.FinishButton=function({rid:e,b:s,name:n,allowed:o=!0,hint:c,small:b,bigToast:f,testID:u,label:h="Finished",a11y:p,kind:D="secondary"}){const[F,j]=t.default.useState(!1);if(!o)return null;const x=(0,l.finishConfirmPrompt)({name:n,table:s.table,seatedAt:s.seatedAt,now:new Date,seated:'seated'===s.status});if(F)return(0,k.jsx)(I,{prompt:x,onNo:()=>j(!1),onYes:()=>{j(!1),'seated'===s.status?v(e,[s],n,{big:f,table:s.table}):N(e,s,n,{big:f})}});return(0,k.jsx)(y.Button,{small:b,kind:D,label:h,testID:u,accessibilityLabel:p??`${h}: ${n}`,accessibilityHint:c,disabled:!o,onPress:()=>j(!0),style:b?void 0:w})};var t=e(r(d[0])),s=e(r(d[1])),n=r(d[2]),o=r(d[3]),l=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),u=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]);const w={minHeight:64};function I({prompt:e,onYes:t,onNo:n,yesLabel:o="Yes, finish"}){return(0,k.jsxs)(s.default,{testID:"finish-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:o,testID:"finish-confirm-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"finish-confirm-no",onPress:n,style:w})]})}async function D(e,t,s){const c=(0,l.tableForUndo)(t,s);await n.repo.bookings.update(t.id,(0,l.finishUndoPatch)(c)),c&&(0,o.tablesOf)(c).forEach(t=>o.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function F(e){const t=e.bookings[0];if(!t)return;const s=e.bookings.length>1?`${e.bookings.length} parties finished.`:`${e.name} finished.`,n=e.table?`${(0,c.tableWords)(e.table).replace(/^t/,'T')} needs clearing.`:void 0,o=`finish-undo-${t.id}`;(0,u.notify)({id:o,title:s,body:n,timeoutMs:l.FINISH_UNDO_MS,big:e.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{for(const t of e.bookings)await D(e.rid,{...t,table:void 0,lastTable:t.table||t.lastTable});(0,u.dismissNotice)(o)})()}}]})}async function v(e,t,s,n){const o=n?.table??t.find(e=>e.table)?.table;for(const s of t)await(0,p.finishBookingNow)(e,s);F({rid:e,bookings:t,name:s,table:o,big:n?.big})}async function N(e,t,s,o){await n.repo.bookings.setStatus(t.id,'finished');const c=`finish-undo-${t.id}`;(0,u.notify)({id:c,title:`${s} finished.`,timeoutMs:l.FINISH_UNDO_MS,big:o?.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{await n.repo.bookings.setStatus(t.id,t.walkIn?'cancelled':'confirmed'),(0,u.dismissNotice)(c)})()}}]})}},1112,[17,85,858,996,1111,1113,1094,1090,916,804,777,1096,8]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return s.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return c}}),e.freeTablesNow=function(t,a,s=!1){const l=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),n=l.filter(([,t])=>t.table.maxSeats>=a),o=t=>t.map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}));return s?[...o(n),...o(l.filter(([,t])=>t.table.maxSeatsh[t]&&(l.includes(h[t].status)||'dirty'===h[t].status||'blocked'===h[t].status));if(p.length&&p.every(t=>h[t])&&!t.length)f.push({id:'seat',label:`Seat at ${b(s.table).replace(/^t/,'T')}`,a11y:`Seat ${n}, ${u(s.partySize)}, at ${b(s.table)}`,table:s.table});else if(c(s,$)){const a=p.length?t.length?`${b(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===h[t[0]].status?'waiting to be cleared':'blocked'===h[t[0]].status?'blocked':'in use'}`:`${b(s.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';f.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${n}, ${u(s.partySize)}. ${a}.`,note:a})}c(s,$)&&f.push({id:'finished',label:'Finished',a11y:`Finished, ${n}, ${s.time} booking, without seating at a table`}),o($,s)<=0&&f.push({id:'noshow',label:'No-show',a11y:`No-show, ${n}, ${s.time} booking`})}return f.push({id:'details',label:'Guest details',a11y:`Guest details, ${n}`}),f};var t=r(d[0]),a=r(d[1]),s=r(d[2]);const l=['seated','mains','dessert','bill'],n=t=>new Date(`${t.date}T${t.time}:00`),o=(t,a)=>(n(a).getTime()-t.getTime())/6e4,b=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},u=t=>`${t} ${1===t?'person':'people'}`,c=(t,a)=>o(a,t)<=45},1113,[996,863,1074]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return x}}),_e.cancelWalkInWords=I,_e.reinstateWalkInWords=$,_e.cancelWalkInNow=j,_e.reinstateWalkInNow=C,_e.CancelWalkInButton=function({rid:e,b:t,onDone:o,small:c,big:u}){const[b,f]=(0,n.useState)(!1),k=(0,l.useInStaffApp)(),x=(0,s.useSeatClearFinish)();return p(t)?k&&!x.ok?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(w.Button,{kind:"secondary",small:c,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>f(!0),style:u?{minHeight:64}:c?{minHeight:44}:h}),b?(0,y.jsx)(W,{rid:e,b:t,onClose:()=>f(!1),onDone:o}):null]}):null},_e.CancelWalkInConfirm=W,_e.ReinstateWalkInButton=function({rid:e,b:t,today:o,onDone:u,small:b}){const[f,p]=(0,n.useState)(!1),I=(0,l.useInStaffApp)(),j=(0,s.useSeatClearFinish)();if(!x(t,o))return null;if(I&&!j.ok)return null;const W=$(t);if(!f)return(0,y.jsx)(w.Button,{kind:"ghost",small:b,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>p(!0),style:b?{minHeight:44}:h});return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:()=>p(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:W,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:W})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[h,{flexGrow:1}],onPress:async()=>{await C(e,t),p(!1),u?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>p(!1),style:h})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]),o=r(d[4]),c=(e=o)&&e.__esModule?e:{default:e},u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]),w=r(d[9]),y=r(d[10]);const h={minHeight:56},p=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),x=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function I(e){const t=(0,b.tablesOf)(e.table),n=(0,f.tablesWords)(t);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${t.length?` at ${n}`:''}, arrived ${e.time}? It comes off the Covers${t.length?` and ${n} ${t.length>1?'go':'goes'} back to Free`:''}.`}function $(e){return`Put walk-in ${e.ref} back to seated? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`}async function j(e,n){await u.repo.bookings.setStatus(n.id,'cancelled'),await u.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,b.tablesOf)(n.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function C(e,t){await u.repo.bookings.setStatus(t.id,'seated'),(0,b.tablesOf)(t.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function W({rid:e,b:t,onClose:n,onDone:l}){const s=I(t);return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:s,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:s})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[h,{flexGrow:1}],onPress:async()=>{await j(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,b.tablesOf)(t.table).length?` ${(0,f.tablesWords)((0,b.tablesOf)(t.table))} free.`:''}`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:h})]})]})}},1114,[1115,17,1055,1117,85,858,996,1094,804,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.cancelStamp=C,_e.cancelBookingNow=w,_e.reinstateBookingNow=$,_e.CancelBookingButton=function({rid:e,b:n,name:o,onDone:s,big:l,small:c}){const[u,f]=(0,t.useState)(!1);return(0,b.canCancelBooking)(n)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(x.Button,{kind:"secondary",small:c,label:"Cancel booking",testID:`cancel-booking-${n.id}`,accessibilityLabel:`Cancel booking for ${o}, ${n.time}, ${n.partySize} Covers`,onPress:()=>f(!0),style:l?{minHeight:64}:c?{minHeight:44}:j}),u?(0,h.jsx)(D,{rid:e,b:n,name:o,onClose:()=>f(!1),onDone:s}):null]}):null},_e.CancelBookingConfirm=D,_e.ReinstateBookingButton=function({b:e,name:n,today:s,onDone:l}){const[c,u]=(0,t.useState)(!1);if(!(0,b.canReinstateBooking)(e,s))return null;const y=(0,b.reinstateBookingWords)(e,n);if(!c)return(0,h.jsx)(x.Button,{kind:"ghost",label:"Undo cancel",testID:`reinstate-booking-${e.id}`,accessibilityLabel:`Undo cancel for ${n}`,onPress:()=>u(!0),style:j});return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:()=>u(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center'},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, put back to booked",testID:"reinstate-booking-yes",accessibilityLabel:`Yes, put ${n} back to booked`,style:[j,{flexGrow:1}],onPress:async()=>{await $(e),u(!1),l?.(`${n} put back to booked.`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-booking-no",onPress:()=>u(!1),style:j})]})]})};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]),c=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]),y=r(d[8]),k=r(d[9]),p=r(d[10]),x=r(d[11]),h=r(d[12]);const j={minHeight:56},B={display:'Display',owner:'Managers app',staff:'Staff app',chef:'Kitchen app',customer:'Customer page'};function C(e){const t=y.useSession.getState().meId,n=t?k.useOwner.getState().staff.find(e=>e.id===t):void 0,o=B[p.APP_VARIANT]??'CoverCharge';return{by:n?`${n.name.replace(' (example)','')} (${o})`:o,at:(new Date).toISOString(),app:o,...e.table?{table:e.table}:{}}}async function w(e,t){const n=(0,l.tablesOf)(t.table);await s.repo.bookings.update(t.id,{status:'cancelled',cancelled:C(t),...(0,c.tablePatch)(null)}),n.forEach(t=>l.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function $(e){await s.repo.bookings.setStatus(e.id,'confirmed')}function D({rid:e,b:t,name:n,onClose:s,onDone:c}){const y=(0,b.cancelBookingWords)(t,n),k=(0,l.tablesOf)(t.table);return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:s,title:"Cancel booking?",maxWidth:560,testID:"cancel-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center',gap:8},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, cancel booking",testID:"cancel-booking-yes",accessibilityLabel:`Yes, cancel booking for ${n}`,style:[j,{flexGrow:1}],onPress:async()=>{await w(e,t),s(),c?.(`${n} cancelled.${k.length?` ${(0,u.tablesWords)(k)} free.`:''}`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep booking",testID:"cancel-booking-no",accessibilityLabel:`Keep booking for ${n}`,onPress:s,style:j})]})]})}},1115,[17,85,858,996,1090,1116,1094,804,920,876,856,777,8]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canCancelBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canReinstateBooking",{enumerable:!0,get:function(){return t}}),e.cancelBookingWords=function(n,t){const o=`${n.partySize} Cover${1===n.partySize?'':'s'}`;return`Cancel booking for ${t}, ${n.time}, ${o}? The table is freed. Website bookings will cancel it on the website and may email the guest.`},e.reinstateBookingWords=function(n,t){return`Put ${t} back to booked for ${n.time}? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`},e.cancelledOnDay=o,e.cancelledDayTally=function(n,t){const a=o(n,t),l=a.filter(n=>!!n.walkIn),c=a.filter(n=>!n.walkIn);return{count:a.length,covers:a.reduce((n,t)=>n+t.partySize,0),bookings:c.length,bookingCovers:c.reduce((n,t)=>n+t.partySize,0),walkIns:l.length,walkInCovers:l.reduce((n,t)=>n+t.partySize,0),list:a}},e.cancelledTallyWords=function(n,t="today"){if(!n.count)return`No cancellations ${t}`;const o=[],a=n.bookings??0,l=n.walkIns??0;a&&o.push(`${a} booking${1===a?'':'s'} (${n.bookingCovers??0} Cover${1===(n.bookingCovers??0)?'':'s'})`);l&&o.push(`${l} walk-in${1===l?'':'s'} (${n.walkInCovers??0} Cover${1===(n.walkInCovers??0)?'':'s'})`);if(!o.length)return`Cancelled ${t}: ${n.count} \xb7 ${n.covers} Cover${1===n.covers?'':'s'}`;return`Cancelled ${t}: ${o.join(' \xb7 ')}`};const n=n=>!n.walkIn&&('confirmed'===n.status||'pending'===n.status||'seated'===n.status),t=(n,t)=>!n.walkIn&&'cancelled'===n.status&&n.date>=t;function o(n,t){return n.filter(n=>n.date===t&&'cancelled'===n.status).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name))}},1116,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSeatClearFinish=function(){const t=(0,A.useSignedIn)(),o=(0,A.useInStaffApp)(),_='staff'===s.APP_VARIANT||'chef'===s.APP_VARIANT||o,l=(0,c.canSeatClearFinish)({device:s.IS_CAR||'display'===s.APP_VARIANT||!_&&!t,viaDisplay:(0,n.isKitchenViaDisplay)(),role:t?.role,ownerAccess:t?.ownerAccess,managerAccess:t?.managerAccess});return{ok:l,hint:l?void 0:c.SEAT_CLEAR_HINT}};var s=r(d[0]),n=r(d[1]),c=r(d[2]),A=r(d[3])},1117,[856,922,1118,1055]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEAT_CLEAR_HINT",{enumerable:!0,get:function(){return n}}),e.canSeatClearFinish=function(n){return!(!n.device&&!n.viaDisplay)||('owner'===n.role||'manager'===n.role||!(!n.ownerAccess&&!n.managerAccess))};const n='Ask a manager to seat, finish or clear a table.'},1118,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:s,who:i,role:n,inStaffApp:l,shiftManager:a,big:o,testID:d}){const[h,u]=(0,t.useState)(!1),p=(0,b.useSession)(e=>e.meId),y=(0,m.useOwner)(e=>e.staff.find(e=>e.id===p&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:l,role:n,shiftManager:a})||p&&!(0,x.canChangeBookings)(y)?null:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:d??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),h?(0,N.jsx)(V,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:n,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,l.useBookings)(e).filter(e=>!e.walkIn&&e.date>=s&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,200);return o?(0,N.jsx)(V,{rid:e,id:o,who:i,hidePrivate:a,onClose:n}):(0,N.jsxs)(z.Sheet,{visible:!0,onClose:n,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,N.jsx)(z.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${L(e.date,s)} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${L(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,N.jsx)(z.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,N.jsx)(z.Button,{kind:"ghost",label:"Close",onPress:n,style:{minHeight:44}})]})},_e.EditBookingSheet=V;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=(e=i)&&e.__esModule?e:{default:e},l=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),f=_r(_d[19]),C=_r(_d[20]),I=_r(_d[21]),k=_r(_d[22]),w=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),O=_r(_d[28]),W=_r(_d[29]),z=_r(_d[30]),B=_r(_d[31]),N=_r(_d[32]);const E=/^([01]\d|2[0-3]):[0-5]\d$/,R=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const L=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,D.ymd)(s)?'Tomorrow':F(e)};const A=e=>e?(e/100).toFixed(e%100?2:0):'',M=e=>{const t=(0,B.parseMoneyInput)(e);return null!=t&&t>=0?Math.round(100*t):NaN},F=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',H=e=>{const t=e.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);return t?`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`:''},_=e=>e.charAt(0).toUpperCase()+e.slice(1);function Y({title:e,children:t,testID:s}){return(0,N.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,N.jsx)(z.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const G=({label:e,value:t,onChange:s,max:i=20,testID:n})=>(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:e}),(0,N.jsx)(z.Stepper,{testID:n,value:t,min:0,max:i,onChange:s,label:e})]});function V({rid:e,id:i,who:b,onClose:m,hidePrivate:x=!1}){(0,$.useBlurOutside)();const B=(0,l.useBookings)(e),L=B.find(e=>e.id===i),V=(0,d.useRestaurant)(e),K=(0,a.usePlan)(e),U=(0,o.useBlocks)(e=>e.blocks),[q,X]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Q,J]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Z,ee]=(0,t.useState)(!1),[te,se]=(0,t.useState)(null),[ie,ne]=(0,t.useState)(null),[le,ae]=(0,t.useState)(!1),[oe,de]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositDue:0)),[re,ce]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositAmount:0)),[he,ue]=(0,t.useState)(F(L?(0,c.draftOf)(L).depositDate:''));if(!L||!q||!V)return null;const pe=e=>{se(null),ne(null),X({...q,...e})},ge=(0,O.depositOf)(V.settings),be=e=>{const t=e.partySize??q.partySize,s=Math.min(e.children??q.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(L)&&q.depositOn&&!q.depositPaid&&M(oe||'0')===(0,O.depositDue)(ge,q.partySize,q.children??0)){const e=(0,O.depositDue)(ge,t,s);e>0&&de(A(e))}pe({...e,children:s})},me=(0,v.bookingSlotMinutesOf)(V),xe=R(q.time),ye=E.test(xe),je=q.area?K.areas.filter(e=>e.name===q.area).map(e=>e.id):null,De=e=>!je||e.split('+').every(e=>je.includes(K.tables.find(t=>t.name===e)?.areaId??'')),ve=(0,y.tableOptions)(K,B.filter(e=>e.date===q.date),q.table).filter(e=>De(e)||e===q.table),fe=!(q.depositOn&&(Number.isNaN(M(oe||'0'))||q.depositPaid&&(Number.isNaN(M(re||'0'))||he.trim()&&!H(he)))),Ce={...q,time:xe,depositDue:M(oe||'0')||0,depositAmount:M(re||'0')||0,depositDate:H(he)},Ie=(0,c.changedDraftFields)(Q??(0,c.draftOf)(L),Ce),ke=V.settings.turnMins??90,we=!!q?.email?.trim()&&q.email.trim()!==(L?.email??'').trim(),Te=(0,u.bookingRulesOf)(V),Se=async()=>{const t=(0,c.editPatch)(L,Ce,{by:b||'Team member',app:r.APP_VARIANT});if(le&&we&&Object.assign(t,(0,u.marketingChoice)(Ce.email,!0)),Object.keys(t).length&&await l.repo.bookings.update(L.id,t),'seated'===L.status&&'table'in t&&t.table!==L.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(L.table),n=s(t.table),l=a.useFloor.getState(),o=i.map(t=>l.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!n.includes(e)).forEach(t=>l.setLive(e,t,{stage:void 0,dirty:!0})),n.forEach(t=>l.setLive(e,t,{stage:o,dirty:!1}))}ne(`Saved. Changed: ${(0,c.editedWords)(Ie)}.`),se(null),m()},$e=()=>{const t=ye?(0,o.blockAt)(U,e,q.date,xe):void 0,s=(0,c.editWarnings)(L,Ce,B,t,ke,K);!s.length||te?Se():se(s)},Pe=q.allergies??[],Oe=e=>pe({allergyNone:!1,allergies:Pe.some(t=>t.allergen===e)?Pe.filter(t=>t.allergen!==e):[...Pe,{allergen:e,severity:'allergy'}]}),We=(0,c.historyLines)(L);return(0,N.jsxs)(z.Sheet,{visible:!0,onClose:()=>{Ie.length?ee(!0):(ee(!1),m())},title:`Edit booking \xb7 ${L.name} \xb7 ${L.ref}`,maxWidth:760,testID:"edit-booking-sheet",onTypingDone:()=>{(0,C.hideKeyboard)(),Ie.length&&ye&&fe&&q.name.trim().length>=1&&$e()},typingDoneLabel:Ie.length?'Done, save changes':'Done, hide the keyboard',footer:(0,N.jsx)(z.Button,{label:te?'Save anyway':'Save changes',testID:"edit-save",disabled:!ye||!fe||q.name.trim().length<1||!Ie.length,onPress:$e,style:{minHeight:56,width:'100%'}}),children:[(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(w.DepositChip,{b:L,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(L)?(0,N.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,N.jsxs)(Y,{title:"Deposit",testID:"edit-section-deposit",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No deposit",selected:!q.depositOn,testID:"edit-deposit-none",onPress:()=>pe({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit due",selected:!!q.depositOn&&!q.depositPaid&&!q.depositWaived,testID:"edit-deposit-due",onPress:()=>pe({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit paid",selected:!!q.depositOn&&!!q.depositPaid,testID:"edit-deposit-paid",onPress:()=>{re||ce(oe),he||ue(F((0,D.ymd)(new Date))),pe({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsx)(z.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsxs)(z.T,{size:15,center:!0,colour:j.colours.goldLight,testID:"edit-deposit-waived-by",children:[L.depositWaived?.by?(0,O.waiverText)(L.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,q.depositWaived||Ie.includes('deposit')?null:(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(P.WaiveDepositButton,{b:L,who:b,onDone:e=>{const t={...q,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e};X(t),J(s=>s?{...s,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e}:t)}})}),q.depositOn?(0,N.jsx)(z.Field,{money:!0,label:"Deposit due (\xa3)",value:oe,onChangeText:e=>{de(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,q.depositOn&&q.depositPaid?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Field,{money:!0,label:"Amount paid (\xa3)",value:re,onChangeText:e=>{ce(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"How was it paid?"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,N.jsx)(z.Chip,{label:_(e),selected:q.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>pe({depositMethod:e})},e))}),(0,N.jsx)(z.Field,{label:"Date paid (DD/MM/YYYY)",value:he,onChangeText:e=>{ue((0,s.slashDate)(e,he)),pe({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),he.trim()&&!H(he)?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,fe?null:(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,N.jsx)(z.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,N.jsxs)(Y,{title:"When",testID:"edit-section-when",children:[(0,N.jsx)(k.BookingDatePicker,{r:V,today:new Date,value:q.date,onChange:e=>pe({date:e})}),(0,N.jsx)(I.TimeRoller,{testID:"edit-time",value:(0,f.snapTime)(q.time,me),onChange:e=>pe({time:e}),step:me}),ye?null:(0,N.jsx)(z.T,{size:15,colour:j.colours.amber,center:!0,children:"Choose a time on the roller."}),(0,N.jsx)(T.AdultsChildren,{value:(0,S.peopleOf)(q.partySize,q.children),onChange:e=>be(e),depositsOn:ge.on&&ge.perPersonPence>0,testID:"edit-people"}),(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:"Table time"}),(0,N.jsx)(z.Stepper,{testID:"edit-duration",value:q.duration||0,min:0,max:360,step:15,onChange:e=>pe({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,N.jsxs)(Y,{title:"Where",testID:"edit-section-where",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"Any area",selected:!q.area,testID:"edit-area-any",onPress:()=>pe({area:''})}),K.areas.map(e=>(0,N.jsx)(z.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:q.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>pe({area:e.name})},e.id))]}),(0,N.jsx)(z.T,{size:18,weight:"semibold",center:!0,children:(0,y.tableButtonLabel)(q.table)}),(0,y.splitChoices)(q.table).length?(0,N.jsxs)(n.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:"Split the joined tables"}),(0,N.jsx)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,y.splitChoices)(q.table).map(e=>(0,N.jsx)(z.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>pe({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:q.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(q.table?'':', chosen'),onPress:()=>pe({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),ve.map(e=>(0,N.jsx)(z.Button,{kind:e===q.table?'primary':'secondary',label:(0,y.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,y.tableButtonLabel)(e)}${e===q.table?', chosen':''}`,onPress:()=>pe({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,N.jsxs)(Y,{title:"Guest",testID:"edit-section-guest",children:[(0,N.jsx)(z.Field,{label:"Name",value:q.name,onChangeText:e=>pe({name:e}),testID:"edit-name"}),(0,N.jsx)(z.Field,{label:"Phone",value:q.phone,onChangeText:e=>pe({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,N.jsx)(z.Field,{label:"Email",value:q.email,onChangeText:e=>pe({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),we&&Te.marketingOptIn?(0,N.jsx)(z.Toggle,{label:Te.marketingWords,value:le,onChange:ae,testID:"edit-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,N.jsx)(z.T,{size:16,center:!0,children:"Booked by"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>pe({source:e.id})},e.id))}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(q.tags??[]).includes(e);return(0,N.jsx)(z.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>pe({tags:t?(q.tags??[]).filter(t=>t!==e):[...q.tags??[],e].sort()})},e)})})]}),(0,N.jsxs)(Y,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,N.jsx)(G,{label:"Dogs",value:q.dogs??0,max:6,onChange:e=>pe({dogs:e}),testID:"edit-dogs"}),(0,N.jsx)(G,{label:"High chairs",value:q.highChairs??0,max:10,onChange:e=>pe({highChairs:e}),testID:"edit-high-chairs"}),(0,N.jsx)(G,{label:"Wheelchair users",value:q.wheelchair??0,max:10,onChange:e=>pe({wheelchair:e}),testID:"edit-wheelchair"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"Occasion"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:(q.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>pe({occasion:e.id})},e.id||'none'))})]}),(0,N.jsxs)(Y,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No allergies",selected:!!q.allergyNone&&!Pe.length,testID:"edit-allergy-none",onPress:()=>pe({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,N.jsx)(z.Chip,{label:e.short,selected:Pe.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>Oe(e.id)},e.id))]}),Pe.map(e=>(0,N.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,N.jsxs)(z.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,N.jsx)(z.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>pe({allergies:Pe.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,N.jsx)(z.Field,{label:"Anything else about allergies",value:q.allergyNote,onChangeText:e=>pe({allergyNote:e}),testID:"edit-allergy-note"}),Ie.includes('allergies')&&Pe.length?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,N.jsx)(G,{label:"Vegan",value:q.vegan??0,max:q.partySize,onChange:e=>pe({vegan:e}),testID:"edit-vegan"}),(0,N.jsx)(G,{label:"Vegetarian",value:q.vegetarian??0,max:q.partySize,onChange:e=>pe({vegetarian:e}),testID:"edit-vegetarian"})]}),(q.holds??[]).length||(L.holds??[]).some(e=>e.qty>0&&!e.served)?(0,N.jsxs)(Y,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,N.jsx)(z.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(q.holds??[]).map(e=>{const t=(0,h.reservablesOf)(V),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),l=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,N.jsxs)(n.default,{testID:l,style:{gap:6,width:'100%'},children:[(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,N.jsx)(z.Stepper,{testID:l,value:e.qty,min:0,max:20,onChange:t=>pe({holds:(0,c.setEditableHoldQty)(q.holds??[],e.kind,e.id,t)}),label:i})]}),(0,N.jsx)(z.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${l}-remove`,onPress:()=>pe({holds:(0,c.removeEditableHold)(q.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(q.holds??[]).length?null:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==L.status?(0,N.jsxs)(Y,{title:"Status",testID:"edit-section-status",children:[(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>pe({status:e.id})},e.id))}),(0,N.jsx)(z.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,N.jsx)(Y,{title:"Notes",testID:"edit-section-notes",children:(0,N.jsx)(z.Field,{label:"Notes",value:q.notes,onChangeText:e=>pe({notes:e}),placeholder:Te.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),te?(0,N.jsxs)(n.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[te.map(e=>(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,ie?(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:ie}):null,Z?(0,N.jsxs)(n.default,{testID:"edit-discard-warn",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:j.colours.gold,backgroundColor:j.colours.surface2},children:[(0,N.jsx)(z.T,{size:20,weight:"bold",center:!0,children:"Discard unsaved changes?"}),(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.muted,children:"Your changes have not been saved."}),(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:"secondary",label:"Keep editing",testID:"edit-discard-keep",onPress:()=>ee(!1),style:{minHeight:52,flex:1}}),(0,N.jsx)(z.Button,{kind:"danger",label:"Discard changes",testID:"edit-discard-discard",onPress:()=>{ee(!1),m()},style:{minHeight:52,flex:1}})]})]}):null,We.length?(0,N.jsx)(Y,{title:"Changes",testID:"edit-history",children:We.slice(0,12).map((e,t)=>(0,N.jsx)(z.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,N.jsx)(W.CancelBookingButton,{rid:e,b:L,name:L.name,big:!0,onDone:()=>m()}),(0,N.jsx)(W.ReinstateBookingButton,{b:L,name:L.name,today:(0,D.ymd)(new Date),onDone:()=>m()})]})}},1119,[17,1031,85,858,996,993,860,856,1120,1053,1077,845,920,876,994,1090,804,863,1103,1121,815,1122,1104,1087,1099,1100,1101,1123,841,1115,777,840,8]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedDraftFields=W,_e.changedFields=j,_e.historyText=E,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=j(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:E(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${D(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!j(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return x}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: high chair, birthday, quiet table',o='This booking is on the website too. Saving here updates the website booking. The website may email the guest about a new date, time or status.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],u=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],h=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],k=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),w=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return w(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){return l.filter(i=>M(i,e)!==M(i,t))}function j(e,t){return W(y(e),t)}const A=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,D=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function E(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${A(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=k(o.holds),i=k(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${D(s)}`}const x=e=>e.map(e=>f[e]).join(', ')},1120,[1053,1098,1090,1094]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedDraftFields=W,_e.changedFields=j,_e.historyText=E,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=j(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:E(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${D(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!j(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return x}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: high chair, birthday, quiet table',o='This booking is on the website too. Saving here updates the website booking. The website may email the guest about a new date, time or status.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],u=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],h=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],k=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),w=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return w(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){return l.filter(i=>M(i,e)!==M(i,t))}function j(e,t){return W(y(e),t)}const A=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,D=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function E(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${A(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=k(o.holds),i=k(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${D(s)}`}const x=e=>e.map(e=>f[e]).join(', ')},1112,[1053,1098,1090,1094]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FinishConfirm=I,_e.RestoreSeatedConfirm=function({prompt:e,onYes:t,onNo:n}){return(0,k.jsxs)(s.default,{testID:"restore-seated-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:"Yes, seat them",testID:"restore-seated-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"restore-seated-no",onPress:n,style:w})]})},Object.defineProperty(_e,"finishBookingNow",{enumerable:!0,get:function(){return p.finishBookingNow}}),_e.undoFinishedNow=D,_e.restoreFinishedToTable=async function(e,t,s){const o=(0,b.tableKey)(s);await n.repo.bookings.update(t.id,{...(0,f.tablePatch)(o||null),status:'seated',finishedAt:void 0,lastTable:void 0}),o&&(0,p.resetTableLive)(e,o)},_e.offerFinishUndo=F,_e.finishAndOfferUndo=v,_e.finishUnseatedAndOfferUndo=N,_e.FinishButton=function({rid:e,b:s,name:n,allowed:o=!0,hint:c,small:b,bigToast:f,testID:u,label:h="Finished",a11y:p,kind:D="secondary"}){const[F,j]=t.default.useState(!1);if(!o)return null;const x=(0,l.finishConfirmPrompt)({name:n,table:s.table,seatedAt:s.seatedAt,now:new Date,seated:'seated'===s.status});if(F)return(0,k.jsx)(I,{prompt:x,onNo:()=>j(!1),onYes:()=>{j(!1),'seated'===s.status?v(e,[s],n,{big:f,table:s.table}):N(e,s,n,{big:f})}});return(0,k.jsx)(y.Button,{small:b,kind:D,label:h,testID:u,accessibilityLabel:p??`${h}: ${n}`,accessibilityHint:c,disabled:!o,onPress:()=>j(!0),style:b?void 0:w})};var t=e(r(d[0])),s=e(r(d[1])),n=r(d[2]),o=r(d[3]),l=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),u=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]);const w={minHeight:64};function I({prompt:e,onYes:t,onNo:n,yesLabel:o="Yes, finish"}){return(0,k.jsxs)(s.default,{testID:"finish-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:o,testID:"finish-confirm-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"finish-confirm-no",onPress:n,style:w})]})}async function D(e,t,s){const c=(0,l.tableForUndo)(t,s);await n.repo.bookings.update(t.id,(0,l.finishUndoPatch)(c)),c&&(0,o.tablesOf)(c).forEach(t=>o.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function F(e){const t=e.bookings[0];if(!t)return;const s=e.bookings.length>1?`${e.bookings.length} parties finished.`:`${e.name} finished.`,n=e.table?`${(0,c.tableWords)(e.table).replace(/^t/,'T')} needs clearing.`:void 0,o=`finish-undo-${t.id}`;(0,u.notify)({id:o,title:s,body:n,timeoutMs:l.FINISH_UNDO_MS,big:e.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{for(const t of e.bookings)await D(e.rid,{...t,table:void 0,lastTable:t.table||t.lastTable});(0,u.dismissNotice)(o)})()}}]})}async function v(e,t,s,n){const o=n?.table??t.find(e=>e.table)?.table;for(const s of t)await(0,p.finishBookingNow)(e,s);F({rid:e,bookings:t,name:s,table:o,big:n?.big})}async function N(e,t,s,o){await n.repo.bookings.setStatus(t.id,'finished');const c=`finish-undo-${t.id}`;(0,u.notify)({id:c,title:`${s} finished.`,timeoutMs:l.FINISH_UNDO_MS,big:o?.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{await n.repo.bookings.setStatus(t.id,t.walkIn?'cancelled':'confirmed'),(0,u.dismissNotice)(c)})()}}]})}},1113,[17,85,858,996,1111,1114,1094,1090,916,804,777,1096,8]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return s.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return c}}),e.freeTablesNow=function(t,a,s=!1){const l=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),n=l.filter(([,t])=>t.table.maxSeats>=a),o=t=>t.map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}));return s?[...o(n),...o(l.filter(([,t])=>t.table.maxSeatsh[t]&&(l.includes(h[t].status)||'dirty'===h[t].status||'blocked'===h[t].status));if(p.length&&p.every(t=>h[t])&&!t.length)f.push({id:'seat',label:`Seat at ${b(s.table).replace(/^t/,'T')}`,a11y:`Seat ${n}, ${u(s.partySize)}, at ${b(s.table)}`,table:s.table});else if(c(s,$)){const a=p.length?t.length?`${b(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===h[t[0]].status?'waiting to be cleared':'blocked'===h[t[0]].status?'blocked':'in use'}`:`${b(s.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';f.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${n}, ${u(s.partySize)}. ${a}.`,note:a})}c(s,$)&&f.push({id:'finished',label:'Finished',a11y:`Finished, ${n}, ${s.time} booking, without seating at a table`}),o($,s)<=0&&f.push({id:'noshow',label:'No-show',a11y:`No-show, ${n}, ${s.time} booking`})}return f.push({id:'details',label:'Guest details',a11y:`Guest details, ${n}`}),f};var t=r(d[0]),a=r(d[1]),s=r(d[2]);const l=['seated','mains','dessert','bill'],n=t=>new Date(`${t.date}T${t.time}:00`),o=(t,a)=>(n(a).getTime()-t.getTime())/6e4,b=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},u=t=>`${t} ${1===t?'person':'people'}`,c=(t,a)=>o(a,t)<=45},1114,[996,863,1074]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return x}}),_e.cancelWalkInWords=I,_e.reinstateWalkInWords=$,_e.cancelWalkInNow=j,_e.reinstateWalkInNow=C,_e.CancelWalkInButton=function({rid:e,b:t,onDone:o,small:c,big:u}){const[b,f]=(0,n.useState)(!1),k=(0,l.useInStaffApp)(),x=(0,s.useSeatClearFinish)();return p(t)?k&&!x.ok?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(w.Button,{kind:"secondary",small:c,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>f(!0),style:u?{minHeight:64}:c?{minHeight:44}:h}),b?(0,y.jsx)(W,{rid:e,b:t,onClose:()=>f(!1),onDone:o}):null]}):null},_e.CancelWalkInConfirm=W,_e.ReinstateWalkInButton=function({rid:e,b:t,today:o,onDone:u,small:b}){const[f,p]=(0,n.useState)(!1),I=(0,l.useInStaffApp)(),j=(0,s.useSeatClearFinish)();if(!x(t,o))return null;if(I&&!j.ok)return null;const W=$(t);if(!f)return(0,y.jsx)(w.Button,{kind:"ghost",small:b,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>p(!0),style:b?{minHeight:44}:h});return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:()=>p(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:W,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:W})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[h,{flexGrow:1}],onPress:async()=>{await C(e,t),p(!1),u?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>p(!1),style:h})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]),o=r(d[4]),c=(e=o)&&e.__esModule?e:{default:e},u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]),w=r(d[9]),y=r(d[10]);const h={minHeight:56},p=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),x=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function I(e){const t=(0,b.tablesOf)(e.table),n=(0,f.tablesWords)(t);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${t.length?` at ${n}`:''}, arrived ${e.time}? It comes off the Covers${t.length?` and ${n} ${t.length>1?'go':'goes'} back to Free`:''}.`}function $(e){return`Put walk-in ${e.ref} back to seated? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`}async function j(e,n){await u.repo.bookings.setStatus(n.id,'cancelled'),await u.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,b.tablesOf)(n.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function C(e,t){await u.repo.bookings.setStatus(t.id,'seated'),(0,b.tablesOf)(t.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function W({rid:e,b:t,onClose:n,onDone:l}){const s=I(t);return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:s,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:s})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[h,{flexGrow:1}],onPress:async()=>{await j(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,b.tablesOf)(t.table).length?` ${(0,f.tablesWords)((0,b.tablesOf)(t.table))} free.`:''}`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:h})]})]})}},1115,[1116,17,1055,1118,85,858,996,1094,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.cancelStamp=C,_e.cancelBookingNow=w,_e.reinstateBookingNow=$,_e.CancelBookingButton=function({rid:e,b:n,name:o,onDone:s,big:l,small:c}){const[u,f]=(0,t.useState)(!1);return(0,b.canCancelBooking)(n)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(x.Button,{kind:"secondary",small:c,label:"Cancel booking",testID:`cancel-booking-${n.id}`,accessibilityLabel:`Cancel booking for ${o}, ${n.time}, ${n.partySize} Covers`,onPress:()=>f(!0),style:l?{minHeight:64}:c?{minHeight:44}:j}),u?(0,h.jsx)(D,{rid:e,b:n,name:o,onClose:()=>f(!1),onDone:s}):null]}):null},_e.CancelBookingConfirm=D,_e.ReinstateBookingButton=function({b:e,name:n,today:s,onDone:l}){const[c,u]=(0,t.useState)(!1);if(!(0,b.canReinstateBooking)(e,s))return null;const y=(0,b.reinstateBookingWords)(e,n);if(!c)return(0,h.jsx)(x.Button,{kind:"ghost",label:"Undo cancel",testID:`reinstate-booking-${e.id}`,accessibilityLabel:`Undo cancel for ${n}`,onPress:()=>u(!0),style:j});return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:()=>u(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center'},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, put back to booked",testID:"reinstate-booking-yes",accessibilityLabel:`Yes, put ${n} back to booked`,style:[j,{flexGrow:1}],onPress:async()=>{await $(e),u(!1),l?.(`${n} put back to booked.`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-booking-no",onPress:()=>u(!1),style:j})]})]})};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]),c=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]),y=r(d[8]),k=r(d[9]),p=r(d[10]),x=r(d[11]),h=r(d[12]);const j={minHeight:56},B={display:'Display',owner:'Managers app',staff:'Staff app',chef:'Kitchen app',customer:'Customer page'};function C(e){const t=y.useSession.getState().meId,n=t?k.useOwner.getState().staff.find(e=>e.id===t):void 0,o=B[p.APP_VARIANT]??'CoverCharge';return{by:n?`${n.name.replace(' (example)','')} (${o})`:o,at:(new Date).toISOString(),app:o,...e.table?{table:e.table}:{}}}async function w(e,t){const n=(0,l.tablesOf)(t.table);await s.repo.bookings.update(t.id,{status:'cancelled',cancelled:C(t),...(0,c.tablePatch)(null)}),n.forEach(t=>l.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function $(e){await s.repo.bookings.setStatus(e.id,'confirmed')}function D({rid:e,b:t,name:n,onClose:s,onDone:c}){const y=(0,b.cancelBookingWords)(t,n),k=(0,l.tablesOf)(t.table);return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:s,title:"Cancel booking?",maxWidth:560,testID:"cancel-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center',gap:8},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, cancel booking",testID:"cancel-booking-yes",accessibilityLabel:`Yes, cancel booking for ${n}`,style:[j,{flexGrow:1}],onPress:async()=>{await w(e,t),s(),c?.(`${n} cancelled.${k.length?` ${(0,u.tablesWords)(k)} free.`:''}`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep booking",testID:"cancel-booking-no",accessibilityLabel:`Keep booking for ${n}`,onPress:s,style:j})]})]})}},1116,[17,85,858,996,1090,1117,1094,804,920,876,856,777,8]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canCancelBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canReinstateBooking",{enumerable:!0,get:function(){return t}}),e.cancelBookingWords=function(n,t){const o=`${n.partySize} Cover${1===n.partySize?'':'s'}`;return`Cancel booking for ${t}, ${n.time}, ${o}? The table is freed. Website bookings will cancel it on the website and may email the guest.`},e.reinstateBookingWords=function(n,t){return`Put ${t} back to booked for ${n.time}? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`},e.cancelledOnDay=o,e.cancelledDayTally=function(n,t){const a=o(n,t),l=a.filter(n=>!!n.walkIn),c=a.filter(n=>!n.walkIn);return{count:a.length,covers:a.reduce((n,t)=>n+t.partySize,0),bookings:c.length,bookingCovers:c.reduce((n,t)=>n+t.partySize,0),walkIns:l.length,walkInCovers:l.reduce((n,t)=>n+t.partySize,0),list:a}},e.cancelledTallyWords=function(n,t="today"){if(!n.count)return`No cancellations ${t}`;const o=[],a=n.bookings??0,l=n.walkIns??0;a&&o.push(`${a} booking${1===a?'':'s'} (${n.bookingCovers??0} Cover${1===(n.bookingCovers??0)?'':'s'})`);l&&o.push(`${l} walk-in${1===l?'':'s'} (${n.walkInCovers??0} Cover${1===(n.walkInCovers??0)?'':'s'})`);if(!o.length)return`Cancelled ${t}: ${n.count} \xb7 ${n.covers} Cover${1===n.covers?'':'s'}`;return`Cancelled ${t}: ${o.join(' \xb7 ')}`};const n=n=>!n.walkIn&&('confirmed'===n.status||'pending'===n.status||'seated'===n.status),t=(n,t)=>!n.walkIn&&'cancelled'===n.status&&n.date>=t;function o(n,t){return n.filter(n=>n.date===t&&'cancelled'===n.status).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name))}},1117,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSeatClearFinish=function(){const t=(0,A.useSignedIn)(),o=(0,A.useInStaffApp)(),_='staff'===s.APP_VARIANT||'chef'===s.APP_VARIANT||o,l=(0,c.canSeatClearFinish)({device:s.IS_CAR||'display'===s.APP_VARIANT||!_&&!t,viaDisplay:(0,n.isKitchenViaDisplay)(),role:t?.role,ownerAccess:t?.ownerAccess,managerAccess:t?.managerAccess});return{ok:l,hint:l?void 0:c.SEAT_CLEAR_HINT}};var s=r(d[0]),n=r(d[1]),c=r(d[2]),A=r(d[3])},1118,[856,922,1119,1055]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEAT_CLEAR_HINT",{enumerable:!0,get:function(){return n}}),e.canSeatClearFinish=function(n){return!(!n.device&&!n.viaDisplay)||('owner'===n.role||'manager'===n.role||!(!n.ownerAccess&&!n.managerAccess))};const n='Ask a manager to seat, finish or clear a table.'},1119,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:s,who:i,role:n,inStaffApp:l,shiftManager:a,big:o,testID:d}){const[h,u]=(0,t.useState)(!1),p=(0,b.useSession)(e=>e.meId),y=(0,m.useOwner)(e=>e.staff.find(e=>e.id===p&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:l,role:n,shiftManager:a})||p&&!(0,x.canChangeBookings)(y)?null:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:d??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),h?(0,N.jsx)(V,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:n,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,l.useBookings)(e).filter(e=>!e.walkIn&&e.date>=s&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,200);return o?(0,N.jsx)(V,{rid:e,id:o,who:i,hidePrivate:a,onClose:n}):(0,N.jsxs)(z.Sheet,{visible:!0,onClose:n,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,N.jsx)(z.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${L(e.date,s)} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${L(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,N.jsx)(z.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,N.jsx)(z.Button,{kind:"ghost",label:"Close",onPress:n,style:{minHeight:44}})]})},_e.EditBookingSheet=V;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=(e=i)&&e.__esModule?e:{default:e},l=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),f=_r(_d[19]),C=_r(_d[20]),I=_r(_d[21]),k=_r(_d[22]),w=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),O=_r(_d[28]),W=_r(_d[29]),z=_r(_d[30]),B=_r(_d[31]),N=_r(_d[32]);const E=/^([01]\d|2[0-3]):[0-5]\d$/,R=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const L=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,D.ymd)(s)?'Tomorrow':F(e)};const A=e=>e?(e/100).toFixed(e%100?2:0):'',M=e=>{const t=(0,B.parseMoneyInput)(e);return null!=t&&t>=0?Math.round(100*t):NaN},F=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',H=e=>{const t=e.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);return t?`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`:''},_=e=>e.charAt(0).toUpperCase()+e.slice(1);function Y({title:e,children:t,testID:s}){return(0,N.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,N.jsx)(z.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const G=({label:e,value:t,onChange:s,max:i=20,testID:n})=>(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:e}),(0,N.jsx)(z.Stepper,{testID:n,value:t,min:0,max:i,onChange:s,label:e})]});function V({rid:e,id:i,who:b,onClose:m,hidePrivate:x=!1}){(0,$.useBlurOutside)();const B=(0,l.useBookings)(e),L=B.find(e=>e.id===i),V=(0,d.useRestaurant)(e),K=(0,a.usePlan)(e),U=(0,o.useBlocks)(e=>e.blocks),[q,X]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Q,J]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Z,ee]=(0,t.useState)(!1),[te,se]=(0,t.useState)(null),[ie,ne]=(0,t.useState)(null),[le,ae]=(0,t.useState)(!1),[oe,de]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositDue:0)),[re,ce]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositAmount:0)),[he,ue]=(0,t.useState)(F(L?(0,c.draftOf)(L).depositDate:''));if(!L||!q||!V)return null;const pe=e=>{se(null),ne(null),X({...q,...e})},ge=(0,O.depositOf)(V.settings),be=e=>{const t=e.partySize??q.partySize,s=Math.min(e.children??q.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(L)&&q.depositOn&&!q.depositPaid&&M(oe||'0')===(0,O.depositDue)(ge,q.partySize,q.children??0)){const e=(0,O.depositDue)(ge,t,s);e>0&&de(A(e))}pe({...e,children:s})},me=(0,v.bookingSlotMinutesOf)(V),xe=R(q.time),ye=E.test(xe),je=q.area?K.areas.filter(e=>e.name===q.area).map(e=>e.id):null,De=e=>!je||e.split('+').every(e=>je.includes(K.tables.find(t=>t.name===e)?.areaId??'')),ve=(0,y.tableOptions)(K,B.filter(e=>e.date===q.date),q.table).filter(e=>De(e)||e===q.table),fe=!(q.depositOn&&(Number.isNaN(M(oe||'0'))||q.depositPaid&&(Number.isNaN(M(re||'0'))||he.trim()&&!H(he)))),Ce={...q,time:xe,depositDue:M(oe||'0')||0,depositAmount:M(re||'0')||0,depositDate:H(he)},Ie=(0,c.changedDraftFields)(Q??(0,c.draftOf)(L),Ce),ke=V.settings.turnMins??90,we=!!q?.email?.trim()&&q.email.trim()!==(L?.email??'').trim(),Te=(0,u.bookingRulesOf)(V),Se=async()=>{const t=(0,c.editPatch)(L,Ce,{by:b||'Team member',app:r.APP_VARIANT});if(le&&we&&Object.assign(t,(0,u.marketingChoice)(Ce.email,!0)),Object.keys(t).length&&await l.repo.bookings.update(L.id,t),'seated'===L.status&&'table'in t&&t.table!==L.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(L.table),n=s(t.table),l=a.useFloor.getState(),o=i.map(t=>l.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!n.includes(e)).forEach(t=>l.setLive(e,t,{stage:void 0,dirty:!0})),n.forEach(t=>l.setLive(e,t,{stage:o,dirty:!1}))}ne(`Saved. Changed: ${(0,c.editedWords)(Ie)}.`),se(null),m()},$e=()=>{const t=ye?(0,o.blockAt)(U,e,q.date,xe):void 0,s=(0,c.editWarnings)(L,Ce,B,t,ke,K);!s.length||te?Se():se(s)},Pe=q.allergies??[],Oe=e=>pe({allergyNone:!1,allergies:Pe.some(t=>t.allergen===e)?Pe.filter(t=>t.allergen!==e):[...Pe,{allergen:e,severity:'allergy'}]}),We=(0,c.historyLines)(L);return(0,N.jsxs)(z.Sheet,{visible:!0,onClose:()=>{Ie.length?ee(!0):(ee(!1),m())},title:`Edit booking \xb7 ${L.name} \xb7 ${L.ref}`,maxWidth:760,testID:"edit-booking-sheet",onTypingDone:()=>{(0,C.hideKeyboard)(),Ie.length&&ye&&fe&&q.name.trim().length>=1&&$e()},typingDoneLabel:Ie.length?'Done, save changes':'Done, hide the keyboard',footer:(0,N.jsx)(z.Button,{label:te?'Save anyway':'Save changes',testID:"edit-save",disabled:!ye||!fe||q.name.trim().length<1||!Ie.length,onPress:$e,style:{minHeight:56,width:'100%'}}),children:[(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(w.DepositChip,{b:L,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(L)?(0,N.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,N.jsxs)(Y,{title:"Deposit",testID:"edit-section-deposit",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No deposit",selected:!q.depositOn,testID:"edit-deposit-none",onPress:()=>pe({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit due",selected:!!q.depositOn&&!q.depositPaid&&!q.depositWaived,testID:"edit-deposit-due",onPress:()=>pe({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit paid",selected:!!q.depositOn&&!!q.depositPaid,testID:"edit-deposit-paid",onPress:()=>{re||ce(oe),he||ue(F((0,D.ymd)(new Date))),pe({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsx)(z.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsxs)(z.T,{size:15,center:!0,colour:j.colours.goldLight,testID:"edit-deposit-waived-by",children:[L.depositWaived?.by?(0,O.waiverText)(L.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,q.depositWaived||Ie.includes('deposit')?null:(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(P.WaiveDepositButton,{b:L,who:b,onDone:e=>{const t={...q,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e};X(t),J(s=>s?{...s,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e}:t)}})}),q.depositOn?(0,N.jsx)(z.Field,{money:!0,label:"Deposit due (\xa3)",value:oe,onChangeText:e=>{de(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,q.depositOn&&q.depositPaid?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Field,{money:!0,label:"Amount paid (\xa3)",value:re,onChangeText:e=>{ce(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"How was it paid?"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,N.jsx)(z.Chip,{label:_(e),selected:q.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>pe({depositMethod:e})},e))}),(0,N.jsx)(z.Field,{label:"Date paid (DD/MM/YYYY)",value:he,onChangeText:e=>{ue((0,s.slashDate)(e,he)),pe({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),he.trim()&&!H(he)?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,fe?null:(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,N.jsx)(z.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,N.jsxs)(Y,{title:"When",testID:"edit-section-when",children:[(0,N.jsx)(k.BookingDatePicker,{r:V,today:new Date,value:q.date,onChange:e=>pe({date:e})}),(0,N.jsx)(I.TimeRoller,{testID:"edit-time",value:(0,f.snapTime)(q.time,me),onChange:e=>pe({time:e}),step:me}),ye?null:(0,N.jsx)(z.T,{size:15,colour:j.colours.amber,center:!0,children:"Choose a time on the roller."}),(0,N.jsx)(T.AdultsChildren,{value:(0,S.peopleOf)(q.partySize,q.children),onChange:e=>be(e),depositsOn:ge.on&&ge.perPersonPence>0,testID:"edit-people"}),(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:"Table time"}),(0,N.jsx)(z.Stepper,{testID:"edit-duration",value:q.duration||0,min:0,max:360,step:15,onChange:e=>pe({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,N.jsxs)(Y,{title:"Where",testID:"edit-section-where",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"Any area",selected:!q.area,testID:"edit-area-any",onPress:()=>pe({area:''})}),K.areas.map(e=>(0,N.jsx)(z.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:q.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>pe({area:e.name})},e.id))]}),(0,N.jsx)(z.T,{size:18,weight:"semibold",center:!0,children:(0,y.tableButtonLabel)(q.table)}),(0,y.splitChoices)(q.table).length?(0,N.jsxs)(n.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:"Split the joined tables"}),(0,N.jsx)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,y.splitChoices)(q.table).map(e=>(0,N.jsx)(z.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>pe({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:q.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(q.table?'':', chosen'),onPress:()=>pe({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),ve.map(e=>(0,N.jsx)(z.Button,{kind:e===q.table?'primary':'secondary',label:(0,y.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,y.tableButtonLabel)(e)}${e===q.table?', chosen':''}`,onPress:()=>pe({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,N.jsxs)(Y,{title:"Guest",testID:"edit-section-guest",children:[(0,N.jsx)(z.Field,{label:"Name",value:q.name,onChangeText:e=>pe({name:e}),testID:"edit-name"}),(0,N.jsx)(z.Field,{label:"Phone",value:q.phone,onChangeText:e=>pe({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,N.jsx)(z.Field,{label:"Email",value:q.email,onChangeText:e=>pe({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),we&&Te.marketingOptIn?(0,N.jsx)(z.Toggle,{label:Te.marketingWords,value:le,onChange:ae,testID:"edit-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,N.jsx)(z.T,{size:16,center:!0,children:"Booked by"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>pe({source:e.id})},e.id))}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(q.tags??[]).includes(e);return(0,N.jsx)(z.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>pe({tags:t?(q.tags??[]).filter(t=>t!==e):[...q.tags??[],e].sort()})},e)})})]}),(0,N.jsxs)(Y,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,N.jsx)(G,{label:"Dogs",value:q.dogs??0,max:6,onChange:e=>pe({dogs:e}),testID:"edit-dogs"}),(0,N.jsx)(G,{label:"High chairs",value:q.highChairs??0,max:10,onChange:e=>pe({highChairs:e}),testID:"edit-high-chairs"}),(0,N.jsx)(G,{label:"Wheelchair users",value:q.wheelchair??0,max:10,onChange:e=>pe({wheelchair:e}),testID:"edit-wheelchair"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"Occasion"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:(q.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>pe({occasion:e.id})},e.id||'none'))})]}),(0,N.jsxs)(Y,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No allergies",selected:!!q.allergyNone&&!Pe.length,testID:"edit-allergy-none",onPress:()=>pe({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,N.jsx)(z.Chip,{label:e.short,selected:Pe.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>Oe(e.id)},e.id))]}),Pe.map(e=>(0,N.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,N.jsxs)(z.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,N.jsx)(z.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>pe({allergies:Pe.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,N.jsx)(z.Field,{label:"Anything else about allergies",value:q.allergyNote,onChangeText:e=>pe({allergyNote:e}),testID:"edit-allergy-note"}),Ie.includes('allergies')&&Pe.length?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,N.jsx)(G,{label:"Vegan",value:q.vegan??0,max:q.partySize,onChange:e=>pe({vegan:e}),testID:"edit-vegan"}),(0,N.jsx)(G,{label:"Vegetarian",value:q.vegetarian??0,max:q.partySize,onChange:e=>pe({vegetarian:e}),testID:"edit-vegetarian"})]}),(q.holds??[]).length||(L.holds??[]).some(e=>e.qty>0&&!e.served)?(0,N.jsxs)(Y,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,N.jsx)(z.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(q.holds??[]).map(e=>{const t=(0,h.reservablesOf)(V),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),l=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,N.jsxs)(n.default,{testID:l,style:{gap:6,width:'100%'},children:[(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,N.jsx)(z.Stepper,{testID:l,value:e.qty,min:0,max:20,onChange:t=>pe({holds:(0,c.setEditableHoldQty)(q.holds??[],e.kind,e.id,t)}),label:i})]}),(0,N.jsx)(z.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${l}-remove`,onPress:()=>pe({holds:(0,c.removeEditableHold)(q.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(q.holds??[]).length?null:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==L.status?(0,N.jsxs)(Y,{title:"Status",testID:"edit-section-status",children:[(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>pe({status:e.id})},e.id))}),(0,N.jsx)(z.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,N.jsx)(Y,{title:"Notes",testID:"edit-section-notes",children:(0,N.jsx)(z.Field,{label:"Notes",value:q.notes,onChangeText:e=>pe({notes:e}),placeholder:Te.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),te?(0,N.jsxs)(n.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[te.map(e=>(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,ie?(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:ie}):null,Z?(0,N.jsxs)(n.default,{testID:"edit-discard-warn",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:j.colours.gold,backgroundColor:j.colours.surface2},children:[(0,N.jsx)(z.T,{size:20,weight:"bold",center:!0,children:"Discard unsaved changes?"}),(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.muted,children:"Your changes have not been saved."}),(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:"secondary",label:"Keep editing",testID:"edit-discard-keep",onPress:()=>ee(!1),style:{minHeight:52,flex:1}}),(0,N.jsx)(z.Button,{kind:"danger",label:"Discard changes",testID:"edit-discard-discard",onPress:()=>{ee(!1),m()},style:{minHeight:52,flex:1}})]})]}):null,We.length?(0,N.jsx)(Y,{title:"Changes",testID:"edit-history",children:We.slice(0,12).map((e,t)=>(0,N.jsx)(z.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,N.jsx)(W.CancelBookingButton,{rid:e,b:L,name:L.name,big:!0,onDone:()=>m()}),(0,N.jsx)(W.ReinstateBookingButton,{b:L,name:L.name,today:(0,D.ymd)(new Date),onDone:()=>m()})]})}},1120,[17,1031,85,858,996,993,860,856,1112,1053,1077,845,920,876,994,1090,804,863,1103,1121,815,1122,1104,1087,1099,1100,1101,1123,841,1116,777,840,8]); __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.hmToMins=n,e.minsToHm=o,e.snapTime=u,e.hourValues=function(){return Array.from({length:24},(t,n)=>n)},e.minuteValues=function(t){const n=t>0&&t<=60&&60%t==0?t:15,o=[];for(let t=0;t<60;t+=n)o.push(t);return o},e.splitHm=function(o){const i=n(t.test(o)?o:u(o,15));return Number.isFinite(i)?{hour:Math.floor(i/60),minute:i%60}:{hour:12,minute:0}},e.joinHm=function(t,n){const o=(n%60+60)%60;return`${String((t%24+24)%24).padStart(2,'0')}:${String(o).padStart(2,'0')}`},e.timeRollerHint=function(t){return`24-hour. Times are every ${t>0?t:15} minutes. Roll or swipe each wheel. No typing.`};const t=/^([01]\d|2[0-3]):[0-5]\d$/;function n(t){const n=t.trim().match(/^(\d{1,2}):(\d{2})$/);if(!n)return NaN;const o=Number(n[1]),u=Number(n[2]);return o>23||u>59?NaN:60*o+u}function o(t){const n=(Math.round(t)%1440+1440)%1440,o=Math.floor(n/60),u=n%60;return`${String(o).padStart(2,'0')}:${String(u).padStart(2,'0')}`}function u(t,u){const i=u>0&&u<=60&&60%u==0?u:15,s=n(t),c=Number.isFinite(s)?s:720;return o(Math.round(c/i)*i)}},1121,[]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TimeRoller=function({value:e,onChange:t,step:n=15,testID:u="time-roller"}){const{hour:h,minute:m}=(0,s.splitHm)(e),f=(0,s.hourValues)(),x=(0,s.minuteValues)(n),p=f.indexOf(h),y=x.reduce((e,t)=>Math.abs(t-m)t((0,s.joinHm)(f[e],y)),label:"Hours",format:e=>String(e).padStart(2,'0'),testID:`${u}-hours`}),(0,c.jsx)(b,{values:x,index:j<0?0:j,onChange:e=>t((0,s.joinHm)(h,x[e])),label:"Minutes",format:e=>String(e).padStart(2,'0'),testID:`${u}-minutes`})]})]}),(0,c.jsx)(l.T,{size:13,center:!0,colour:o.colours.muted,children:(0,s.timeRollerHint)(n)})]})};var t=r(_d[0]),n=e(r(_d[1])),i=e(r(_d[2])),o=r(_d[3]),s=r(_d[4]),l=r(_d[5]),c=r(_d[6]);const d=48,u=5,h=2;function m(e,t){return(e%t+t)%t}function b({values:e,index:s,onChange:b,label:f,format:x,testID:p}){const y=(0,t.useRef)(null),j=(0,t.useRef)(0),v=e.length,w=e[m(s,v)],R=`${x(w)} ${f.toLowerCase()}`,S=e=>b(m(s+e,v)),T=()=>{y.current=null,j.current=0};return(0,c.jsx)(i.default,{testID:p,accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:f,accessibilityValue:{min:e[0],max:e[v-1],now:w,text:R},accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{'increment'===e.nativeEvent.actionName&&S(1),'decrement'===e.nativeEvent.actionName&&S(-1)},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{y.current=e.nativeEvent.pageY,j.current=0},onResponderMove:e=>{if(null==y.current)return;const t=e.nativeEvent.pageY-y.current;for(y.current=e.nativeEvent.pageY,j.current+=t;j.current<=-24;)S(1),j.current+=d;for(;j.current>=24;)S(-1),j.current-=d},onResponderRelease:T,onResponderTerminate:T,style:{width:120,height:240,alignItems:'center'},children:Array.from({length:u},(t,i)=>{const u=i-h,b=e[m(s+u,v)],f=0===u,p=2===Math.abs(u);return(0,c.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",onPress:()=>{u&&S(u)},style:{height:d,width:'100%',alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:f?28:p?18:22,weight:f?'bold':'medium',colour:f?o.colours.goldLight:o.colours.muted,center:!0,style:{opacity:f?1:p?.35:.7},children:x(b)})},`${i}-${b}`)})})}},1122,[17,385,85,804,1121,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1123,[17,85,858,856,1120,841,1095,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1123,[17,85,858,856,1112,841,1095,804,777,8]); __d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingHistory=function({rid:e,today:t}){const[b,k]=(0,s.useState)((0,n.addDaysIso)(t,-1)),[w,v]=(0,s.useState)('day'),[p,f]=(0,s.useState)((0,n.ddmmyyyy)((0,n.addDaysIso)(t,-1))),[D,$]=(0,s.useState)(!1),[_,I]=(0,s.useState)(0),T=(0,n.historyRange)(w,b,t),C=(0,c.useKitchenHistory)(e,T.from,T.to,t,_),P=(0,d.parseHistoryInput)(p),B=!!P&&(0,d.validPastDate)(P,t),L=e=>{(0,d.validPastDate)(e,t)&&(k(e),f((0,n.ddmmyyyy)(e)))};if(!C.allowed)return(0,h.jsx)(l.Card,{children:(0,h.jsx)(l.T,{size:20,center:!0,children:"Booking history is for the Head Chef and managers. Sign in to the Head Chef app to see it."})});const z='day'===w?1:7,S=(0,n.addDaysIso)('day'===w?b:(0,n.mondayOf)(b),-z),R='day'===w?(0,n.addDaysIso)(b,1):(0,n.addDaysIso)((0,n.mondayOf)(b),7),W='day'===w?'day':'week';return(0,h.jsxs)(o.default,{style:{gap:14},testID:"booking-history",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:12,alignItems:'stretch'},children:[(0,h.jsx)(l.T,{size:18,center:!0,children:"Bookings, covers and walk-ins on past days. Read-only; nothing is changed."}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:'day'===w?'primary':'secondary',testID:"bh-mode-day",label:"One day",accessibilityLabel:"Show one day"+('day'===w?', selected':''),onPress:()=>v('day')}),(0,h.jsx)(l.Button,{kind:'week'===w?'primary':'secondary',testID:"bh-mode-week",label:"Whole week",accessibilityLabel:"Show the whole week, Monday to Sunday"+('week'===w?', selected':''),onPress:()=>v('week')})]}),(0,h.jsx)(l.Field,{label:"Past date (DD/MM/YYYY)",value:p,onChangeText:e=>f((0,i.slashDate)(e,p)),placeholder:"09/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Past date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"bh-date",style:{textAlign:'center'}}),B?null:(0,h.jsx)(l.T,{size:16,center:!0,testID:"bh-date-hint",children:"Enter a past date as DD/MM/YYYY, for example 09/11/2026."}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:"secondary",label:"Pick a date",testID:"bh-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${u(b)}`,onPress:()=>$(!0)}),(0,h.jsx)(l.Button,{label:"Show",testID:"bh-show",accessibilityLabel:`Show booking history for ${B&&P?u(P):'a valid past date'}`,disabled:!B,onPress:()=>{P&&L(P),I(_+1)}})]}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:"secondary",testID:"bh-prev",label:`Previous ${W}`,accessibilityLabel:`Previous ${W}, ${u(S)}`,onPress:()=>L(S)}),(0,h.jsx)(l.Button,{kind:"secondary",testID:"bh-next",label:`Next ${W}`,accessibilityLabel:(0,d.validPastDate)(R,t)?`Next ${W}, ${u(R)}`:`Next ${W}, not available. Booking history is for past days only`,disabled:!(0,d.validPastDate)(R,t),onPress:()=>L(R)})]}),'day'===w?(0,h.jsx)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:(0,h.jsx)(l.Button,{small:!0,kind:"secondary",testID:"bh-prev-week",label:"Same day last week",accessibilityLabel:`Same day last week, ${u((0,n.addDaysIso)(b,-7))}`,onPress:()=>L((0,n.addDaysIso)(b,-7))})}):null]})}),(0,h.jsx)(y.LookBackCalendar,{visible:D,today:t,selected:b,purpose:"Booking history",idPrefix:"bh",onClose:()=>$(!1),onPick:e=>{L(e),$(!1)}}),C.data?'day'===w?C.data.days[0]?(0,h.jsx)(x,{d:C.data.days[0]}):null:(0,h.jsx)(j,{days:C.data.days,onDay:e=>{L(e),v('day')}}):(0,h.jsx)(l.Card,{children:(0,h.jsx)(o.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(l.T,{size:20,center:!0,testID:"bh-status",children:C.error||'Loading booking history\u2026'})})})]})};var e,s=r(_d[0]),t=r(_d[1]),o=(e=t)&&e.__esModule?e:{default:e},l=r(_d[2]),i=r(_d[3]),d=r(_d[4]),n=r(_d[5]),c=r(_d[6]),y=r(_d[7]),b=r(_d[8]),h=r(_d[9]);const u=e=>`${(0,n.dayName)(e)} ${(0,n.ddmmyyyy)(e)}`,k=({label:e,value:s,id:t})=>(0,h.jsxs)(o.default,{testID:`bh-stat-${t}`,accessible:!0,accessibilityLabel:`${e}: ${s}`,style:{alignItems:'center',minWidth:96,padding:8,borderRadius:12,borderWidth:1,borderColor:b.colours.border},children:[(0,h.jsx)(l.T,{size:28,weight:"bold",colour:b.colours.gold,center:!0,children:String(s)}),(0,h.jsx)(l.T,{size:16,center:!0,children:e})]});function x({d:e}){return(0,h.jsxs)(o.default,{style:{gap:12},testID:"bh-day",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:10,alignItems:'center'},accessible:!0,accessibilityLabel:(0,n.dayText)(e)+`. Done: ${e.done_covers+e.walk_in_covers} covers.`,children:[(0,h.jsx)(l.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:u(e.date)}),(0,h.jsx)(o.default,{testID:"bh-stats",style:{alignSelf:'stretch'},children:(0,h.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(k,{id:"bookings",label:"Bookings",value:e.bookings}),(0,h.jsx)(k,{id:"booked",label:"Booked covers",value:e.booked_covers}),(0,h.jsx)(k,{id:"walkins",label:"Walk-ins",value:e.walk_ins}),(0,h.jsx)(k,{id:"walkin-covers",label:"Walk-in covers",value:e.walk_in_covers}),(0,h.jsx)(k,{id:"done",label:"Done",value:e.done_covers+e.walk_in_covers}),(0,h.jsx)(k,{id:"total",label:"Total",value:e.total_covers})]})}),e.not_counted?(0,h.jsxs)(l.T,{size:16,center:!0,children:[e.not_counted," cancelled or no-show ",1===e.not_counted?'booking is':'bookings are'," listed but not counted."]}):null,e.old_records?(0,h.jsx)(l.T,{size:16,center:!0,colour:b.colours.muted,children:"Includes records from the previous booking system, which may be incomplete."}):null]})}),(e.lines??[]).length||e.walk_ins?null:(0,h.jsx)(l.Card,{children:(0,h.jsx)(l.T,{size:18,center:!0,children:"No bookings or walk-ins recorded for this day."})}),(e.lines??[]).map((e,s)=>(0,h.jsx)(o.default,{testID:"bh-line",accessible:!0,accessibilityLabel:(0,n.lineText)(e),style:{padding:10,borderRadius:12,borderWidth:1,borderColor:b.colours.border,alignItems:'center',opacity:e.counted?1:.7},children:(0,h.jsxs)(l.Row,{wrap:!0,gap:14,style:{justifyContent:'center'},children:[(0,h.jsx)(l.T,{size:20,weight:"bold",colour:b.colours.gold,children:e.time??'No time'}),(0,h.jsx)(l.T,{size:18,children:null==e.covers?'Covers not recorded':`${e.covers} ${1===e.covers?'cover':'covers'}`}),(0,h.jsx)(l.T,{size:18,children:e.table?`Table ${e.table}`:'No table'}),(0,h.jsx)(l.T,{size:18,children:(0,n.statusWord)(e.status)})]})},s))]})}function j({days:e,onDay:s}){const t=(0,n.sumDays)(e);return(0,h.jsxs)(o.default,{style:{gap:12},testID:"bh-week",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:10,alignItems:'center'},accessible:!0,accessibilityLabel:`Week ${(0,n.ddmmyyyy)(e[0].date)} to ${(0,n.ddmmyyyy)(e[e.length-1].date)}: ${t.bookings} bookings, ${t.booked_covers} booked covers, ${t.walk_ins} walk-ins with ${t.walk_in_covers} covers, ${t.total_covers} covers in total`,children:[(0,h.jsxs)(l.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:["Week ",(0,n.ddmmyyyy)(e[0].date)," to ",(0,n.ddmmyyyy)(e[e.length-1].date)]}),(0,h.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(k,{id:"week-bookings",label:"Bookings",value:t.bookings}),(0,h.jsx)(k,{id:"week-walkins",label:"Walk-ins",value:t.walk_ins}),(0,h.jsx)(k,{id:"week-total",label:"Total",value:t.total_covers})]})]})}),e.map(e=>(0,h.jsx)(l.Button,{kind:"secondary",testID:`bh-week-day-${e.date}`,label:`${(0,n.day3)(e.date)} ${(0,n.ddmmyyyy)(e.date)} \xb7 ${e.bookings} booked (${e.booked_covers}) \xb7 ${e.walk_ins} walk-in (${e.walk_in_covers}) \xb7 Total ${e.total_covers}`,accessibilityLabel:`${(0,n.dayText)(e)}. Double tap to see this day's bookings.`,onPress:()=>s(e.date)},e.date))]})}},1124,[17,85,777,1031,1062,1125,1061,1048,804,8]); __d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"addDaysIso",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ddmmyyyy",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"day3",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"dayName",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"mondayOf",{enumerable:!0,get:function(){return l}}),e.historyRange=function(o,t,s){if('day'===o)return{from:t,to:t};const a=l(t),c=n(a,6),d=n(s,-1);return{from:a,to:c({bookings:o.bookings+t.bookings,booked_covers:o.booked_covers+t.booked_covers,walk_ins:o.walk_ins+t.walk_ins,walk_in_covers:o.walk_in_covers+t.walk_in_covers,total_covers:o.total_covers+t.total_covers}),{bookings:0,booked_covers:0,walk_ins:0,walk_in_covers:0,total_covers:0})};const o=o=>o.toISOString().slice(0,10),t=o=>new Date(o+'T12:00:00Z'),n=(n,s)=>{const a=t(n);return a.setUTCDate(a.getUTCDate()+s),o(a)},s=o=>`${o.slice(8,10)}/${o.slice(5,7)}/${o.slice(0,4)}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],c=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=o=>a[t(o).getUTCDay()],u=o=>c[t(o).getUTCDay()],l=o=>n(o,-(t(o).getUTCDay()+6)%7);function b(o){switch((o??'').toLowerCase()){case'finished':case'seated':return'Done';case'confirmed':case'booked':case'amended':return'Booked';case'cancelled':return'Cancelled';case'noshow':return'No-show';default:return o||'Not recorded'}}const y=(o,t,n)=>`${o} ${1===o?t:n}`},1125,[]); __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TempUnitsSetup=function(){const e=(0,f.useSync)(e=>e.mode),s='live'===e||'offline'===e||'connecting'===e,o=(0,c.useSafety)(e=>e.points),b=(0,d.useOwner)(e=>e.site),[k,j]=(0,t.useState)(()=>(0,u.draftsFrom)(c.useSafety.getState().points)),[$,S]=(0,t.useState)(null),[I,w]=(0,t.useState)(!1),[T,D]=(0,t.useState)(''),[C,L]=(0,t.useState)(1),B=(0,t.useMemo)(()=>(0,u.changesOf)(k,o),[k,o]),z=e=>(0,h.chefCanSee)(b,e),A=Object.fromEntries(k.map(e=>[e.key,(0,u.problemOf)(e,k,z)])),P=Object.values(A).some(Boolean),R=e=>{j(t=>t.map(t=>t.key===e.key?e:t)),D(''),w(!1)},_=k.filter(e=>!e.archived),O=k.filter(e=>e.archived&&e.id),F=_.filter(e=>'fridge'===e.kind).length,H=_.length-F,M=e=>{const t=`new${C}`;L(C+1),D(''),w(!1),j(s=>[...s,{key:t,name:'',kind:e,location:'',max:String(u.DEFAULT_MAX[e]),due:'09:00, 16:00',archived:!1}])},W=P?'Fix the unit marked in red first.':B.length?`${B.length} change${1===B.length?'':'s'} not saved yet.`:'No changes yet.';return(0,x.jsxs)(n.default,{testID:"tu-setup",style:{gap:12,alignSelf:'center',width:'100%',maxWidth:560,alignItems:'stretch'},children:[(0,x.jsx)(l.T,{weight:"semibold",size:18,center:!0,accessibilityRole:"header",children:"Temperature units"}),(0,x.jsx)(l.T,{testID:"tu-count",size:15,center:!0,children:`${F} fridge${1===F?'':'s'} and ${H} freezer${1===H?'':'s'} checked`}),(0,x.jsx)(p.TempSaveBanner,{testID:"tu-save-banner"}),(0,x.jsx)(l.Banner,{kind:"info",title:s?'Shared with every device':'Not connected yet',children:s?'These units and their readings are on the shared food safety log, so every phone, tablet and screen at the venue shows the same units.':'These units are saved on this device until it connects. Then they are shared with every device at the venue.'}),_.map(e=>(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsx)(v,{d:e,problem:A[e.key],onChange:R,onArchive:()=>e.id?S(e.key):j(t=>t.filter(t=>t.key!==e.key))}),$===e.key?(0,x.jsxs)(n.default,{testID:"tu-archive-ask",style:{gap:8,padding:12,borderRadius:12,backgroundColor:y.colours.amberBg,alignItems:'center'},children:[(0,x.jsx)(l.T,{size:15,center:!0,children:`Archive ${e.name.trim()||'this unit'}? It will no longer be checked. Its past readings stay in History and the EHO report. Nothing is deleted.`}),(0,x.jsxs)(l.Row,{gap:8,children:[(0,x.jsx)(l.Button,{small:!0,testID:"tu-archive-confirm",label:"Archive",accessibilityLabel:`Yes, archive ${e.name}`,onPress:()=>{R({...e,archived:!0}),S(null)}}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-archive-cancel",label:"Keep it",accessibilityLabel:`No, keep ${e.name}`,onPress:()=>S(null)})]})]}):null]},e.key)),(0,x.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-add-fridge",label:"Add a fridge",onPress:()=>M('fridge')}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-add-freezer",label:"Add a freezer",onPress:()=>M('freezer')})]}),O.length?(0,x.jsxs)(n.default,{testID:"tu-archived",style:{gap:6,alignItems:'center'},children:[(0,x.jsx)(l.T,{weight:"medium",center:!0,children:"Archived (not checked, history kept)"}),O.map(e=>(0,x.jsxs)(l.Row,{gap:8,style:{justifyContent:'center'},children:[(0,x.jsx)(l.T,{size:14,center:!0,children:e.name}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:`tu-restore-${e.key}`,label:"Bring back",accessibilityLabel:`Bring back ${e.name}`,onPress:()=>R({...e,archived:!1,due:e.due||'09:00, 16:00'})})]},e.key))]}):null,I?(0,x.jsxs)(n.default,{testID:"tu-save-ask",style:{gap:8,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold,alignItems:'center'},children:[(0,x.jsx)(l.T,{weight:"medium",center:!0,children:`Save ${B.length} change${1===B.length?'':'s'}?`}),B.map(e=>(0,x.jsx)(l.T,{size:14,center:!0,children:e.text},e.key)),(0,x.jsxs)(l.Row,{gap:8,children:[(0,x.jsx)(l.Button,{small:!0,testID:"tu-save-confirm",label:"Save",accessibilityLabel:"Yes, save the changes",onPress:()=>{const e=c.useSafety.getState(),t=new Set(e.points.map(e=>e.id));for(const t of B)t.add?e.addPoint(t.add):t.id&&t.patch&&e.setPoint(t.id,t.patch);j((0,u.draftsFrom)(c.useSafety.getState().points)),w(!1);const n=[...B.filter(e=>e.id).map(e=>e.id),...c.useSafety.getState().points.filter(e=>!t.has(e.id)).map(e=>e.id)],l=`Saved ${B.length} change${1===B.length?'':'s'}.`;D(s?`${l} Sending to every device\u2026`:`${l} (on this device until it connects).`),s&&(0,p.reportTempSave)('temp_units',n,l,D)}}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-save-cancel",label:"Back",accessibilityLabel:"Go back without saving",onPress:()=>w(!1)})]})]}):null,(0,x.jsx)(l.Button,{testID:"tu-save",label:"Save changes",disabled:!B.length||P,accessibilityHint:W,onPress:()=>w(!0),style:{alignSelf:'center',minWidth:200}}),T?(0,x.jsx)(l.T,{testID:"tu-saved",size:15,colour:y.colours.ok,center:!0,accessibilityRole:"text",children:T}):(0,x.jsx)(l.Muted,{style:{textAlign:'center'},children:W})]})};var e,t=r(_d[0]),s=r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),h=r(_d[6]),u=r(_d[7]),y=r(_d[8]),p=r(_d[9]),f=r(_d[10]),x=r(_d[11]);const b=['Downstairs','Upstairs'],k={fridge:'Fridge',freezer:'Freezer'};function v({d:e,problem:t,onChange:s,onArchive:c}){const d=e.name.trim()||'new unit';return(0,x.jsxs)(n.default,{testID:`tu-unit-${e.key}`,style:{gap:8,padding:12,borderRadius:12,borderWidth:1,borderColor:t?y.colours.red:y.colours.border,alignSelf:'stretch'},children:[(0,x.jsx)(o.TextInput,{testID:`tu-name-${e.key}`,accessibilityLabel:`Name of ${d}`,value:e.name,onChangeText:t=>s({...e,name:t}),placeholder:"e.g. Upstairs fridge 5",placeholderTextColor:"#7D776C",style:[l.styles.input,{alignSelf:'stretch',width:'100%'}]}),(0,x.jsxs)(l.Row,{wrap:!0,gap:6,children:[['fridge','freezer'].map(t=>(0,x.jsx)(l.Chip,{testID:`tu-kind-${e.key}-${t}`,label:k[t],selected:e.kind===t,accessibilityLabel:`${d}: ${k[t]}${e.kind===t?', selected':''}`,onPress:()=>s((0,u.withKind)(e,t))},t)),b.map(t=>(0,x.jsx)(l.Chip,{testID:`tu-loc-${e.key}-${t.toLowerCase()}`,label:t,selected:e.location.trim().toLowerCase()===t.toLowerCase(),accessibilityLabel:`${d}: location ${t}`,onPress:()=>s({...e,location:t})},t))]}),(0,x.jsxs)(l.Row,{wrap:!0,gap:8,children:[(0,x.jsx)(o.TextInput,{testID:`tu-loc-${e.key}`,accessibilityLabel:`Location of ${d}`,value:e.location,onChangeText:t=>s({...e,location:t}),placeholder:"Location",placeholderTextColor:"#7D776C",style:[l.styles.input,{flexGrow:1,flexBasis:120,minWidth:0,width:40}]}),(0,x.jsxs)(l.Row,{gap:6,style:{flexWrap:'nowrap'},children:[(0,x.jsx)(o.TextInput,{testID:`tu-max-${e.key}`,accessibilityLabel:`Safe limit for ${d}, degrees or colder`,value:e.max,onChangeText:t=>s({...e,max:t}),placeholder:String(u.DEFAULT_MAX[e.kind]),placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[l.styles.input,{width:72,textAlign:'center'}]}),(0,x.jsx)(l.T,{size:14,children:"\xb0C or colder"})]})]}),(0,x.jsx)(o.TextInput,{testID:`tu-due-${e.key}`,accessibilityLabel:`Check times for ${d}, 24 hour, comma separated`,value:e.due,onChangeText:t=>s({...e,due:t}),placeholder:"Check times, e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[l.styles.input,{alignSelf:'stretch',width:'100%'}]}),t?(0,x.jsx)(l.T,{testID:`tu-problem-${e.key}`,size:14,colour:y.colours.red,center:!0,accessibilityRole:"text",children:t}):null,(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:`tu-archive-${e.key}`,label:"Archive",accessibilityLabel:`Archive ${d}`,accessibilityHint:"Stops the checks. Its past readings stay in History and the EHO report",onPress:c,style:{alignSelf:'center'}})]})}},1126,[17,85,777,812,1001,876,820,1127,804,1128,899,8]); @@ -1306,7 +1306,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e __d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:l,declared:s}){return(0,c.jsxs)(a.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,c.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(d.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,n.isLiveVenue)()?null:(0,c.jsx)(d.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,c.jsx)(a.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:t.ALLERGENS.map(e=>{const n=l[e.id],u=s.find(l=>l.allergen===e.id),f='contains'===n?o.colours.redBg:'may'===n?o.colours.amberBg:o.colours.surface2,h='contains'===n?'#FFD9D4':'may'===n?'#FFE2A8':o.colours.muted;return(0,c.jsxs)(a.default,{style:{width:'48%',flexGrow:1,backgroundColor:f,borderRadius:8,padding:8,borderWidth:u?2:1,borderColor:u?o.colours.red:o.colours.border},children:[(0,c.jsx)(d.T,{size:14,weight:"medium",colour:n?h:o.colours.text,children:e.label}),(0,c.jsxs)(d.T,{size:13,colour:h,children:['contains'===n?'Contains':'may'===n?'May contain':'Not listed',u?` \xb7 YOUR ALLERGY (${(0,t.severityLabel)(u.severity)})`:'']})]},e.id)})}),e.allergenNotes?(0,c.jsxs)(d.Muted,{children:["Notes: ",e.allergenNotes]}):null,(0,c.jsx)(a.default,{testID:"allergen-signoff",children:(0,c.jsx)(d.Muted,{children:e.signOff?`From the dish's recipe card. Signed off by ${e.signOff.by} on ${u(e.signOff.at)}.`:"Awaiting the head chef's allergen sign-off: not available to order online."})}),(0,c.jsx)(d.Muted,{children:"Always tell staff about allergies when you order or arrive."})]})},_e.AllergenChips=function({map:l,declared:n,signedOff:s}){const a=Object.entries(l);return a.length?(0,c.jsx)(d.Row,{wrap:!0,gap:5,children:a.sort((e,l)=>e[1]===l[1]?0:'contains'===e[1]?-1:1).map(([e,l])=>{const s=n.some(l=>l.allergen===e);return(0,c.jsx)(d.Badge,{label:`${s?'\u26a0 ':''}${(0,t.allergenLabel)(e)}${'may'===l?' (may)':''}`,kind:s?'contains'===l?'red':'amber':'neutral'},e)})}):(0,c.jsx)(d.Muted,{children:(0,e.noAllergenWords)(s)})};var e=r(_d[0]);r(_d[1]);var l,n=r(_d[2]),s=r(_d[3]),a=(l=s)&&l.__esModule?l:{default:l},t=r(_d[4]),o=r(_d[5]),d=r(_d[6]),c=r(_d[7]);const u=e=>{const l=new Date(`${e.slice(0,10)}T12:00:00`);return isNaN(+l)?e:l.toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric'})}},1223,[901,17,1224,85,845,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1224,[880,899]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/car-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1225,[]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},1226,[843,1026,17,219,385,85,780,858,804,777,1227,1102,1228,8]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by email",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},1226,[843,1026,17,219,385,85,780,858,804,777,1227,1102,1228,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,"BANNER_MS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return I}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:b}){const g=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!h||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=p,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,I),x=e.length-y.length,R=(0,f.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:h?'fixed':'absolute',left:10,right:n?10:76,top:8+g.top,zIndex:2147483001,gap:8,alignItems:'center',...h?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,f.jsx)(C,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>b(e)},e.id+':'+e.at)),x>0?(0,f.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:u.SLIDER.bg,borderWidth:1,borderColor:u.SLIDER.border},children:(0,f.jsxs)(c.T,{size:13,colour:u.SLIDER.quiet,children:[x," more new ",1===x?'booking':'bookings']})}):null]});if(h)try{const e=r(_d[13],"react-dom");if(e?.createPortal)return e.createPortal(R,document.body)}catch{}return R};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]),f=r(_d[12]);const h='undefined'!=typeof document,p="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",y=e=>h?{dataSet:{ccbn:e}}:{},x=7e3,I=3;function C({a:e,big:a,managers:p,me:I,onOpen:C,onClose:R}){const j='pending'===e.kind,[k,D]=(0,o.useState)(null),L=j&&p&&!k;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(R,k?1800:x);return()=>clearTimeout(e)},[L,k]);const S=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&R()}})).current,E=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',z=[e.when,E,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),v=j?'Booking request':'New booking',w=[e.when,E,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),T=`${v}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${C?' Tap to open bookings.':''}`,$=n=>{e.refId&&!e.test&&g.repo.bookings.decide(e.refId,n,I??'Manager'),D('confirmed'===n?'Confirmed.':'Declined.')};return(0,f.jsxs)(s.default,{...S.panHandlers,...y('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:u.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':u.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:j?d.colours.amber:d.colours.gold,...h?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,f.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:T,disabled:!C,onPress:()=>{R(),C?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,f.jsx)(c.T,{size:a?14:12,weight:"bold",colour:j?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:k??v.toUpperCase()}),(0,f.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:u.SLIDER.text,numberOfLines:1,children:e.name}),z?(0,f.jsx)(c.T,{size:a?18:15,colour:u.SLIDER.quiet,numberOfLines:1,children:z}):null,e.allergy?(0,f.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,f.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,f.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>$('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:u.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(c.T,{size:15,weight:"bold",colour:u.SLIDER.ink,children:"Confirm"})}),(0,f.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>$('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,f.jsx)(b.ToastClose,{testID:"booking-banner-close",label:`Close ${v.toLowerCase()} for ${e.name}`,onPress:R,size:a?'lg':'md',colour:u.SLIDER.quiet,style:{minWidth:56,minHeight:56,marginRight:4}})]})}},1227,[843,17,363,219,385,85,19,804,777,779,1102,858,8,260]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},1228,[1229,1230,1232,1231,1233,1016,1234]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1229,[]); @@ -1416,7 +1416,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1333,[812,843,17,85,777,845,851,1151,1334,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})},1334,[928,899,1151]); __d(function(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]})}},1335,[13,17,856,1336,1408,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 Je}}),_e2.DisplayBoard=function(e={}){const t=(0,ie.useOwner)(e=>e.site);return(0,te.useRestaurant)(t)?(0,qe.jsx)(at,{...e}):(0,qe.jsx)(U.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Y.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]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=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=_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]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]);const Ye='#221C12',Qe='#2E2618',Je=12e4,Xe={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},Ze={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},et={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},tt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),lt=e=>e.slotTime?(0,ee.hm)(new Date(e.slotTime)):'ASAP';function it({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,qe.jsxs)(U.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)(U.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)(U.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)(Y.T,{size:s?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,qe.jsx)(Y.T,{size:s?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,qe.jsx)(F.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)(U.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)(Y.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,qe.jsxs)(U.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,qe.jsx)(U.default,{style:{width:`${l.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,qe.jsx)(U.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,qe.jsxs)(F.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)(U.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,qe.jsx)(Y.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Y.T,{size:12,colour:se.colours.muted,children:s}):null]})}function ot({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ve.statusBlock)(e,t,(0,Ve.linkedBooking)(e,l));return e.length?(0,qe.jsx)(U.default,{style:{gap:8},children:e.map(e=>(0,qe.jsxs)(U.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:s?16:18,weight:"bold",children:[lt(e)," \xb7 ",tt(e.customerName)]}),(0,qe.jsx)(Y.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)(Y.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)(Y.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,Z.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Fe.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Y.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Y.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>te.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Y.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Y.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Ce.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Y.Muted,{children:"No takeaway orders right now."})}function at({embedded:e=!1,boardW:b,headerExtra:Z,subHeader:Fe,noVoice:Ve=!1}={}){const lt=(0,K.default)(),at=b??lt.width,dt=lt.height,ct=at<700,ut=at>=dt,ht=!ct&&ut&&at>=600,gt=ht,bt=Math.round(Math.min(520,Math.max(at>=1e3?448:280,.3*at))),yt=P.default.useRef(null),pt=P.default.useRef(0),[ft,xt]=(0,H.useState)({w:0,h:0}),mt=(0,ie.useOwner)(e=>e.site),jt=(0,te.useRestaurant)(mt);(0,Re.useAlertWatcher)(mt,{enabled:!e});const wt=(0,te.useOrders)(mt),kt=(0,te.useBookings)(mt),It=(0,te.useEvents)(mt),Dt=(0,te.useStore)(e=>e.skipMinutes),vt=(0,te.useStore)(e=>e.clock.mode),St=(0,te.useNow)(5e3),Ct=(0,ie.useOwner)(e=>e.staff),Tt=(0,ie.useOwner)(e=>e.attendance),Rt=(0,ie.useOwner)(e=>e.shifts),$t=(0,ie.useOwner)(e=>e.leave),Bt=P.default.useMemo(()=>(0,Oe.workingShifts)(Rt,$t),[Rt,$t]);P.default.useEffect(()=>{(0,oe.ensureAttendance)((0,ee.ymd)(St),St)},[(0,ee.ymd)(St)]);const Wt=(0,R.useSession)(e=>e.meId),Lt=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:tt(Ct.find(e=>e.id===Wt)?.name)}),zt=I.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Ht=(0,ee.ymd)(St),Pt=(0,A.useTravelDay)('display',Ht),Mt=(0,ne.useFrontDoor)(Ht,ut),At=(0,ae.useDisplaySettings)(mt),Et=At.privacy,Ot=(0,pe.useSaverSync)(),Nt=(0,ae.usePlan)(mt),_t=(0,ae.useFloor)(e=>e.live[mt]),Gt=(0,$e.useBlocks)(e=>e.blocks),[Ft,Vt]=(0,H.useState)('plan'),[Ut,Kt]=(0,H.useState)(!1),[qt,Yt]=(0,H.useState)('all'),[Qt,Jt]=(0,H.useState)(null),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(!1),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(null),[rs,ds]=(0,H.useState)(!1),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(null),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[ks,Is]=(0,H.useState)(!1),Ds=P.default.useRef(0),vs=e=>{Ds.current=Date.now(),ws(e)};P.default.useEffect(()=>{if(!js)return;const e=setInterval(()=>{Date.now()-Ds.current>=ze.DAY_IDLE_MS&&ws(null)},5e3);return()=>clearInterval(e)},[js]);const Ss=(0,te.useWaitlist)(mt),Cs=(0,te.useStore)(e=>e.walkIns[mt]??0),[Ts,Rs]=(0,H.useState)(!1),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1);(0,J.useReviewAlerts)(mt);const[Ps,Ms]=(0,H.useState)({view:0,content:0}),[As,Es]=(0,H.useState)(null);P.default.useEffect(()=>{As&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:As,timeoutMs:4500,big:!0,testID:'floor-toast'}),Es(null))},[As]),P.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Os,Ns]=(0,H.useState)(null),_s=P.default.useRef(0),[Gs,Fs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Os)return;_s.current=Date.now();const e=setInterval(()=>{const e=Date.now()-_s.current;if(e>=Je)return Ns(null),void Es('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Fs(e>=105e3?Math.ceil((Je-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Os]);const Vs=e=>e.date!==Ht?ts({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Ht)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Ht?(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Ht)}, ${e.time}`,disabled:!wi.ok,accessibilityHint:wi.hint,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}):null,(0,ve.bookingDetails)(e)]})}):ts({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(rt,{rid:mt,id:e.id,turnBase:jt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(we.CancelWalkInButton,{rid:mt,b:e,big:!0,onDone:e=>{ts(null),Es(e)}}):null,e.walkIn?(0,qe.jsx)(we.ReinstateWalkInButton,{rid:mt,b:e,today:Ht,onDone:e=>{ts(null),Es(e)}}):null,(0,ve.bookingDetails)(e)]})}),Us=kt.filter(e=>e.date===Ht).sort((e,t)=>e.time.localeCompare(t.time)),Ks=Us.filter(e=>!['cancelled','noshow'].includes(e.status)),qs=wt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,H.useMemo)(()=>(0,c.forecastToday)(jt,kt,wt,It,St),[jt,kt,wt,It,St.getTime()/6e4|0]),Qs=(0,$e.closedAreasAt)(Gt,mt,Ht,(0,ee.hm)(St)),Js=[...Qs].join(','),Xs=(0,H.useMemo)(()=>(0,re.floorView)(Nt,kt,wt,_t??{},St,jt.settings.turnMins,Qs),[Nt,kt,wt,_t,St.getTime(),Js]),Zs=(0,De.hoursFor)(jt,St),el=Zs?.open??new Date(`${Ht}T12:00:00`),tl=Zs?.close??new Date(`${Ht}T21:00:00`),sl=(0,ee.addMins)(el,-el.getMinutes()),ll=(0,ee.addMins)(tl,30),il=e=>new Date(`${Ht}T${e}:00`),nl=(0,$e.blocksOn)(Gt,mt,Ht).map(e=>({from:il(e.from),to:il(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(jt,St,Ht)),ol=Object.keys(Xs).filter(e=>'blocked'===Xs[e]?.status),al=js&&js!==Ht?js:Ht,rl=al!==Ht,dl=(0,ze.dayWord)(al,Ht),cl=/^(Today|Yesterday|Tomorrow)$/.test(dl),ul=rl?(0,ze.bookingsForDay)(kt,al,Ht).sort((e,t)=>e.time.localeCompare(t.time)):Us,hl=(0,ee.parseYmd)(al);hl.setHours(12);const gl=rl?(0,De.hoursFor)(jt,hl):Zs,bl=gl?.open??new Date(`${al}T12:00:00`),yl=gl?.close??new Date(`${al}T21:00:00`),pl=e=>new Date(`${al}T${e}:00`),fl=[...rl?(0,$e.blocksOn)(Gt,mt,al).map(e=>({from:pl(e.from),to:pl(e.to),label:e.reason??'Paused'})):nl,...rl?(0,n.queuedServicePauses)(jt,hl,al):[]],xl=(0,n.queuedServiceSessions)(jt,hl),ml=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),jl=(0,qe.jsxs)(U.default,{testID:"queued-hours-gate",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Y.Muted,{children:i.queuedVenues[mt]?.hours.note})]}),wl=rl?gl||ul.length?alrl?(0,re.dayFloorView)(Nt,ul,al):Xs,[rl,Nt,ul,al,Xs]),[Il,Dl]=(0,H.useState)(null),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(!1),[Rl,$l]=(0,H.useState)(null),Bl=rl?ul.filter(e=>!['cancelled','noshow'].includes(e.status)):Ks,Wl=Bl.reduce((e,t)=>e+t.partySize,0),Ll=(0,u.coversSplit)(Bl,al),zl=(0,Pe.cancelledDayTally)(kt,al),Hl=(0,Me.cancellationsFor)(kt,al,e=>e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)','')),Pl=(0,Pe.cancelledTallyWords)(zl,cl?dl.toLowerCase():rl?`on ${dl}`:'today'),Ml=Gt.filter(e=>e.rid===mt&&e.date===al&&!e.removedAt),Al=60*bl.getHours()+bl.getMinutes(),El=60*yl.getHours()+yl.getMinutes(),Ol=(0,Le.chartBands)(Ml,Al,El),Nl=(0,Le.seasonClosedAreaIds)(Ml,Al,El),_l=Nl.size?{...Nt,areas:Nt.areas.filter(e=>!Nl.has(e.id)),tables:Nt.tables.filter(e=>!Nl.has(e.areaId))}:Nt,Gl=rl?[]:ol.filter(e=>!Nl.has(Nt.tables.find(t=>t.name===e)?.areaId??'')),Fl=new Set((0,Le.blockedHours)(Ol)),Vl=St.getHours()+(St.getMinutes()>=30?1:0),Ul=Ys.hours.filter(e=>e.hour>=Vl&&!Fl.has(e.hour)),Kl=Ul.reduce((e,t)=>e+t.coversHigh,0),ql=Ul.reduce((e,t)=>e+t.coversLow,0),Yl=Math.round((ql+Kl)/2),Ql=!Ys.example&&Ys.open&&Ys.enough&&Kl>0?`Usually ${(0,c.coversRange)(Yl,Yl)} more`:void 0,Jl=async(e,t)=>{const s=Xs[e]?.booking;if(!s||e===t)return;const l=Xs[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 ${re.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,ke.guardBookingChange)(Es,{b:s,tables:[t]}))return;await te.repo.bookings.update(s.id,{table:t});const i=_t?.[e]?.stage;ae.useFloor.getState().setLive(mt,t,{stage:i??'seated',dirty:!1}),ae.useFloor.getState().setLive(mt,e,{stage:void 0,dirty:!0}),Es(`Saving: ${(0,fe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,ke.reportBookingSave)(s.id,`${(0,fe.privName)(s,Et)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}`,Es)},Xl=e=>{if(xs)return Sl(null),void ms(t=>t?{...t,tables:(0,Ie.toggleTable)(t.tables,e)}:t);rl?Dl(e):Xt?(e!==Xt&&Jl(Xt,e),Zt(null)):Jt(e)},Zl=xs?kt.find(e=>e.id===xs.id):void 0,ei=xs&&Zl?(()=>{const e=Zl.walkIn?(0,fe.privName)(Zl,Et):tt(Zl.name),t=(0,Ie.seatsOf)(Nt,xs.tables).total,s=(0,Ie.seatLine)(t,Zl.partySize),l=(0,Ie.pickClashes)(Zl,xs.tables,kt.filter(e=>e.date===Zl.date),jt.settings.turnMins),i=(0,Ie.tableKey)(xs.tables)!==(0,Ie.tableKey)((0,ae.tablesOf)(Zl.table));return(0,qe.jsxs)(U.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,qe.jsxs)(U.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Zl.date,Ht)} ${Zl.time}. Tap tables on the plan to add or take them off. ${(0,Ie.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Zl.date,Ht)," ",Zl.time]}),(0,qe.jsxs)(Y.T,{size:16,colour:se.colours.text,children:[(0,Ie.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),vl?(0,qe.jsx)(U.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:vl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,qe.jsx)(Y.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:vl})}):null,Cl&&Zl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Tl(!1),(async()=>{if(!(0,ke.guardBookingChange)(Es,{b:Zl,tables:xs.tables}))return Sl(null),void ms(null);const s=xs.tables;ms(null),await(0,ke.saveTablesReported)(mt,Zl,s,e,t,Es)})()},onNo:()=>Tl(!1)}):null,(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:vl?'plan-pick-overcap-yes':'plan-pick-save',label:vl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${vl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,Ie.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Zl)return void ms(null);if(!(0,ke.guardBookingChange)(Es,{b:Zl,tables:xs.tables}))return Sl(null),void ms(null);const s=(0,Ie.overCapacityAsk)(xs.tables,t,Zl.partySize);if(s&&!vl)return void Sl(s);if('finished'===Zl.status&&xs.tables.length&&!Cl)return void Tl(!0);Sl(null),Tl(!1);const l=xs.tables;ms(null),await(0,ke.saveTablesReported)(mt,Zl,l,e,t,Es)}}),(0,qe.jsx)(Y.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Sl(null),ms(null)}})]})]})})():null,ti=_l.areas.filter(e=>_l.tables.some(t=>t.areaId===e.id)),si=e=>{const t=Nt.tables.filter(t=>t.areaId===e);return rl?`${t.filter(e=>!kl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Xs[e.name]?.status??'free')).length}/${t.length} free`},li='all'===qt||ti.some(e=>e.id===qt)?qt:'all',ii=e=>(0,qe.jsx)(de.FloorCanvas,{plan:_l,areaId:e,mode:"live",fit:"contain",crop:!0,fill:ht,big:!0,view:kl,privacy:Et,turnBase:jt.settings.turnMins,highlight:xs?xs.tables:Xt?[Xt]:void 0,onTap:e=>Xl(e.name),onDrop:(e,t)=>xs||rl?void 0:Jl(e.name,t.name)}),ni=ct?1:ut||ti.length>2?2:1,oi=e=>{const t=Nt.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},ai=[];for(let e=0;e{const t=(0,de.areaBounds)(Nt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,de.minReadableScale)(Nt,e.id)}}),ft.w,ft.h):null,di=e=>(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',height:ce.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:si(e.id)})]}),ci=(0,qe.jsx)(U.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-ft.w)>1||Math.abs(s-ft.h)>1)&&xt({w:t,h:s})},children:ri?(0,qe.jsx)(V.default,{style:{flex:1},scrollEnabled:ri.scroll,showsVerticalScrollIndicator:ri.scroll,contentContainerStyle:{gap:ce.GRID_GAP},children:ri.rows.map((e,t)=>(0,qe.jsx)(U.default,{style:{height:ri.rowHeights[t],flexDirection:'row',gap:ce.GRID_GAP},children:e.map(e=>{const t=ti.find(t=>t.id===e);return(0,qe.jsxs)(U.default,{testID:`area-cell-${e}`,style:{width:ri.cellW,gap:2},children:[di(t),(0,qe.jsx)(U.default,{style:{flex:1},children:ii(e)})]},e)})},t))}):null}),ui=(0,qe.jsxs)(U.default,{testID:"venue-plan",style:{flex:ct?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:Nt}),Nt.tables.length?null:(0,qe.jsxs)(U.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,qe.jsx)(Y.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Y.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)(Y.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,qe.jsx)(nt,{chipId:"all",compact:!ct,label:"Whole venue",selected:'all'===li,onPress:()=>Yt('all')},"__all"),...ti.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ct,label:`${e.name}${(0,ue.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ct?Qs.has(e.id)?'closed':li===e.id?si(e.id):void 0:void 0,selected:li===e.id,onPress:()=>Yt(e.id)},e.id))];return ct?(0,qe.jsx)(U.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,qe.jsx)(V.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:Ps.view>0&&Ps.content>0&&Ps.content<=Ps.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ps.view>0&&Ps.content<=Ps.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),ei,Xt?(0,qe.jsxs)(Y.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Y.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Xt),": tap the new table."]}),(0,qe.jsx)(Y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Zt(null)})]}):null,'all'===li&&ht?ci:'all'===li?(0,qe.jsx)(U.default,{style:{flex:ct?void 0:1,gap:12,minHeight:gt?void 0:360},children:ai.map((e,t)=>(0,qe.jsxs)(U.default,{style:{flex:ct?void 0:Math.max(.3,...e.map(e=>oi(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(U.default,{style:{flex:1,gap:2},children:[ct?(0,qe.jsxs)(U.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Y.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{center:!0,children:si(e.id)})]}):(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{children:si(e.id)})]}),(0,qe.jsx)(U.default,{style:ct?{height:Math.max(280,Math.round((at-40)*oi(e.id)))}:{flex:1},children:ii(e.id)})]},e.id)),e.length{if(rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},al)}),gi='timeline'===Ft,bi=Ut?(0,qe.jsx)(_.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Kt(!1),supportedOrientations:['landscape','portrait'],children:(0,qe.jsxs)(U.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,qe.jsx)(F.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Kt(!1),style:{minHeight:64,minWidth:at<600?120:180,paddingHorizontal:at<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,qe.jsx)(U.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,qe.jsx)(Y.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${rl?(0,ze.dayLong)(al):'Today'}`})}),at<600?null:(0,qe.jsx)(U.default,{style:{minWidth:180}})]}),ml?jl:(0,qe.jsx)(U.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(be.Timeline,{hideNow:!0,fit:!0,plan:_l,bookings:rl?ul:Us,now:rl?bl:St,privacy:Et,turnBase:jt.settings.turnMins,t0:rl?(0,ee.addMins)(bl,-bl.getMinutes()):sl,t1:rl?(0,ee.addMins)(yl,30):ll,pauses:rl?fl:nl,blockedTables:Gl,onOpen:e=>{if(Kt(!1),rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},`full-${al}`)})]})}):null,yi=rl?(0,qe.jsxs)(U.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:cl?`Showing ${dl} \xb7 ${(0,ee.niceDate)((0,ee.parseYmd)(al))}`:`Showing ${(0,ze.dayWord)(al,Ht)}`}),(0,qe.jsx)(U.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Pl}. Showing ${(0,ze.dayLong)(al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Y.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ms(null),vs(null)},style:{minHeight:44}})]}):null,pi=(0,qe.jsx)(U.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:ct?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(gi||Ut);return(0,qe.jsx)(F.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?(Vt('plan'),Kt(!0)):(Kt(!1),Vt('plan'))},style:{flex:ct?1:void 0,minHeight:ct?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',...Ne.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)(Y.T,{size:ct?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),fi='display'===I.APP_VARIANT&&!e,xi='display'===I.APP_VARIANT&&!e,mi=!e&&!I.IS_CAR&&!ct,ji=fi?(0,qe.jsxs)(U.default,{testID:"display-view-row",style:{flexDirection:ct?'column':'row',flexWrap:ct||mi?'nowrap':'wrap',gap:6,alignItems:ct||mi?'stretch':'center'},children:[pi,(0,qe.jsx)(k.DisplayRotaKitchenButtons,{phone:ct,fill:mi,shifts:Rt,staff:Ct,today:Ht,leave:$t})]}):pi,wi=(0,h.useBookingWrite)(),ki=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Walk-in",onPress:Mt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"New booking",onPress:Mt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint})]});(0,Ke.useDisplayNotices)(mt,!e);const Ii=!e&&!I.IS_CAR&&!ct,Di=ct?180:202,[vi,Si]=(0,H.useState)(ct?180:168),Ci=P.default.useRef(ct?180:168),Ti=P.default.useRef(null),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(!1),[Wi,Li]=(0,H.useState)(!1),zi=!ct&&dt<=800,Hi=We.DAY_GRAPH_CHROME+(zi?24:8),Pi=P.default.useRef(0),[Mi,Ai]=(0,H.useState)(Hi),[Ei,Oi]=(0,H.useState)(!0),[Ni,Gi]=(0,H.useState)(!1);P.default.useEffect(()=>{Gi(!1)},[at,dt]);const Fi=P.default.useRef(()=>{}),Vi=P.default.useCallback(e=>{Math.abs(e-Pi.current)>=2&&(Pi.current=e,setTimeout(()=>Fi.current(),0))},[]),Ui=()=>{const e=Ti.current,t=Ri.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=t>Ci.current?Math.ceil(t-Ci.current):0,o=Ii?Math.max(Hi,Pi.current):Math.max(Hi,n);Ii&&o!==Mi&&Ai(o);const a=!ct&&dt>=700?140:70,r=Math.floor(s-4-e)-o-l,d=i>0&&r-i>=a;Ii&&d!==Ei&&Oi(d),Ii&&!Ni&&r<48&&Gi(!0);const c=r-(d?i:0),u=Math.min(Di,c>=a?Math.max(a,c):Math.max(0,c));Math.abs(Ci.current-u)>=2&&(Ci.current=u,Si(u))},l=44+(dt<820?4:8),i=46+(dt<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=$i.current;Ii&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=dt<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Bi.current?44+d:0)}):s(n,a,t,Ii?i:l)})})};Fi.current=Ui,P.default.useEffect(()=>{const e=setTimeout(()=>Fi.current(),60),t=setTimeout(()=>Fi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[at,dt,al]);const Ki=(0,qe.jsxs)(U.default,{ref:Ri,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ui()},style:{flexDirection:'row',flexWrap:at>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ct?12:zi?2:6,justifyContent:ct?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ue.DisplayClockButton,{}),(0,qe.jsx)(ge.HoldToEdit,{quiet:!0,onUnlock:()=>{Fs(null),Ns({at:Date.now()})},onHint:()=>Es('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(Be.BlockBookingsButton,{rid:mt,r:jt,now:St,by:Lt,quiet:!0,display:!0,day:al}),Nt.areas.some(e=>e.outdoor)?(0,qe.jsx)(Be.CloseGardenButton,{rid:mt,r:jt,now:St,by:Lt,quiet:!0,short:!0}):null,(0,qe.jsx)(F.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Hs(!0),style:({pressed:e})=>({...Ne.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,qe.jsx)(f.GiftQrButton,{rid:mt,venue:jt.name})]}),qi=qs.length?(0,qe.jsxs)(U.default,{testID:"takeaway-panel",style:[Ne.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Y.T,{size:12,colour:se.colours.muted,children:[qs.length," live"]})]}),(0,qe.jsx)(U.default,{style:{padding:10},children:(0,qe.jsx)(ot,{list:qs,me:Lt,compact:!0,bookings:kt})})]}):null,Yi=(Ee.DueToday,jt.settings.turnMins||90),Qi=rl?ul:(0,v.todaysGuestList)(Us,St,Yi),Ji=rl?[]:(0,v.todaysFinishedList)(Us,St,Yi),Xi=rl?cl?`${dl}\u2019s guests`:`Guests ${dl}`:'Today\u2019s guests',Zi=(0,qe.jsxs)(qe.Fragment,{children:[0===Qi.length?(0,qe.jsx)(Y.Muted,{children:rl?al{const t=(0,v.isLeftEarly)(e,St,Yi),s=(0,le.isSeatedHighlight)(e.status,{otherDay:rl})&&!t,l=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=se.colours.text,n=s?se.colours.goldLight:se.colours.muted,o=se.colours.gold,a=l.depositWarn?se.colours.amber:se.colours.goldLight;return(0,qe.jsxs)(F.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:rl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,le.seatedHighlightStyle)({backgroundColor:e?Qe:Ye,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,qe.jsx)(Y.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)(U.default,{style:{paddingTop:2},children:(0,qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,qe.jsxs)(Y.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Y.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}),(0,qe.jsx)(Y.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,qe.jsx)(Y.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(U.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(me.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,qe.jsx)(Y.T,{size:15,colour:se.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),Ji.length?(0,qe.jsxs)(U.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(F.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ji.length}${bs?', expanded':', collapsed'}`,accessibilityState:{expanded:bs},onPress:()=>ys(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Y.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ji.length,")"]}),(0,qe.jsx)(Y.T,{size:16,colour:se.colours.muted,children:bs?'\u25be':'\u25b8'})]}),bs?Ji.map(e=>{const t=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,qe.jsxs)(F.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Y.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Y.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,qe.jsx)(U.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,qe.jsx)(S.BookingUndo,{b:e,rid:mt,today:Ht,who:t.name,allowed:wi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ae.CancellationsSection,{items:Hl,dayWord:rl?cl?dl.toLowerCase():`on ${dl}`:'today'})]}),en=(0,qe.jsx)(V.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Zi}),tn=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&gs(!1)}}),sn=(0,qe.jsxs)(F.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Xi}, ${Qi.length}`,accessibilityState:{expanded:hs},'aria-expanded':hs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>gs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:hs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:hs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Y.T,{size:16,weight:"bold",colour:se.colours.gold,children:Qi.length}),(0,qe.jsx)(U.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(U.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,qe.jsxs)(Y.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Xi," ",hs?'\u2039':'\u203a']})})})]}),ln=hs?(0,qe.jsxs)(U.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,qe.jsxs)(U.default,{testID:"guests-drawer",...tn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*at)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,...Ne.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,qe.jsxs)(U.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Xi.toUpperCase()," (",Qi.length,")"]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Xi}`,onPress:()=>gs(!1),style:{marginRight:-6}})]}),zl.count?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Pl}):null,(0,qe.jsx)(U.default,{testID:"guests-tools",style:{flexDirection:'row',gap:8,marginTop:6,justifyContent:'center'},children:(0,qe.jsx)(F.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:cs},'aria-expanded':cs,onPress:()=>us(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:14,borderRadius:12,borderWidth:1,borderColor:cs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',backgroundColor:e?se.colours.tilePressed:cs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:se.colours.goldLight,children:["Guest key ",cs?'\u25b4':'\u25be']})})}),cs?(0,qe.jsx)(U.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: warning sign allergy, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:6},children:[['\u26a0','allergy'],['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(Y.T,{size:16,children:e}),(0,qe.jsx)(Y.T,{size:14,children:t})]},t))}):null]}),en]}),(0,qe.jsx)(F.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Xi}`,accessibilityRole:"button",onPress:()=>gs(!1),style:{flex:1}})]}):null,nn=ml?jl:l.IS_KIRKTON&&!Object.values(jt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(U.default,{testID:"kirkton-hours-to-confirm",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Y.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(jt,kt,St).busy,todays:ul,open:bl,close:yl,now:St,turnBase:jt.settings.turnMins,blocks:Ml,pauses:fl,compact:ct,dense:!ct,fit:ht,tight:ht&&dt<=600,height:ht?vi:Di,forecastNote:rl?void 0:Ql,emptyText:wl,past:al{Ds.current=Date.now(),Is(!0)},shortDay:!ct&&at<1100}),rn=(0,qe.jsx)(He.DisplayCalendar,{visible:ks,today:Ht,day:al,bookings:kt,restaurant:jt,now:St,onDay:vs,onClose:()=>Is(!1)}),dn=()=>{rl?gs(!0):Kt(!0)},cn=(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',padding:zi?4:dt<820?8:12,paddingTop:zi?Ii?2:4:dt<820?Ii?4:6:Ii?8:10,gap:zi?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:yi,Pt?(0,qe.jsx)(V.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"})}):gi?hi:ui,bi,ln]}),(0,qe.jsxs)(U.default,{testID:"display-side",style:{width:bt,gap:dt<820?4:8,minHeight:0},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ki(!1)}),(0,qe.jsx)(U.default,{style:{flexShrink:0},children:ji}),Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",onLayout:Ui,style:Ii&&!Ni?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:dt<820,snug:dt<820,tight:dt<800,fill:Ii&&!Ni,sound:(0,E.flapSoundOn)(),onPress:dn})}),Pt?null:(0,qe.jsx)(U.default,{ref:Ti,testID:"day-graph-slot",onLayout:Ui,style:{flexGrow:0,flexShrink:Ii?0:1,flexBasis:(ct?Di:vi)+(Ii?Mi:Hi),height:(ct?Di:vi)+(Ii?Mi:Hi),minHeight:dt<=600?90:Math.min((ct?Di:vi)+We.DAY_GRAPH_CHROME,!ct&&dt>=768?140+We.DAY_GRAPH_CHROME:120),overflow:'visible'},children:on}),Ii&&!Pt?(0,qe.jsx)(U.default,{ref:$i,testID:"display-side-split",onLayout:Ui,style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})}):null,(0,qe.jsxs)(V.default,{testID:"display-side-scroll",style:Ii?{flexGrow:0,flexShrink:1,minHeight:Wi&&Ei?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Bi.current&&(Bi.current=s,Li(s),setTimeout(Ui,0))},children:[Ii||xi?null:(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),qi,(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt})]})]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Ds.current=Date.now()},onMouseDown:()=>{Ds.current=Date.now()},children:[ct?(0,qe.jsx)(U.default,{style:{flex:1},children:(0,qe.jsxs)(V.default,{ref:yt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,qe.jsxs)(U.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,qe.jsx)(U.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,qe.jsx)(j.ExitButton,{})}),(0,qe.jsx)(X.RestaurantLogo,{rid:mt,size:64}),(0,qe.jsx)(Y.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:jt.name}),(0,qe.jsx)(X.PoweredBy,{}),(0,qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(U.default,{accessible:!0,accessibilityLabel:`Current time ${(0,ee.hm)(St)}`,children:(0,qe.jsx)(Y.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,ee.hm)(St)})}),(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:"m"}),(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",size:"m"}),Z]}),Fe,I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(ke.BookingSaveBanner,{rid:mt}),an,(0,qe.jsx)(U.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(it,{phone:!0,split:Ll,items:[{label:`Tables \xb7 ${dl}`,value:Bl.length,testID:'badge-tables'},{label:`Covers \xb7 ${dl}`,value:Wl,testID:'badge-covers'},{label:'Takeaway',value:qs.length,alert:qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ls(!0)}]})}),(0,qe.jsx)(U.default,{testID:"primary-actions",style:{gap:8},children:ki(!0)}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt}),ji,(0,qe.jsxs)(U.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[gi?hi:ui,bi]}),(0,qe.jsxs)(U.default,{onLayout:e=>{pt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ne.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Y.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Xi," (",Qi.length,")"]}),(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{gap:4},children:Zi})]}),qi,on,(0,qe.jsx)(U.default,{testID:"covers-dock",children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>yt.current?.scrollTo({y:pt.current,animated:!0})})}),(0,qe.jsxs)(U.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,qe.jsx)(Y.T,{center:!0,size:14,colour:Et?se.colours.muted:se.colours.amber,children:Et?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Y.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Rs(!0),style:{minHeight:48,alignSelf:'stretch'}}),xi?null:(0,qe.jsx)(Y.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ki]})}):(0,qe.jsxs)(qe.Fragment,{children:[Ii?(0,qe.jsx)(U.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:se.colours.hairline},children:(0,qe.jsx)(U.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)(U.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,paddingVertical:zi?2:dt<820?4:8,gap:8,minHeight:zi&&Ii?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ne.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(U.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:Ii?16:8,minWidth:0,overflow:'hidden',...Ii?{justifyContent:'flex-start'}:null},children:[(0,qe.jsx)(U.default,{testID:"display-header-brand",style:Ii?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(X.RestaurantBrand,{rid:jt.id,size:at<900?32:40,beside:!0,noLogo:Ii})}),(0,qe.jsxs)(U.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Y.T,{size:at<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,ee.hm)(St)}),at>=900?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:(0,ee.niceDate)(St)}):null]})]}),Pt?(0,qe.jsx)(U.default,{style:{width:220}}):(0,qe.jsx)(U.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:an}),(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,qe.jsxs)(U.default,{testID:"display-header-chips",style:{flexDirection:at>=1400||Ii?'row':'column',alignItems:at>=1400||Ii?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:at<1240?'xs':at<1280||dt<700?'s':'m'}),Pt?null:(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",slot:Ii,size:at<1340?'xs':at<1400||dt<700?'s':'m'})]}),'simulated'===vt?(0,qe.jsx)(F.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>Dt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,Z,e?null:(0,qe.jsx)(U.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(j.ExitButton,{size:44})})]})]}),Fe,I.IS_CAR||!Pt||Ii?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(ke.BookingSaveBanner,{rid:mt,margin:{marginHorizontal:12,marginTop:6}}),Pt||Ii?null:(0,qe.jsx)(U.default,{testID:"display-day-stats",style:Xe,children:(0,qe.jsxs)(U.default,{style:Ze,children:[I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(U.default,{style:et,children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})})]})}),ht?cn:(un=(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{testID:"front-door-bar",style:{gap:10},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ki(!1)}),ji]}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt}),Pt?(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"}):(0,qe.jsx)(qe.Fragment,{children:(0,qe.jsxs)(U.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[yi,gi?hi:ui,bi,ln]})]})}),qi,Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,sound:(0,E.flapSoundOn)(),onPress:dn})}),Pt?null:(0,qe.jsx)(U.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Di+We.DAY_GRAPH_CHROME},children:on})]}),(0,qe.jsx)(V.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:un})),Ki]}),(0,qe.jsx)($.SoldOutStrip,{rid:mt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:zs,onClose:()=>Hs(!1),rid:mt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:mt}),Mt.elements,is?(0,qe.jsx)(y.EditBookingPicker,{rid:mt,today:Ht,who:Lt,onClose:()=>ns(!1)}):null,os?(0,qe.jsx)(y.EditBookingSheet,{rid:mt,id:os,who:Lt,onClose:()=>as(null)}):null,Qt?(0,qe.jsx)(ve.TableSheet,{rid:mt,name:Qt,view:Xs,plan:Nt,todays:Us,now:St,privacy:Et,turnBase:jt.settings.turnMins,onClose:()=>Jt(null),onWalkIn:e=>Mt.openWalkInAt(e),onMove:e=>Zt(e),onDetails:Vs}):null,Il?(()=>{const e=kl[Il],t=e?.dayBookings??[];return(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>{$l(null),Dl(null)},title:`${(0,d.tableNumbersA11y)(Il)} \xb7 ${cl?dl:(0,ze.dayLong)(al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Y.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${cl?dl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${cl?dl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Et):tt(e.name);return(0,qe.jsx)(Y.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,Ie.tablesWords)((0,ae.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Dl(null),fs(e.id)},style:{minHeight:56}},e.id)}),al>=Ht?(()=>{const t=e?.table.maxSeats??0,s=kt.filter(e=>e.date===al&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,ae.tablesOf)(e.table).includes(Il)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,qe.jsxs)(U.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(Il)]}),Rl?(0,qe.jsxs)(U.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Rl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Rl.ask}),(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!wi.ok,accessibilityHint:wi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=kt.find(e=>e.id===Rl.id);if($l(null),!e)return;const s=tt(e.name);Dl(null),await(0,ke.saveTablesReported)(mt,e,[Il],s,t,Es)}}),(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>$l(null)})]})]}):null,Rl?null:s.slice(0,12).map(e=>{const s=tt(e.name),l=e.partySize>t;return(0,qe.jsx)(Y.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:!wi.ok,accessibilityHint:wi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(Il)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,ke.guardBookingChange)(Es,{b:e,tables:[Il]}))return;const l=(0,Ie.overCapacityAsk)([Il],t,e.partySize);l?$l({id:e.id,ask:l}):(Dl(null),await(0,ke.saveTablesReported)(mt,e,[Il],s,t,Es))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Y.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{$l(null),Dl(null)},style:{minHeight:56}})]})})():null,ps?(()=>{const e=kt.find(e=>e.id===ps);return e?(0,qe.jsx)(je.GuestActionsSheet,{rid:mt,b:e,name:e.walkIn?(0,fe.privName)(e,Et):tt(e.name),view:Xs,now:St,otherDay:e.date!==Ht,turnBase:jt.settings.turnMins,onClose:()=>fs(null),onDetails:Vs,onDone:Es,onEdit:e=>{fs(null),as(e.id)},onPickOnPlan:(e,t)=>{gs(!1),Vt('plan'),Yt('all'),ms({id:e.id,tables:t})}}):null})():null,es?(0,qe.jsx)(ve.DetailsPanel,{title:es.title,onClose:()=>ts(null),children:es.body}):null,rn,rs?(0,qe.jsx)(ve.ServiceSummary,{r:jt,todays:Us,orders:wt,waitlistAll:Ss,walkInCount:Cs,onClose:()=>ds(!1)}):null,Ts?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Rs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsx)(Y.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Rs(!1)})]}):null,Ws?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ls(!1),Bs(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,$s?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(Q.ReviewsSection,{rid:mt,mode:"read",venueName:jt.name}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,ss?(0,qe.jsxs)(ve.DetailsPanel,{title:"Takeaway",onClose:()=>ls(!1),children:[(0,qe.jsx)(Y.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(ot,{list:qs,me:Lt,bookings:kt})]}):null,Os?(0,qe.jsx)(U.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,qe.jsx)(he.PlanDesigner,{initial:Nt,venue:jt.name,mode:"display",startStep:"arrange",onActivity:()=>{_s.current=Date.now(),null!==Gs&&Fs(null)},notice:null!==Gs?`Locking again in ${Gs} s \xb7 touch to keep editing`:null,onSave:e=>{ae.useFloor.getState().setPlan(mt,e),Ns(null),Es('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{ae.useFloor.getState().setPlan(mt,e),Es('Live seating plan updated on every screen.')},onCancel:()=>{Ns(null),Es('No changes kept. Editing is locked again.')}},Os.at)}):null,e?null:(0,qe.jsx)(ye.Screensaver,{rid:mt,idleMins:At.idleMins,pinOn:At.pinOn,wake:At,tonightCards:At.tonightCards,cfg:Ot}),e?null:(0,qe.jsx)(Ce.PrintHost,{rid:mt}),e?null:(0,qe.jsx)(Se.AlertHost,{variant:"display",rid:mt,skipTakeaway:!0}),e?null:(0,qe.jsx)(O.SeatAllergenReminder,{rid:mt}),e?null:(0,qe.jsx)(Te.TakeawayTakeover,{rid:mt,me:Lt})]});var un}function rt({rid:e,id:t,turnBase:s}){const l=(0,te.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1336,[1051,779,805,806,1337,813,1338,1092,843,1138,1339,1340,1341,1089,1119,1342,1343,1348,1349,1206,1350,856,1355,1356,1357,1112,1111,920,1358,1150,891,1102,1359,17,1070,1182,1016,1085,1360,378,363,385,278,85,409,19,777,1237,1241,857,845,863,858,804,1088,876,1096,1055,996,1074,1107,1361,1106,1362,1369,1371,1374,1379,1373,1380,1383,1384,1114,1093,1094,862,1389,1226,1390,1236,1228,993,1395,1400,1401,1052,1050,1116,1403,1404,1405,1069,1169,1406,1168,1159,853,1351,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 Je}}),_e2.DisplayBoard=function(e={}){const t=(0,ie.useOwner)(e=>e.site);return(0,te.useRestaurant)(t)?(0,qe.jsx)(at,{...e}):(0,qe.jsx)(U.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Y.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]),S=_r(_d[23]),v=_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=_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]),Se=_r(_d[76]),ve=_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]);const Ye='#221C12',Qe='#2E2618',Je=12e4,Xe={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},Ze={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},et={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},tt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),lt=e=>e.slotTime?(0,ee.hm)(new Date(e.slotTime)):'ASAP';function it({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,qe.jsxs)(U.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)(U.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)(U.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)(Y.T,{size:s?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,qe.jsx)(Y.T,{size:s?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,qe.jsx)(F.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)(U.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)(Y.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,qe.jsxs)(U.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,qe.jsx)(U.default,{style:{width:`${l.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,qe.jsx)(U.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,qe.jsxs)(F.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)(U.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,qe.jsx)(Y.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Y.T,{size:12,colour:se.colours.muted,children:s}):null]})}function ot({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ve.statusBlock)(e,t,(0,Ve.linkedBooking)(e,l));return e.length?(0,qe.jsx)(U.default,{style:{gap:8},children:e.map(e=>(0,qe.jsxs)(U.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:s?16:18,weight:"bold",children:[lt(e)," \xb7 ",tt(e.customerName)]}),(0,qe.jsx)(Y.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)(Y.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)(Y.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,Z.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Fe.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Y.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Y.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>te.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Y.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Y.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Ce.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Y.Muted,{children:"No takeaway orders right now."})}function at({embedded:e=!1,boardW:b,headerExtra:Z,subHeader:Fe,noVoice:Ve=!1}={}){const lt=(0,K.default)(),at=b??lt.width,dt=lt.height,ct=at<700,ut=at>=dt,ht=!ct&&ut&&at>=600,gt=ht,bt=Math.round(Math.min(520,Math.max(at>=1e3?448:280,.3*at))),yt=P.default.useRef(null),pt=P.default.useRef(0),[ft,xt]=(0,H.useState)({w:0,h:0}),mt=(0,ie.useOwner)(e=>e.site),jt=(0,te.useRestaurant)(mt);(0,Re.useAlertWatcher)(mt,{enabled:!e});const wt=(0,te.useOrders)(mt),It=(0,te.useBookings)(mt),kt=(0,te.useEvents)(mt),Dt=(0,te.useStore)(e=>e.skipMinutes),St=(0,te.useStore)(e=>e.clock.mode),vt=(0,te.useNow)(5e3),Ct=(0,ie.useOwner)(e=>e.staff),Tt=(0,ie.useOwner)(e=>e.attendance),Rt=(0,ie.useOwner)(e=>e.shifts),$t=(0,ie.useOwner)(e=>e.leave),Bt=P.default.useMemo(()=>(0,Ee.workingShifts)(Rt,$t),[Rt,$t]);P.default.useEffect(()=>{(0,oe.ensureAttendance)((0,ee.ymd)(vt),vt)},[(0,ee.ymd)(vt)]);const Wt=(0,R.useSession)(e=>e.meId),Lt=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:tt(Ct.find(e=>e.id===Wt)?.name)}),zt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Ht=(0,ee.ymd)(vt),Pt=(0,A.useTravelDay)('display',Ht),Mt=(0,ne.useFrontDoor)(Ht,ut),At=(0,ae.useDisplaySettings)(mt),Ot=At.privacy,Et=(0,pe.useSaverSync)(),Nt=(0,ae.usePlan)(mt),_t=(0,ae.useFloor)(e=>e.live[mt]),Gt=(0,$e.useBlocks)(e=>e.blocks),[Ft,Vt]=(0,H.useState)('plan'),[Ut,Kt]=(0,H.useState)(!1),[qt,Yt]=(0,H.useState)('all'),[Qt,Jt]=(0,H.useState)(null),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(!1),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(null),[rs,ds]=(0,H.useState)(!1),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(null),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(!1),Ds=P.default.useRef(0),Ss=e=>{Ds.current=Date.now(),ws(e)};P.default.useEffect(()=>{if(!js)return;const e=setInterval(()=>{Date.now()-Ds.current>=ze.DAY_IDLE_MS&&ws(null)},5e3);return()=>clearInterval(e)},[js]);const vs=(0,te.useWaitlist)(mt),Cs=(0,te.useStore)(e=>e.walkIns[mt]??0),[Ts,Rs]=(0,H.useState)(!1),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1);(0,J.useReviewAlerts)(mt);const[Ps,Ms]=(0,H.useState)({view:0,content:0}),[As,Os]=(0,H.useState)(null);P.default.useEffect(()=>{As&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:As,timeoutMs:4500,big:!0,testID:'floor-toast'}),Os(null))},[As]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[Es,Ns]=(0,H.useState)(null),_s=P.default.useRef(0),[Gs,Fs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Es)return;_s.current=Date.now();const e=setInterval(()=>{const e=Date.now()-_s.current;if(e>=Je)return Ns(null),void Os('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Fs(e>=105e3?Math.ceil((Je-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Es]);const Vs=e=>e.date!==Ht?ts({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Ht)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Ht?(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Ht)}, ${e.time}`,disabled:!wi.ok,accessibilityHint:wi.hint,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ts({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(rt,{rid:mt,id:e.id,turnBase:jt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(we.CancelWalkInButton,{rid:mt,b:e,big:!0,onDone:e=>{ts(null),Os(e)}}):null,e.walkIn?(0,qe.jsx)(we.ReinstateWalkInButton,{rid:mt,b:e,today:Ht,onDone:e=>{ts(null),Os(e)}}):null,(0,Se.bookingDetails)(e)]})}),Us=It.filter(e=>e.date===Ht).sort((e,t)=>e.time.localeCompare(t.time)),Ks=Us.filter(e=>!['cancelled','noshow'].includes(e.status)),qs=wt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,H.useMemo)(()=>(0,c.forecastToday)(jt,It,wt,kt,vt),[jt,It,wt,kt,vt.getTime()/6e4|0]),Qs=(0,$e.closedAreasAt)(Gt,mt,Ht,(0,ee.hm)(vt)),Js=[...Qs].join(','),Xs=(0,H.useMemo)(()=>(0,re.floorView)(Nt,It,wt,_t??{},vt,jt.settings.turnMins,Qs),[Nt,It,wt,_t,vt.getTime(),Js]),Zs=(0,De.hoursFor)(jt,vt),el=Zs?.open??new Date(`${Ht}T12:00:00`),tl=Zs?.close??new Date(`${Ht}T21:00:00`),sl=(0,ee.addMins)(el,-el.getMinutes()),ll=(0,ee.addMins)(tl,30),il=e=>new Date(`${Ht}T${e}:00`),nl=(0,$e.blocksOn)(Gt,mt,Ht).map(e=>({from:il(e.from),to:il(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(jt,vt,Ht)),ol=Object.keys(Xs).filter(e=>'blocked'===Xs[e]?.status),al=js&&js!==Ht?js:Ht,rl=al!==Ht,dl=(0,ze.dayWord)(al,Ht),cl=/^(Today|Yesterday|Tomorrow)$/.test(dl),ul=rl?(0,ze.bookingsForDay)(It,al,Ht).sort((e,t)=>e.time.localeCompare(t.time)):Us,hl=(0,ee.parseYmd)(al);hl.setHours(12);const gl=rl?(0,De.hoursFor)(jt,hl):Zs,bl=gl?.open??new Date(`${al}T12:00:00`),yl=gl?.close??new Date(`${al}T21:00:00`),pl=e=>new Date(`${al}T${e}:00`),fl=[...rl?(0,$e.blocksOn)(Gt,mt,al).map(e=>({from:pl(e.from),to:pl(e.to),label:e.reason??'Paused'})):nl,...rl?(0,n.queuedServicePauses)(jt,hl,al):[]],xl=(0,n.queuedServiceSessions)(jt,hl),ml=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),jl=(0,qe.jsxs)(U.default,{testID:"queued-hours-gate",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Y.Muted,{children:i.queuedVenues[mt]?.hours.note})]}),wl=rl?gl||ul.length?alrl?(0,re.dayFloorView)(Nt,ul,al):Xs,[rl,Nt,ul,al,Xs]),[kl,Dl]=(0,H.useState)(null),[Sl,vl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(!1),[Rl,$l]=(0,H.useState)(null),Bl=rl?ul.filter(e=>!['cancelled','noshow'].includes(e.status)):Ks,Wl=Bl.reduce((e,t)=>e+t.partySize,0),Ll=(0,u.coversSplit)(Bl,al),zl=(0,Pe.cancelledDayTally)(It,al),Hl=(0,Me.cancellationsFor)(It,al,e=>e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)','')),Pl=(0,Pe.cancelledTallyWords)(zl,cl?dl.toLowerCase():rl?`on ${dl}`:'today'),Ml=Gt.filter(e=>e.rid===mt&&e.date===al&&!e.removedAt),Al=60*bl.getHours()+bl.getMinutes(),Ol=60*yl.getHours()+yl.getMinutes(),El=(0,Le.chartBands)(Ml,Al,Ol),Nl=(0,Le.seasonClosedAreaIds)(Ml,Al,Ol),_l=Nl.size?{...Nt,areas:Nt.areas.filter(e=>!Nl.has(e.id)),tables:Nt.tables.filter(e=>!Nl.has(e.areaId))}:Nt,Gl=rl?[]:ol.filter(e=>!Nl.has(Nt.tables.find(t=>t.name===e)?.areaId??'')),Fl=new Set((0,Le.blockedHours)(El)),Vl=vt.getHours()+(vt.getMinutes()>=30?1:0),Ul=Ys.hours.filter(e=>e.hour>=Vl&&!Fl.has(e.hour)),Kl=Ul.reduce((e,t)=>e+t.coversHigh,0),ql=Ul.reduce((e,t)=>e+t.coversLow,0),Yl=Math.round((ql+Kl)/2),Ql=!Ys.example&&Ys.open&&Ys.enough&&Kl>0?`Usually ${(0,c.coversRange)(Yl,Yl)} more`:void 0,Jl=async(e,t)=>{const s=Xs[e]?.booking;if(!s||e===t)return;const l=Xs[t]?.status;if(l&&!['free','soon'].includes(l))return void Os('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${re.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(Os,{b:s,tables:[t]}))return;await te.repo.bookings.update(s.id,{table:t});const i=_t?.[e]?.stage;ae.useFloor.getState().setLive(mt,t,{stage:i??'seated',dirty:!1}),ae.useFloor.getState().setLive(mt,e,{stage:void 0,dirty:!0}),Os(`Saving: ${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(s.id,`${(0,fe.privName)(s,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}`,Os)},Xl=e=>{if(xs)return vl(null),void ms(t=>t?{...t,tables:(0,ke.toggleTable)(t.tables,e)}:t);rl?Dl(e):Xt?(e!==Xt&&Jl(Xt,e),Zt(null)):Jt(e)},Zl=xs?It.find(e=>e.id===xs.id):void 0,ei=xs&&Zl?(()=>{const e=Zl.walkIn?(0,fe.privName)(Zl,Ot):tt(Zl.name),t=(0,ke.seatsOf)(Nt,xs.tables).total,s=(0,ke.seatLine)(t,Zl.partySize),l=(0,ke.pickClashes)(Zl,xs.tables,It.filter(e=>e.date===Zl.date),jt.settings.turnMins),i=(0,ke.tableKey)(xs.tables)!==(0,ke.tableKey)((0,ae.tablesOf)(Zl.table));return(0,qe.jsxs)(U.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,qe.jsxs)(U.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Zl.date,Ht)} ${Zl.time}. Tap tables on the plan to add or take them off. ${(0,ke.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Zl.date,Ht)," ",Zl.time]}),(0,qe.jsxs)(Y.T,{size:16,colour:se.colours.text,children:[(0,ke.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Sl?(0,qe.jsx)(U.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Sl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,qe.jsx)(Y.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Sl})}):null,Cl&&Zl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Tl(!1),(async()=>{if(!(0,Ie.guardBookingChange)(Os,{b:Zl,tables:xs.tables}))return vl(null),void ms(null);const s=xs.tables;ms(null),await(0,Ie.saveTablesReported)(mt,Zl,s,e,t,Os)})()},onNo:()=>Tl(!1)}):null,(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.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,ke.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Zl)return void ms(null);if(!(0,Ie.guardBookingChange)(Os,{b:Zl,tables:xs.tables}))return vl(null),void ms(null);const s=(0,ke.overCapacityAsk)(xs.tables,t,Zl.partySize);if(s&&!Sl)return void vl(s);if('finished'===Zl.status&&xs.tables.length&&!Cl)return void Tl(!0);vl(null),Tl(!1);const l=xs.tables;ms(null),await(0,Ie.saveTablesReported)(mt,Zl,l,e,t,Os)}}),(0,qe.jsx)(Y.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{vl(null),ms(null)}})]})]})})():null,ti=_l.areas.filter(e=>_l.tables.some(t=>t.areaId===e.id)),si=e=>{const t=Nt.tables.filter(t=>t.areaId===e);return rl?`${t.filter(e=>!Il[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Xs[e.name]?.status??'free')).length}/${t.length} free`},li='all'===qt||ti.some(e=>e.id===qt)?qt:'all',ii=e=>(0,qe.jsx)(de.FloorCanvas,{plan:_l,areaId:e,mode:"live",fit:"contain",crop:!0,fill:ht,big:!0,view:Il,privacy:Ot,turnBase:jt.settings.turnMins,highlight:xs?xs.tables:Xt?[Xt]:void 0,onTap:e=>Xl(e.name),onDrop:(e,t)=>xs||rl?void 0:Jl(e.name,t.name)}),ni=ct?1:ut||ti.length>2?2:1,oi=e=>{const t=Nt.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},ai=[];for(let e=0;e{const t=(0,de.areaBounds)(Nt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,de.minReadableScale)(Nt,e.id)}}),ft.w,ft.h):null,di=e=>(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',height:ce.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:si(e.id)})]}),ci=(0,qe.jsx)(U.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-ft.w)>1||Math.abs(s-ft.h)>1)&&xt({w:t,h:s})},children:ri?(0,qe.jsx)(V.default,{style:{flex:1},scrollEnabled:ri.scroll,showsVerticalScrollIndicator:ri.scroll,contentContainerStyle:{gap:ce.GRID_GAP},children:ri.rows.map((e,t)=>(0,qe.jsx)(U.default,{style:{height:ri.rowHeights[t],flexDirection:'row',gap:ce.GRID_GAP},children:e.map(e=>{const t=ti.find(t=>t.id===e);return(0,qe.jsxs)(U.default,{testID:`area-cell-${e}`,style:{width:ri.cellW,gap:2},children:[di(t),(0,qe.jsx)(U.default,{style:{flex:1},children:ii(e)})]},e)})},t))}):null}),ui=(0,qe.jsxs)(U.default,{testID:"venue-plan",style:{flex:ct?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:Nt}),Nt.tables.length?null:(0,qe.jsxs)(U.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,qe.jsx)(Y.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Y.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)(Y.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,qe.jsx)(nt,{chipId:"all",compact:!ct,label:"Whole venue",selected:'all'===li,onPress:()=>Yt('all')},"__all"),...ti.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ct,label:`${e.name}${(0,ue.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ct?Qs.has(e.id)?'closed':li===e.id?si(e.id):void 0:void 0,selected:li===e.id,onPress:()=>Yt(e.id)},e.id))];return ct?(0,qe.jsx)(U.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,qe.jsx)(V.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:Ps.view>0&&Ps.content>0&&Ps.content<=Ps.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ps.view>0&&Ps.content<=Ps.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),ei,Xt?(0,qe.jsxs)(Y.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Y.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Xt),": tap the new table."]}),(0,qe.jsx)(Y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Zt(null)})]}):null,'all'===li&&ht?ci:'all'===li?(0,qe.jsx)(U.default,{style:{flex:ct?void 0:1,gap:12,minHeight:gt?void 0:360},children:ai.map((e,t)=>(0,qe.jsxs)(U.default,{style:{flex:ct?void 0:Math.max(.3,...e.map(e=>oi(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(U.default,{style:{flex:1,gap:2},children:[ct?(0,qe.jsxs)(U.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Y.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{center:!0,children:si(e.id)})]}):(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{children:si(e.id)})]}),(0,qe.jsx)(U.default,{style:ct?{height:Math.max(280,Math.round((at-40)*oi(e.id)))}:{flex:1},children:ii(e.id)})]},e.id)),e.length{if(rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},al)}),gi='timeline'===Ft,bi=Ut?(0,qe.jsx)(_.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Kt(!1),supportedOrientations:['landscape','portrait'],children:(0,qe.jsxs)(U.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,qe.jsx)(F.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Kt(!1),style:{minHeight:64,minWidth:at<600?120:180,paddingHorizontal:at<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,qe.jsx)(U.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,qe.jsx)(Y.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${rl?(0,ze.dayLong)(al):'Today'}`})}),at<600?null:(0,qe.jsx)(U.default,{style:{minWidth:180}})]}),ml?jl:(0,qe.jsx)(U.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(be.Timeline,{hideNow:!0,fit:!0,plan:_l,bookings:rl?ul:Us,now:rl?bl:vt,privacy:Ot,turnBase:jt.settings.turnMins,t0:rl?(0,ee.addMins)(bl,-bl.getMinutes()):sl,t1:rl?(0,ee.addMins)(yl,30):ll,pauses:rl?fl:nl,blockedTables:Gl,onOpen:e=>{if(Kt(!1),rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},`full-${al}`)})]})}):null,yi=rl?(0,qe.jsxs)(U.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:cl?`Showing ${dl} \xb7 ${(0,ee.niceDate)((0,ee.parseYmd)(al))}`:`Showing ${(0,ze.dayWord)(al,Ht)}`}),(0,qe.jsx)(U.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Pl}. Showing ${(0,ze.dayLong)(al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Y.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ms(null),Ss(null)},style:{minHeight:44}})]}):null,pi=(0,qe.jsx)(U.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:ct?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(gi||Ut);return(0,qe.jsx)(F.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?(Vt('plan'),Kt(!0)):(Kt(!1),Vt('plan'))},style:{flex:ct?1:void 0,minHeight:ct?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',...Ne.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)(Y.T,{size:ct?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),fi='display'===k.APP_VARIANT&&!e,xi='display'===k.APP_VARIANT&&!e,mi=!e&&!k.IS_CAR&&!ct,ji=fi?(0,qe.jsxs)(U.default,{testID:"display-view-row",style:{flexDirection:ct?'column':'row',flexWrap:ct||mi?'nowrap':'wrap',gap:6,alignItems:ct||mi?'stretch':'center'},children:[pi,(0,qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ct,fill:mi,shifts:Rt,staff:Ct,today:Ht,leave:$t})]}):pi,wi=(0,h.useBookingWrite)(),Ii=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Walk-in",onPress:Mt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"New booking",onPress:Mt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint})]});(0,Ke.useDisplayNotices)(mt,!e);const ki=!e&&!k.IS_CAR&&!ct,Di=ct?180:202,[Si,vi]=(0,H.useState)(ct?180:168),Ci=P.default.useRef(ct?180:168),Ti=P.default.useRef(null),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(!1),[Wi,Li]=(0,H.useState)(!1),zi=!ct&&dt<=800,Hi=We.DAY_GRAPH_CHROME+(zi?24:8),Pi=P.default.useRef(0),[Mi,Ai]=(0,H.useState)(Hi),[Oi,Ei]=(0,H.useState)(!0),[Ni,Gi]=(0,H.useState)(!1);P.default.useEffect(()=>{Gi(!1)},[at,dt]);const Fi=P.default.useRef(()=>{}),Vi=P.default.useCallback(e=>{Math.abs(e-Pi.current)>=2&&(Pi.current=e,setTimeout(()=>Fi.current(),0))},[]),Ui=()=>{const e=Ti.current,t=Ri.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=t>Ci.current?Math.ceil(t-Ci.current):0,o=ki?Math.max(Hi,Pi.current):Math.max(Hi,n);ki&&o!==Mi&&Ai(o);const a=!ct&&dt>=700?140:70,r=Math.floor(s-4-e)-o-l,d=i>0&&r-i>=a;ki&&d!==Oi&&Ei(d),ki&&!Ni&&r<48&&Gi(!0);const c=r-(d?i:0),u=Math.min(Di,c>=a?Math.max(a,c):Math.max(0,c));Math.abs(Ci.current-u)>=2&&(Ci.current=u,vi(u))},l=44+(dt<820?4:8),i=46+(dt<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=$i.current;ki&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=dt<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Bi.current?44+d:0)}):s(n,a,t,ki?i:l)})})};Fi.current=Ui,P.default.useEffect(()=>{const e=setTimeout(()=>Fi.current(),60),t=setTimeout(()=>Fi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[at,dt,al]);const Ki=(0,qe.jsxs)(U.default,{ref:Ri,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ui()},style:{flexDirection:'row',flexWrap:at>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ct?12:zi?2:6,justifyContent:ct?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ue.DisplayClockButton,{}),(0,qe.jsx)(ge.HoldToEdit,{quiet:!0,onUnlock:()=>{Fs(null),Ns({at:Date.now()})},onHint:()=>Os('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(Be.BlockBookingsButton,{rid:mt,r:jt,now:vt,by:Lt,quiet:!0,display:!0,day:al}),Nt.areas.some(e=>e.outdoor)?(0,qe.jsx)(Be.CloseGardenButton,{rid:mt,r:jt,now:vt,by:Lt,quiet:!0,short:!0}):null,(0,qe.jsx)(F.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Hs(!0),style:({pressed:e})=>({...Ne.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,qe.jsx)(f.GiftQrButton,{rid:mt,venue:jt.name})]}),qi=qs.length?(0,qe.jsxs)(U.default,{testID:"takeaway-panel",style:[Ne.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Y.T,{size:12,colour:se.colours.muted,children:[qs.length," live"]})]}),(0,qe.jsx)(U.default,{style:{padding:10},children:(0,qe.jsx)(ot,{list:qs,me:Lt,compact:!0,bookings:It})})]}):null,Yi=(Oe.DueToday,jt.settings.turnMins||90),Qi=rl?ul:(0,S.todaysGuestList)(Us,vt,Yi),Ji=rl?[]:(0,S.todaysFinishedList)(Us,vt,Yi),Xi=rl?cl?`${dl}\u2019s guests`:`Guests ${dl}`:'Today\u2019s guests',Zi=(0,qe.jsxs)(qe.Fragment,{children:[0===Qi.length?(0,qe.jsx)(Y.Muted,{children:rl?al{const t=(0,S.isLeftEarly)(e,vt,Yi),s=(0,le.isSeatedHighlight)(e.status,{otherDay:rl})&&!t,l=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=se.colours.text,n=s?se.colours.goldLight:se.colours.muted,o=se.colours.gold,a=l.depositWarn?se.colours.amber:se.colours.goldLight;return(0,qe.jsxs)(F.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:rl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,le.seatedHighlightStyle)({backgroundColor:e?Qe:Ye,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,qe.jsx)(Y.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)(U.default,{style:{paddingTop:2},children:(0,qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,qe.jsx)(Y.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,qe.jsx)(Y.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&re.OCCASION_ICON[l.occasion]?(0,qe.jsx)(Y.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:re.OCCASION_ICON[l.occasion]}):null]}),(0,qe.jsxs)(Y.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Y.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}),(0,qe.jsx)(Y.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,qe.jsx)(Y.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(U.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(me.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,qe.jsx)(Y.T,{size:15,colour:se.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),Ji.length?(0,qe.jsxs)(U.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(F.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ji.length}${bs?', expanded':', collapsed'}`,accessibilityState:{expanded:bs},onPress:()=>ys(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Y.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ji.length,")"]}),(0,qe.jsx)(Y.T,{size:16,colour:se.colours.muted,children:bs?'\u25be':'\u25b8'})]}),bs?Ji.map(e=>{const t=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,qe.jsxs)(F.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Y.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Y.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,qe.jsx)(U.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,qe.jsx)(v.BookingUndo,{b:e,rid:mt,today:Ht,who:t.name,allowed:wi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ae.CancellationsSection,{items:Hl,dayWord:rl?cl?dl.toLowerCase():`on ${dl}`:'today'})]}),en=(0,qe.jsx)(V.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Zi}),tn=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&gs(!1)}}),sn=(0,qe.jsxs)(F.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Xi}, ${Qi.length}`,accessibilityState:{expanded:hs},'aria-expanded':hs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>gs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:hs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:hs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Y.T,{size:16,weight:"bold",colour:se.colours.gold,children:Qi.length}),(0,qe.jsx)(U.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(U.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,qe.jsxs)(Y.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Xi," ",hs?'\u2039':'\u203a']})})})]}),ln=Math.min(560,Math.max(320,.44*at))<400,nn=hs?(0,qe.jsxs)(U.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,qe.jsxs)(U.default,{testID:"guests-drawer",...tn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*at)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,...Ne.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,qe.jsxs)(U.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,qe.jsxs)(U.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsxs)(U.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,qe.jsxs)(Y.T,{testID:"guests-heading",size:ln?14:17,weight:"semibold",colour:se.colours.gold,style:{flexShrink:1,minWidth:0},children:[Xi.toUpperCase()," (",Qi.length,")"]}),(0,qe.jsx)(F.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:cs},'aria-expanded':cs,onPress:()=>us(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:ln?8:12,borderRadius:12,borderWidth:1,borderColor:cs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?se.colours.tilePressed:cs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:se.colours.goldLight,children:[ln?'Key':'Guest key'," ",cs?'\u25b4':'\u25be']})})]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Xi}`,onPress:()=>gs(!1),style:{marginRight:-6,flexShrink:0}})]}),zl.count?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Pl}):null,cs?(0,qe.jsxs)(U.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:se.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,qe.jsxs)(U.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:se.colours.amber,ink:se.colours.bg}),(0,qe.jsx)(Y.T,{size:14,children:"allergy"})]}),(0,qe.jsxs)(U.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(me.DogIcon,{size:18}),(0,qe.jsx)(Y.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,qe.jsxs)(U.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(Y.T,{size:16,children:e}),(0,qe.jsx)(Y.T,{size:14,children:t})]},t))]}):null]}),en]}),(0,qe.jsx)(F.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Xi}`,accessibilityRole:"button",onPress:()=>gs(!1),style:{flex:1}})]}):null,on=ml?jl:l.IS_KIRKTON&&!Object.values(jt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(U.default,{testID:"kirkton-hours-to-confirm",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Y.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(jt,It,vt).busy,todays:ul,open:bl,close:yl,now:vt,turnBase:jt.settings.turnMins,blocks:Ml,pauses:fl,compact:ct,dense:!ct,fit:ht,tight:ht&&dt<=600,height:ht?Si:Di,forecastNote:rl?void 0:Ql,emptyText:wl,past:al{Ds.current=Date.now(),ks(!0)},shortDay:!ct&&at<1100}),dn=(0,qe.jsx)(He.DisplayCalendar,{visible:Is,today:Ht,day:al,bookings:It,restaurant:jt,now:vt,onDay:Ss,onClose:()=>ks(!1)}),cn=()=>{rl?gs(!0):Kt(!0)},un=(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',padding:zi?4:dt<820?8:12,paddingTop:zi?ki?2:4:dt<820?ki?4:6:ki?8:10,gap:zi?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:yi,Pt?(0,qe.jsx)(V.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"})}):gi?hi:ui,bi,nn]}),(0,qe.jsxs)(U.default,{testID:"display-side",style:{width:bt,gap:dt<820?4:8,minHeight:0},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Ii(!1)}),(0,qe.jsx)(U.default,{style:{flexShrink:0},children:ji}),Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",onLayout:Ui,style:ki&&!Ni?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:dt<820,snug:dt<820,tight:dt<800,fill:ki&&!Ni,sound:(0,O.flapSoundOn)(),onPress:cn})}),Pt?null:(0,qe.jsx)(U.default,{ref:Ti,testID:"day-graph-slot",onLayout:Ui,style:{flexGrow:0,flexShrink:ki?0:1,flexBasis:(ct?Di:Si)+(ki?Mi:Hi),height:(ct?Di:Si)+(ki?Mi:Hi),minHeight:dt<=600?90:Math.min((ct?Di:Si)+We.DAY_GRAPH_CHROME,!ct&&dt>=768?140+We.DAY_GRAPH_CHROME:120),overflow:'visible'},children:an}),ki&&!Pt?(0,qe.jsx)(U.default,{ref:$i,testID:"display-side-split",onLayout:Ui,style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})}):null,(0,qe.jsxs)(V.default,{testID:"display-side-scroll",style:ki?{flexGrow:0,flexShrink:1,minHeight:Wi&&Oi?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Bi.current&&(Bi.current=s,Li(s),setTimeout(Ui,0))},children:[ki||xi?null:(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),qi,(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt})]})]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Ds.current=Date.now()},onMouseDown:()=>{Ds.current=Date.now()},children:[ct?(0,qe.jsx)(U.default,{style:{flex:1},children:(0,qe.jsxs)(V.default,{ref:yt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,qe.jsxs)(U.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,qe.jsx)(U.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,qe.jsx)(j.ExitButton,{})}),(0,qe.jsx)(X.RestaurantLogo,{rid:mt,size:64}),(0,qe.jsx)(Y.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:jt.name}),(0,qe.jsx)(X.PoweredBy,{}),(0,qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(U.default,{accessible:!0,accessibilityLabel:`Current time ${(0,ee.hm)(vt)}`,children:(0,qe.jsx)(Y.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,ee.hm)(vt)})}),(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:"m"}),(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",size:"m"}),Z]}),Fe,k.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:mt}),rn,(0,qe.jsx)(U.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(it,{phone:!0,split:Ll,items:[{label:`Tables \xb7 ${dl}`,value:Bl.length,testID:'badge-tables'},{label:`Covers \xb7 ${dl}`,value:Wl,testID:'badge-covers'},{label:'Takeaway',value:qs.length,alert:qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ls(!0)}]})}),(0,qe.jsx)(U.default,{testID:"primary-actions",style:{gap:8},children:Ii(!0)}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt}),ji,(0,qe.jsxs)(U.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[gi?hi:ui,bi]}),(0,qe.jsxs)(U.default,{onLayout:e=>{pt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ne.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Y.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Xi," (",Qi.length,")"]}),(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{gap:4},children:Zi})]}),qi,an,(0,qe.jsx)(U.default,{testID:"covers-dock",children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>yt.current?.scrollTo({y:pt.current,animated:!0})})}),(0,qe.jsxs)(U.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,qe.jsx)(Y.T,{center:!0,size:14,colour:Ot?se.colours.muted:se.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Y.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Rs(!0),style:{minHeight:48,alignSelf:'stretch'}}),xi?null:(0,qe.jsx)(Y.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ki]})}):(0,qe.jsxs)(qe.Fragment,{children:[ki?(0,qe.jsx)(U.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:se.colours.hairline},children:(0,qe.jsx)(U.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)(U.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,paddingVertical:zi?2:dt<820?4:8,gap:8,minHeight:zi&&ki?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ne.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(U.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:ki?16:8,minWidth:0,overflow:'hidden',...ki?{justifyContent:'flex-start'}:null},children:[(0,qe.jsx)(U.default,{testID:"display-header-brand",style:ki?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(X.RestaurantBrand,{rid:jt.id,size:at<900?32:40,beside:!0,noLogo:ki})}),(0,qe.jsxs)(U.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Y.T,{size:at<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,ee.hm)(vt)}),at>=900?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:(0,ee.niceDate)(vt)}):null]})]}),Pt?(0,qe.jsx)(U.default,{style:{width:220}}):(0,qe.jsx)(U.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:rn}),(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,qe.jsxs)(U.default,{testID:"display-header-chips",style:{flexDirection:at>=1400||ki?'row':'column',alignItems:at>=1400||ki?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:at<1240?'xs':at<1280||dt<700?'s':'m'}),Pt?null:(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",slot:ki,size:at<1340?'xs':at<1400||dt<700?'s':'m'})]}),'simulated'===St?(0,qe.jsx)(F.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>Dt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,Z,e?null:(0,qe.jsx)(U.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(j.ExitButton,{size:44})})]})]}),Fe,k.IS_CAR||!Pt||ki?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:mt,margin:{marginHorizontal:12,marginTop:6}}),Pt||ki?null:(0,qe.jsx)(U.default,{testID:"display-day-stats",style:Xe,children:(0,qe.jsxs)(U.default,{style:Ze,children:[k.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(U.default,{style:et,children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})})]})}),ht?un:(hn=(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{testID:"front-door-bar",style:{gap:10},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Ii(!1)}),ji]}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt}),Pt?(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"}):(0,qe.jsx)(qe.Fragment,{children:(0,qe.jsxs)(U.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[yi,gi?hi:ui,bi,nn]})]})}),qi,Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,sound:(0,O.flapSoundOn)(),onPress:cn})}),Pt?null:(0,qe.jsx)(U.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Di+We.DAY_GRAPH_CHROME},children:an})]}),(0,qe.jsx)(V.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:hn})),Ki]}),(0,qe.jsx)($.SoldOutStrip,{rid:mt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:zs,onClose:()=>Hs(!1),rid:mt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:mt}),Mt.elements,is?(0,qe.jsx)(y.EditBookingPicker,{rid:mt,today:Ht,who:Lt,onClose:()=>ns(!1)}):null,os?(0,qe.jsx)(y.EditBookingSheet,{rid:mt,id:os,who:Lt,onClose:()=>as(null)}):null,Qt?(0,qe.jsx)(Se.TableSheet,{rid:mt,name:Qt,view:Xs,plan:Nt,todays:Us,now:vt,privacy:Ot,turnBase:jt.settings.turnMins,onClose:()=>Jt(null),onWalkIn:e=>Mt.openWalkInAt(e),onMove:e=>Zt(e),onDetails:Vs}):null,kl?(()=>{const e=Il[kl],t=e?.dayBookings??[];return(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>{$l(null),Dl(null)},title:`${(0,d.tableNumbersA11y)(kl)} \xb7 ${cl?dl:(0,ze.dayLong)(al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Y.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${cl?dl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${cl?dl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Ot):tt(e.name);return(0,qe.jsx)(Y.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,ke.tablesWords)((0,ae.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Dl(null),fs(e.id)},style:{minHeight:56}},e.id)}),al>=Ht?(()=>{const t=e?.table.maxSeats??0,s=It.filter(e=>e.date===al&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,ae.tablesOf)(e.table).includes(kl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,qe.jsxs)(U.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(kl)]}),Rl?(0,qe.jsxs)(U.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Rl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Rl.ask}),(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!wi.ok,accessibilityHint:wi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Rl.id);if($l(null),!e)return;const s=tt(e.name);Dl(null),await(0,Ie.saveTablesReported)(mt,e,[kl],s,t,Os)}}),(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>$l(null)})]})]}):null,Rl?null:s.slice(0,12).map(e=>{const s=tt(e.name),l=e.partySize>t;return(0,qe.jsx)(Y.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:!wi.ok,accessibilityHint:wi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(kl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(Os,{b:e,tables:[kl]}))return;const l=(0,ke.overCapacityAsk)([kl],t,e.partySize);l?$l({id:e.id,ask:l}):(Dl(null),await(0,Ie.saveTablesReported)(mt,e,[kl],s,t,Os))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Y.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{$l(null),Dl(null)},style:{minHeight:56}})]})})():null,ps?(()=>{const e=It.find(e=>e.id===ps);return e?(0,qe.jsx)(je.GuestActionsSheet,{rid:mt,b:e,name:e.walkIn?(0,fe.privName)(e,Ot):tt(e.name),view:Xs,now:vt,otherDay:e.date!==Ht,turnBase:jt.settings.turnMins,onClose:()=>fs(null),onDetails:Vs,onDone:Os,onEdit:e=>{fs(null),as(e.id)},onPickOnPlan:(e,t)=>{gs(!1),Vt('plan'),Yt('all'),ms({id:e.id,tables:t})}}):null})():null,es?(0,qe.jsx)(Se.DetailsPanel,{title:es.title,onClose:()=>ts(null),children:es.body}):null,dn,rs?(0,qe.jsx)(Se.ServiceSummary,{r:jt,todays:Us,orders:wt,waitlistAll:vs,walkInCount:Cs,onClose:()=>ds(!1)}):null,Ts?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Rs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsxs)(U.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:se.colours.amber,ink:se.colours.bg}),(0,qe.jsx)(Y.T,{size:14,children:"allergy"})]}),(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(me.DogIcon,{size:18}),(0,qe.jsx)(Y.T,{size:14,children:"dog"})]}),(0,qe.jsx)(Y.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Rs(!1)})]}):null,Ws?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ls(!1),Bs(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,$s?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(Q.ReviewsSection,{rid:mt,mode:"read",venueName:jt.name}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,ss?(0,qe.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>ls(!1),children:[(0,qe.jsx)(Y.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(ot,{list:qs,me:Lt,bookings:It})]}):null,Es?(0,qe.jsx)(U.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,qe.jsx)(he.PlanDesigner,{initial:Nt,venue:jt.name,mode:"display",startStep:"arrange",onActivity:()=>{_s.current=Date.now(),null!==Gs&&Fs(null)},notice:null!==Gs?`Locking again in ${Gs} s \xb7 touch to keep editing`:null,onSave:e=>{ae.useFloor.getState().setPlan(mt,e),Ns(null),Os('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{ae.useFloor.getState().setPlan(mt,e),Os('Live seating plan updated on every screen.')},onCancel:()=>{Ns(null),Os('No changes kept. Editing is locked again.')}},Es.at)}):null,e?null:(0,qe.jsx)(ye.Screensaver,{rid:mt,idleMins:At.idleMins,pinOn:At.pinOn,wake:At,tonightCards:At.tonightCards,cfg:Et}),e?null:(0,qe.jsx)(Ce.PrintHost,{rid:mt}),e?null:(0,qe.jsx)(ve.AlertHost,{variant:"display",rid:mt,skipTakeaway:!0}),e?null:(0,qe.jsx)(E.SeatAllergenReminder,{rid:mt}),e?null:(0,qe.jsx)(Te.TakeawayTakeover,{rid:mt,me:Lt})]});var hn}function rt({rid:e,id:t,turnBase:s}){const l=(0,te.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1336,[1051,779,805,806,1337,813,1338,1092,843,1138,1339,1340,1341,1089,1120,1342,1343,1348,1349,1206,1350,856,1355,1356,1357,1113,1111,920,1358,1150,891,1102,1359,17,1070,1182,1016,1085,1360,378,363,385,278,85,409,19,777,1237,1241,857,845,863,858,804,1088,876,1096,1055,996,1074,1107,1361,1106,1362,1369,1371,1374,1379,1373,1380,1383,1384,1115,1093,1094,862,1389,1226,1390,1236,1228,993,1395,1400,1401,1052,1050,1117,1403,1404,1405,1069,1169,1406,1168,1159,853,1351,1407,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},1339,[]); @@ -1437,7 +1437,7 @@ __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(t,c){return}},1354,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.displayActionBy=function(t){if(t.isCar)return'Car';if(t.isDisplayApp)return'Display';return(t.personName??'').trim()||'Duty Manager'}},1355,[]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"finishClearPatch",{enumerable:!0,get:function(){return s.finishClearPatch}}),Object.defineProperty(e,"DEFAULT_TURN_MINS",{enumerable:!0,get:function(){return a}}),e.bookingEndAt=u,e.isLeftEarly=o,e.todaysGuestList=function(t,n,s=a){return t.filter(t=>'confirmed'===t.status||'seated'===t.status||o(t,n,s)).sort((t,n)=>t.time.localeCompare(n.time))},e.todaysFinishedList=function(t,n,s=a){return t.filter(t=>'finished'===t.status&&!o(t,n,s)).sort((t,n)=>t.time.localeCompare(n.time))};var t=r(d[0]),n=r(d[1]),s=r(d[2]);const a=90;function u(s,u=a){if(!s.date||!s.time)return null;const o=(0,n.atTime)((0,n.parseYmd)(s.date),s.time),f=u>0?u:a,c=s.durationMins&&s.durationMins>=15?s.durationMins:(0,t.turnFor)(s.partySize??2,f);return new Date(o.getTime()+6e4*c)}function o(t,s,o=a){if('finished'!==t.status||!t.date||!t.time||!t.finishedAt)return!1;const f=(0,n.atTime)((0,n.parseYmd)(t.date),t.time);if(new Date(t.finishedAt).getTime()>=f.getTime())return!1;const c=u(t,o);return!!c&&(s??new Date).getTime()1?'are':'is'} free again`:'',"."]}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${$}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>I(t,e,{stage:void 0,dirty:!1})),j(!1)}}),(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${$} seated`,onPress:()=>j(!1)})]})]}):(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${$}: ${e.walkIn?'removes the walk-in':'back to booked'}${v?`, frees ${v}`:''}`,onPress:()=>j(!0)});const L='undo-finished'===x?'seated':'confirmed';return(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===x?`Undo finished: ${$} back to seated${v?` at ${v}`:''}`:`Undo no-show: ${$} back to booked`,onPress:async()=>{'undo-finished'!==x?await n.repo.bookings.setStatus(e.id,L):await(0,b.undoFinishedNow)(t,e)}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),h=r(d[7]),f=r(d[8]);function k(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1357,[17,85,858,996,777,804,1112,1111,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=k,_e.BookingUndo=function({b:e,rid:t,today:w,who:$,allowed:y=!0}){const[p,j]=(0,s.useState)(!1),x=k(e,w);if(!x||!y)return null;const U=(0,h.tableForUndo)(e),v=(0,l.tableCardLabel)(U),I=l.useFloor.getState().setLive;if('unseat'===x)return p?(0,f.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,f.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",$,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',v?` and ${v} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${$}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>I(t,e,{stage:void 0,dirty:!1})),j(!1)}}),(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${$} seated`,onPress:()=>j(!1)})]})]}):(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${$}: ${e.walkIn?'removes the walk-in':'back to booked'}${v?`, frees ${v}`:''}`,onPress:()=>j(!0)});const L='undo-finished'===x?'seated':'confirmed';return(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===x?`Undo finished: ${$} back to seated${v?` at ${v}`:''}`:`Undo no-show: ${$} back to booked`,onPress:async()=>{'undo-finished'!==x?await n.repo.bookings.setStatus(e.id,L):await(0,b.undoFinishedNow)(t,e)}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),h=r(d[7]),f=r(d[8]);function k(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1357,[17,85,858,996,777,804,1113,1111,8]); __d(function(g,r,i,a,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},1358,[813,812,17,219,385,278,85,777,1150,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])},1359,[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])},1360,[17,85,780,804,8]); @@ -1460,16 +1460,16 @@ __d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?global __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||'')}},1377,[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},1379,[17,831,928,899,1378]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=$,e.guestRowText=function(n,p){const l=n.partySize,b=Math.max(0,Math.min(l-1,Math.round(Number(n.children)||0))),f=`${l} ${1===l?'person':'people'}${b?` (${b} ${1===b?'child':'children'})`:''}`,h=(0,o.tablesOf)(n.table??void 0),c=h.length?`${p.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',w=p.leftEarly?"Left early"+(c?` \xb7 ${c}`:''):p.finished?"Finished"+(c?` \xb7 ${c}`:''):p.seated?"Seated"+(c?` \xb7 ${c}`:''):c||'No table yet',x=$(n),y=h.length?`table${h.length>1?'s':''} ${u(h.map(t.plainTableNumber))}`:p.finished?'finished':'no table yet',D=!!n.dog,m=(0,s.allergyLine)(n),k=(0,d.guestChangeLine)(n),v=[n.time,p.name,m?`allergy noted: ${m}`:'',f,p.leftEarly?'left early':p.finished?'finished':p.seated?'seated':'',x?.spoken??'',y,D?'dog':''].filter(Boolean).join(', ')+'.'+(k?` ${k}`:'');return{time:n.time,name:p.name,people:f,deposit:x?.text??null,depositWarn:!!x?.warn,table:w,dog:D,allergy:m,guestChange:k,a11y:v}};var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),s=r(_d[3]),d=r(_d[4]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,l=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 o=(0,n.depositBadge)(t,p);if(!o)return null;const s=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||d>0&&u>d&&!o.label.startsWith('Deposit paid')){const t=d||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${l(t).replace(' pounds','')} of ${l(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(o.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const $=o.label.match(/\xa3[\d.,]+/);if(o.label.startsWith('Deposit paid')){const t=/about/.test(o.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(o.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(o.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}}},1380,[843,841,996,1381,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}}},1380,[843,841,996,1381,1382]); __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])},1381,[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}},1382,[]); __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])},1383,[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'},1384,[1385,843,1093,996,17,85,777,1096,858,1113,1380,1094,863,1091,1114,1115,1116,804,1340,1387,1388,1112,1357,1111,8]); +__d(function(_g,r,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'},1384,[1385,843,1093,996,17,85,777,1096,858,1114,1380,1094,863,1091,1115,1116,1117,804,1340,1387,1388,1113,1357,1111,8]); __d(function(g,r,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])},1385,[17,362,385,85,858,920,876,994,1386,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')}`}},1386,[]); __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},1389,[1169,1385,813,1093,812,843,1138,1089,1114,863,17,1076,219,385,278,85,777,1096,1373,858,996,845,1087,1074,1318,804,1340,1387,1388,1112,1111,8]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"Card",{enumerable:!0,get:function(){return M}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const l=e.filter(e=>'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},1389,[1169,1385,813,1093,812,843,1138,1089,1115,863,17,1076,219,385,278,85,777,1096,1373,858,996,845,1087,1074,1318,804,1340,1387,1388,1113,1111,8]); __d(function(g,_r,_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.']}]},1390,[812,17,219,385,85,777,858,996,1391,804,1392,1394,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))},1391,[]); __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)}},1392,[831,858,996,1391,1393,1394]); @@ -1495,7 +1495,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1412,[13,17,1413,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])},1413,[17,856,1414,1555,8]); __d(function(g,_r,i,_a,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,{})]})}},1414,[805,813,899,1190,1224,1206,1026,1023,891,1024,880,1030,1085,17,356,378,385,278,409,85,19,777,857,858,876,804,1415,1181,1055,884,1423,920,219,1428,1468,839,856,1470,1477,1478,1479,1187,1242,1480,1454,1481,1483,1452,1158,1226,1390,1228,1241,1485,1082,1084,1551,1552,1571,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])},1415,[805,1416,1093,1266,1417,812,822,1114,1115,1089,1119,1418,1120,1116,1403,1404,1055,1340,994,1117,1087,841,1382,1123,1420,1237,1421,1395,1076,1053,1088,17,85,777,1360,858,845,851,863,1318,804,1181,1096,1112,996,1357,1060,1159,1422,1228,899,1183,1400,862,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1415,[805,1416,1093,1266,1417,812,822,1115,1116,1089,1120,1418,1112,1117,1403,1404,1055,1340,994,1118,1087,841,1382,1123,1420,1237,1421,1395,1076,1053,1088,17,85,777,1360,858,845,851,863,1318,804,1181,1096,1113,996,1357,1060,1159,1422,1228,899,1183,1400,862,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.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])},1417,[806,17,85,777,899,1270,8]); __d(function(g,r,_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])},1418,[17,385,85,1419,899,928,804,777,8]); @@ -1508,7 +1508,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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])},1425,[17,278,85,777,857,804,1426,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(' ')},1426,[]); __d(function(g,_r,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]})}},1427,[888,813,17,1067,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,{}),'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%'}}),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,(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}})]})]})]})})}},1428,[843,1138,1429,17,780,1182,1072,1073,1421,1340,861,1076,264,385,85,777,858,876,1207,1190,845,1157,863,1053,866,804,1181,1055,1137,1142,1143,1006,839,1147,886,899,915,1439,1440,1146,1441,1159,853,1444,1185,1205,856,1204,1029,1030,1064,1096,1395,1150,1339,1462,8]); +__d(function(g,_r,_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}})]})]})]})})}},1428,[843,1138,1429,17,780,1182,1072,1073,1421,1340,861,1076,264,385,85,777,858,876,1207,1190,845,1157,863,1053,866,804,1181,1055,1137,1142,1143,1006,839,1147,886,899,915,1439,1440,1146,1441,1159,853,1444,1185,1205,856,1204,1029,1030,1064,1096,1395,1150,1339,1462,8]); __d(function(_g,_r,_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."})]})}},1429,[1051,1031,805,1416,812,1430,1431,1433,1434,1435,1200,1029,1030,1006,1012,17,385,85,777,841,1436,816,862,1053,861,804,1055,858,1184,926,927,876,1437,1390,996,1438,1003,1140,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)},1430,[812,17,85,777,1138,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)},1431,[843,17,219,85,777,858,996,1151,1259,899,1334,1432,8]); @@ -1558,12 +1558,12 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ThingsToHaveReady=function({onOpenTablePlan:e}){return(0,h.jsxs)(s.default,{testID:"onboard-ready",style:{width:'100%',alignItems:'center',gap:14},children:[b('Things to have ready'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Gather these before you check the questionnaire. Nothing here is sent."}),d.READY_ITEMS.map((t,a)=>(0,h.jsxs)(s.default,{testID:`ready-item-${a+1}`,accessible:!0,accessibilityLabel:t,style:{width:'100%',alignItems:'center',gap:6,minHeight:48},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:"\u2713"}),(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:t}),0===a&&e?(0,h.jsx)(n.Button,{kind:"ghost",label:"Open the table plan",accessibilityLabel:"Open the table plan to add a drawing or picture",onPress:e}):null]},t))]})},_e.QuestionnaireAnswers=function({q:e,rid:t,onEdit:y}){const E=(0,i.usePlan)(t),j=(0,a.useMenu)(t),f=(0,l.useAccounts)(e=>e.byVenue[t])??p,x=(E.areas??[]).map(e=>{const t=(0,o.planCounts)(E,e.id);return t.tables?`${e.name}: ${t.tables} ${1===t.tables?'table':'tables'}, ${t.seats} Covers`:e.name}),$=x.length?x:(e.tables.areas??[]).map(e=>e);(e.tables.tables||e.tables.covers)&&$.unshift([e.tables.tables?`${e.tables.tables} tables`:'',e.tables.covers?`${e.tables.covers} Covers`:''].filter(Boolean).join(', '));const w=c.WEEK_ORDER.map(t=>`${c.DAY_NAMES[t]}: ${e.hours.days[t]?`${e.hours.days[t][0]} to ${e.hours.days[t][1]}`:'Closed'}`),D=e.team.map(e=>{const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff',s=e.job&&e.job.trim().toLowerCase()!==t.toLowerCase()?e.job.trim():'';return[e.name,s,t].filter(Boolean).join(', ')}),v=e.suppliers.map(e=>[e.name,e.category,e.phone,e.email].filter(Boolean).join(', ')),I=f.filter(e=>e.accountNo).map(e=>`${e.customName||e.provider}: ${e.accountNo}`),L=e.pay?["Tips "+('fortnightly'===e.pay.tipsFrequency?'every two weeks':'weekly'===e.pay.tipsFrequency?'every week':'monthly'),e.pay.tipsAnchorPayday?`Next tips payday anchor ${e.pay.tipsAnchorPayday}`:'',e.pay.wagePayDay?`Wages on day ${e.pay.wagePayDay}`:''].filter(Boolean):[],T=j.filter(e=>Object.keys(e.allergens??{}).length).length,q=j.length?[`${j.length} ${1===j.length?'dish':'dishes'} on the menu`]:[],N=j.length?[T?`Recorded on ${T} ${1===T?'dish':'dishes'}`:d.NOT_ANSWERED]:[],_=[e.venue.name,e.venue.tagline,e.venue.address,e.venue.phone,e.venue.email,e.venue.website].filter(e=>!!e&&''!==e.trim());return(0,h.jsxs)(s.default,{testID:"onboard-questionnaire",style:{width:'100%',alignItems:'center',gap:4},children:[b('Your questionnaire'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Tap a section to edit it. Blank answers stay blank."}),(0,h.jsx)(m,{testID:"q-venue",title:"Venue",lines:_,onEdit:()=>y('venue'),editLabel:"Edit venue"}),(0,h.jsx)(m,{testID:"q-hours",title:"Opening hours",lines:w,onEdit:()=>y('hours'),editLabel:"Edit opening hours"}),(0,h.jsx)(m,{testID:"q-tables",title:"Table plan",lines:$,onEdit:()=>y('tables'),editLabel:"Edit table plan"}),(0,h.jsx)(m,{testID:"q-team",title:"Staff and roles",lines:D,onEdit:()=>y('team'),editLabel:"Edit staff and roles"}),(0,h.jsx)(m,{testID:"q-pay",title:"Pay and tips dates",lines:L,onEdit:()=>y('pay'),editLabel:"Edit pay and tips"}),(0,h.jsx)(m,{testID:"q-suppliers",title:"Suppliers",lines:v,onEdit:()=>y('suppliers'),editLabel:"Edit suppliers"}),(0,h.jsx)(m,{testID:"q-accounts",title:"Supplier account numbers",lines:I,onEdit:()=>y('accounts'),editLabel:"Edit account numbers"}),(0,h.jsx)(m,{testID:"q-logo",title:"Logo",lines:e.venue.hasLogo?['Logo added']:[],onEdit:()=>y('branding'),editLabel:"Edit logo"}),(0,h.jsx)(m,{testID:"q-menu",title:"Menu",lines:q,onEdit:()=>y('menu'),editLabel:"Edit menu"}),(0,h.jsx)(m,{testID:"q-allergens",title:"Allergens",lines:N,onEdit:()=>y('menu'),editLabel:"Edit allergens"}),(0,h.jsx)(m,{testID:"q-cashup",title:"What to record at nightly cash up",lines:e.cashUp??[],onEdit:()=>y('cashup'),editLabel:"Edit cash up"})]})},r(_d[0]);var t=e(r(_d[1])),s=e(r(_d[2])),n=r(_d[3]),a=r(_d[4]),l=r(_d[5]),i=r(_d[6]),o=r(_d[7]),d=r(_d[8]),c=r(_d[9]),u=r(_d[10]),h=r(_d[11]);const p=[],b=e=>(0,h.jsx)(n.T,{accessibilityRole:"header",center:!0,size:22,weight:"bold",colour:u.colours.gold,style:{width:'100%'},children:e});const y=e=>e.replace(/([@.])/g,'$1\u200b');function m({testID:e,title:s,lines:a,onEdit:l,editLabel:i}){const o=a.length?a.join('. '):d.NOT_ANSWERED;return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"button",accessibilityLabel:`${s}. ${o}. ${i}.`,onPress:l,style:{width:'100%',minHeight:48,alignItems:'center',gap:4,paddingVertical:10,paddingHorizontal:8,borderTopWidth:1,borderColor:u.colours.border},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:s}),(a.length?a:[d.NOT_ANSWERED]).map((e,t)=>(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:y(e)},`${s}-${t}`)),(0,h.jsx)(n.T,{center:!0,size:14,colour:u.colours.gold,children:i})]})}},1475,[17,385,85,777,860,1474,996,842,1476,1471,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'},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}),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}},1477,[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])},1478,[1182,1070,1114,1087,17,385,85,777,876,863,804,1088,1168,1165,1055,1117,1179,1441,1159,860,1183,853,1181,884,1357,996,843,1112,1196,1203,1069,8]); +__d(function(g,_r,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])},1478,[1182,1070,1115,1087,17,385,85,777,876,863,804,1088,1168,1165,1055,1118,1179,1441,1159,860,1183,853,1181,884,1357,996,843,1113,1196,1203,1069,8]); __d(function(g,_r,_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']}},1479,[17,1053,85,409,777,858,1139,1138,861,863,804,876,1181,1055,1146,1142,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}))},1480,[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]})]})}},1481,[805,1416,843,1390,17,85,777,858,860,866,845,851,1157,1103,863,804,1181,1055,1158,1159,853,1422,848,900,1482,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])},1482,[17,85,777,858,851,1156,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},{id:'support',title:'Customer support',sub:'Send a message or a picture to CoverCharge',group:'Start here',can:e=>'owner'===e&&!r.IS_CAR,C:fe.SupportChatPage}]),(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}])},1483,[822,1048,856,1484,876,920,909,816,866,1486,1493,1495,1454,1496,1497,1499,1500,1158,1479,1501,1502,1503,1462,1199,1190,1481,1504,1452,1505,1506,17,1196,1179,1453,1441,1455,1511,1210,1517,1518,1468,1519,1444,1429,1520,1459,1521,886,1522,1523,1525,1185,1470,1526,1390,1472,1538,1079,1055,1200,1150,1542,1545,1548,1550]); +__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}])},1483,[822,1048,856,1484,876,920,909,816,866,1486,1493,1495,1454,1496,1497,1499,1500,1158,1479,1501,1502,1503,1462,1199,1190,1481,1504,1452,1505,1506,17,1196,1179,1453,1441,1455,1511,1210,1517,1518,1468,1519,1444,1429,1520,1459,1521,886,1522,1523,1525,1185,1470,1526,1390,1472,1538,1079,1055,1200,1150,1542,1545,1548,1550]); __d(function(g,r,i,a,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)}},1484,[17,378,219,385,85,19,777,1024,1336,876,804,1485,1187,1480,1055,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}))},1485,[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}},1486,[812,1450,17,851,85,777,876,804,1055,884,885,1487,899,916,1029,1448,1488,1489,1491,994,1492,8]); @@ -1606,12 +1606,12 @@ __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule? __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})},1523,[820,896,1452,17,219,85,777,816,876,895,998,897,899,1524,804,880,1160,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'}},1524,[]); __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])},1525,[17,85,777,804,1431,1507,1055,8]); -__d(function(g,_r,_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,c]=(0,a.useState)(null),[p,m]=(0,a.useState)(null),w=(0,a.useMemo)(()=>[...u.HELP,...f],[]),b=(0,a.useMemo)(()=>s.trim()?(0,h.searchHelp)(w,s,10).map(e=>e.a):w.filter(e=>!r||e.topic===r),[s,r,w]);return(0,y.jsxs)(l.default,{style:{gap:10},testID:"help-page",children:[(0,y.jsxs)(l.default,{style:[i.styles.input,{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:4}],children:[(0,y.jsx)(i.T,{colour:x.colours.muted,children:"\ud83d\udd0d"}),(0,y.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:x.colours.text,paddingVertical:8,fontSize:16,outlineStyle:'none'}}),s?(0,y.jsx)(n.GoldClose,{testID:"help-search-clear",size:"sm",label:"Clear search",onPress:()=>o('')}):null]}),s?(0,y.jsx)(i.Muted,{children:b.length?`${b.length} result${1===b.length?'':'s'} for \u201c${s.trim()}\u201d`:`Nothing for \u201c${s.trim()}\u201d. Try other words, or ask the Assistant above.`}):(0,y.jsx)(i.Row,{wrap:!0,gap:6,children:[null,...u.HELP_TOPICS].map(e=>(0,y.jsx)(i.Chip,{label:e??'All',selected:r===e,onPress:()=>c(e)},e??'all'))}),b.map((t,n)=>(0,y.jsx)(j,{a:t,go:e,open:p===t.id||!!s&&0===n&&null===p,onToggle:()=>m(p===t.id?'':t.id)},t.id)),(0,y.jsxs)(i.Card,{style:{alignItems:'center'},children:[(0,y.jsx)(i.T,{center:!0,weight:"semibold",colour:x.colours.gold,children:"Chat with CoverCharge support"}),(0,y.jsx)(i.Muted,{center:!0,children:"Send a message to the CoverCharge team. Nobody replies automatically."}),(0,y.jsx)(i.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,m.useCtx)(6e4),n={rid:t,today:s,go:(t,s)=>e(t,s??null)},[o,r]=(0,a.useState)(''),[c,h]=(0,a.useState)(null),[f,j]=(0,a.useState)(null),C=async()=>{const e=o.trim();if(!e)return;j(null),h(null);const t=(0,p.matchIntent)(e,s);if('action'!==t.kind)'help'!==t.kind?j({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'}):j({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 j({text:'done'===e.status?e.message:e.message??'',kind:'done'})}h({action:t.action,params:{...b(t.action,s),...t.params},asked:e})}};return(0,y.jsx)(l.default,{testID:"ask-assistant",children:(0,y.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(l.default,{style:{width:28,height:28,borderRadius:14,backgroundColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(i.T,{weight:"bold",colour:"#1A1408",children:"\u2726"})}),(0,y.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Ask the Assistant"})]}),(0,y.jsxs)(l.default,{testID:"help-assistant-stack",style:{gap:8,width:'100%',minWidth:0},children:[(0,y.jsx)(i.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,y.jsx)(i.Button,{label:"Ask",testID:"assistant-ask",disabled:!o.trim(),onPress:C,style:{width:'100%',minWidth:0,minHeight:52}})]}),(0,y.jsx)(i.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,y.jsx)(i.Chip,{label:e,onPress:()=>r(e)},e))}),c?(0,y.jsx)(k,{p:c,today:s,onChange:e=>h({...c,params:e}),onConfirm:async()=>{if(!c)return;const e=await(0,p.runAction)(c.action.id,c.params,n,!0);h(null),r(''),j('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:()=>{h(null),j({text:'Cancelled. Nothing was changed.',kind:'note'})}}):null,f?(0,y.jsxs)(l.default,{style:{gap:6},testID:"assistant-reply",children:[(0,y.jsx)(i.Banner,{kind:'done'===f.kind?'success':'error'===f.kind?'warn':'demo'===f.kind?'demo':'info',title:f.text}),f.help?.map(t=>{const s=(0,u.helpById)(t);return(0,y.jsxs)(i.Row,{gap:6,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.T,{style:{flex:1},children:s.title}),s.showMe?(0,y.jsx)(i.Button,{small:!0,kind:"success",label:"Show me",onPress:()=>w(s,e)}):null]},t)})]}):null,(0,y.jsx)(i.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])),l=e(_r(d[5])),i=_r(d[6]),r=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),p=_r(d[11]),x=_r(d[12]),m=_r(d[13]),y=_r(d[14]);const f=[{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 on Home and under 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.'}}];function w(e,t){e.showMe&&(t(e.showMe.tab,e.showMe.page??null),setTimeout(()=>c.useCoach.getState().show(e.showMe.target,e.showMe.hint),300))}function j({a:e,go:t,open:s,onToggle:n}){return(0,y.jsx)(l.default,{testID:`help-${e.id}`,children:(0,y.jsxs)(i.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:n,children:(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(i.T,{weight:"semibold",children:e.title}),(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(i.Badge,{kind:'guide'===e.kind?'gold':'neutral',label:'guide'===e.kind?'Step by step':'FAQ'}),(0,y.jsx)(i.Muted,{size:12,children:e.topic})]})]}),(0,y.jsx)(i.T,{colour:x.colours.muted,children:s?'\u25be':'\u203a'})]})}),s?(0,y.jsxs)(l.default,{style:{gap:6},children:[(0,y.jsx)(i.Muted,{children:e.body}),e.steps?.map((e,t)=>(0,y.jsxs)(i.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,y.jsx)(l.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(i.T,{size:12,weight:"bold",colour:"#1A1408",children:t+1})}),(0,y.jsx)(i.T,{style:{flex:1},children:e})]},t))]}):null,e.showMe?(0,y.jsx)(i.Row,{wrap:!0,gap:6,children:(0,y.jsx)(i.Button,{small:!0,kind:"success",label:"Show me",testID:`showme-${e.id}`,onPress:()=>w(e,t)})}):null]})})}function b(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 c=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),u=(0,p.demoOnly)(e.action.risk),h=(t,s)=>n({...e.params,[t]:s}),m=e.action,f=e.params,w=m.params.every(e=>!e.required||void 0!==f[e.name]&&''!==f[e.name]);return(0,y.jsxs)(l.default,{testID:"assistant-confirm",style:{borderWidth:2,borderColor:u?x.colours.red:x.colours.ok,borderRadius:14,padding:12,gap:8,backgroundColor:u?'#2a1010':x.colours.okBg},children:[(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(i.Badge,{kind:u?'red':'ok',label:p.RISK_LABEL[m.risk]}),(0,y.jsx)(i.T,{weight:"semibold",style:{flex:1},children:m.title})]}),m.form&&'add_walkin'===m.id?(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Covers",value:void 0===f.covers?'':String(f.covers),onChangeText:e=>h('covers',e.replace(/\D/g,'')?Number(e.replace(/\D/g,'')):void 0),keyboardType:"number-pad"})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Table (optional)",value:void 0===f.table?'':String(f.table),onChangeText:e=>h('table',e.trim()?e.trim().toUpperCase():void 0)})})]}):null,m.form&&'add_rota_shift'===m.id?(0,y.jsxs)(l.default,{style:{gap:6},children:[(0,y.jsx)(i.Muted,{size:12,children:"Who"}),(0,y.jsx)(i.Row,{wrap:!0,gap:6,children:c.slice(0,14).map(e=>(0,y.jsx)(i.Chip,{label:e.name.replace(' (example)','').split(' ')[0],selected:f.staffId===e.id,onPress:()=>h('staffId',e.id)},e.id))}),(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(l.default,{style:{flex:1.3},children:(0,y.jsx)(i.Field,{label:"Date (DD/MM/YYYY)",...(0,s.slashBox)(String(f.date??t),e=>h('date',e)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Start (24h)",value:String(f.start??''),onChangeText:e=>h('start',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"End (24h)",value:String(f.end??''),onChangeText:e=>h('end',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})})]})]}):null,(0,y.jsx)(i.T,{children:w?m.preview(f,{rid:'',today:t,go:()=>{}}):'Fill in the missing details above.'}),u?(0,y.jsx)(i.Muted,{children:"This Assistant does not send, pay or delete. Confirm only shows what would happen."}):(0,y.jsx)(i.Muted,{children:"Nothing happens until you tap Confirm."}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.Button,{kind:u?'danger':'success',label:u?'Confirm (nothing is sent)':'Confirm',testID:"assistant-confirm-yes",disabled:!w,onPress:a,style:{flex:1}}),(0,y.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:o,style:{flex:1}})]})]})}},1526,[812,1031,779,17,385,85,777,876,1477,1527,1528,1529,804,1055,8]); +__d(function(g,_r,_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,n.useState)(''),[r,c]=(0,n.useState)(null),[p,m]=(0,n.useState)(null),w=(0,n.useMemo)(()=>[...u.HELP,...f],[]),j=(0,n.useMemo)(()=>s.trim()?(0,h.searchHelp)(w,s,10).map(e=>e.a):w.filter(e=>!r||e.topic===r),[s,r,w]);return(0,y.jsxs)(l.default,{style:{gap:10},testID:"help-page",children:[(0,y.jsxs)(l.default,{style:[i.styles.input,{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:4}],children:[(0,y.jsx)(i.T,{colour:x.colours.muted,children:"\ud83d\udd0d"}),(0,y.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:x.colours.text,paddingVertical:8,fontSize:16,outlineStyle:'none'}}),s?(0,y.jsx)(a.GoldClose,{testID:"help-search-clear",size:"sm",label:"Clear search",onPress:()=>o('')}):null]}),s?(0,y.jsx)(i.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,y.jsx)(i.Row,{wrap:!0,gap:6,children:[null,...u.HELP_TOPICS].map(e=>(0,y.jsx)(i.Chip,{label:e??'All',selected:r===e,onPress:()=>c(e)},e??'all'))}),j.map((t,a)=>(0,y.jsx)(b,{a:t,go:e,open:p===t.id||!!s&&0===a&&null===p,onToggle:()=>m(p===t.id?'':t.id)},t.id)),(0,y.jsxs)(i.Card,{style:{alignItems:'center'},children:[(0,y.jsx)(i.T,{center:!0,weight:"semibold",colour:x.colours.gold,children:"Chat with CoverCharge support"}),(0,y.jsx)(i.Muted,{center:!0,children:"Send a message to the CoverCharge team. Nobody replies automatically."}),(0,y.jsx)(i.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,m.useCtx)(6e4),a={rid:t,today:s,go:(t,s)=>e(t,s??null)},[o,r]=(0,n.useState)(''),[c,h]=(0,n.useState)(null),[f,b]=(0,n.useState)(null),C=async()=>{const e=o.trim();if(!e)return;b(null),h(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,a);return void b({text:'done'===e.status?e.message:e.message??'',kind:'done'})}h({action:t.action,params:{...j(t.action,s),...t.params},asked:e})}};return(0,y.jsx)(l.default,{testID:"ask-assistant",children:(0,y.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(l.default,{style:{width:28,height:28,borderRadius:14,backgroundColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(i.T,{weight:"bold",colour:"#1A1408",children:"\u2726"})}),(0,y.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Ask the Assistant"})]}),(0,y.jsxs)(l.default,{testID:"help-assistant-stack",style:{gap:8,width:'100%',minWidth:0},children:[(0,y.jsx)(i.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,y.jsx)(i.Button,{label:"Ask",testID:"assistant-ask",disabled:!o.trim(),onPress:C,style:{width:'100%',minWidth:0,minHeight:52}})]}),(0,y.jsx)(i.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,y.jsx)(i.Chip,{label:e,onPress:()=>r(e)},e))}),c?(0,y.jsx)(k,{p:c,today:s,onChange:e=>h({...c,params:e}),onConfirm:async()=>{if(!c)return;const e=await(0,p.runAction)(c.action.id,c.params,a,!0);h(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:()=>{h(null),b({text:'Cancelled. Nothing was changed.',kind:'note'})}}):null,f?(0,y.jsxs)(l.default,{style:{gap:6},testID:"assistant-reply",children:[(0,y.jsx)(i.Banner,{kind:'done'===f.kind?'success':'error'===f.kind?'warn':'demo'===f.kind?'demo':'info',title:f.text}),f.help?.map(t=>{const s=(0,u.helpById)(t);return(0,y.jsxs)(i.Row,{gap:6,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.T,{style:{flex:1},children:s.title}),s.showMe?(0,y.jsx)(i.Button,{small:!0,kind:"success",label:"Show me",onPress:()=>w(s,e)}):null]},t)})]}):null,(0,y.jsx)(i.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]),a=_r(d[2]),n=_r(d[3]),o=e(_r(d[4])),l=e(_r(d[5])),i=_r(d[6]),r=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),p=_r(d[11]),x=_r(d[12]),m=_r(d[13]),y=_r(d[14]);const f=[{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.'}}];function w(e,t){e.showMe&&(t(e.showMe.tab,e.showMe.page??null),setTimeout(()=>c.useCoach.getState().show(e.showMe.target,e.showMe.hint),300))}function b({a:e,go:t,open:s,onToggle:a}){return(0,y.jsx)(l.default,{testID:`help-${e.id}`,children:(0,y.jsxs)(i.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:a,children:(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(i.T,{weight:"semibold",children:e.title}),(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(i.Badge,{kind:'guide'===e.kind?'gold':'neutral',label:'guide'===e.kind?'Step by step':'FAQ'}),(0,y.jsx)(i.Muted,{size:12,children:e.topic})]})]}),(0,y.jsx)(i.T,{colour:x.colours.muted,children:s?'\u25be':'\u203a'})]})}),s?(0,y.jsxs)(l.default,{style:{gap:6},children:[(0,y.jsx)(i.Muted,{children:e.body}),e.steps?.map((e,t)=>(0,y.jsxs)(i.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,y.jsx)(l.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(i.T,{size:12,weight:"bold",colour:"#1A1408",children:t+1})}),(0,y.jsx)(i.T,{style:{flex:1},children:e})]},t))]}):null,e.showMe?(0,y.jsx)(i.Row,{wrap:!0,gap:6,children:(0,y.jsx)(i.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:a,onConfirm:n,onCancel:o}){const c=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),u=(0,p.demoOnly)(e.action.risk),h=(t,s)=>a({...e.params,[t]:s}),m=e.action,f=e.params,w=m.params.every(e=>!e.required||void 0!==f[e.name]&&''!==f[e.name]);return(0,y.jsxs)(l.default,{testID:"assistant-confirm",style:{borderWidth:2,borderColor:u?x.colours.red:x.colours.ok,borderRadius:14,padding:12,gap:8,backgroundColor:u?'#2a1010':x.colours.okBg},children:[(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(i.Badge,{kind:u?'red':'ok',label:p.RISK_LABEL[m.risk]}),(0,y.jsx)(i.T,{weight:"semibold",style:{flex:1},children:m.title})]}),m.form&&'add_walkin'===m.id?(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Covers",value:void 0===f.covers?'':String(f.covers),onChangeText:e=>h('covers',e.replace(/\D/g,'')?Number(e.replace(/\D/g,'')):void 0),keyboardType:"number-pad"})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Table (optional)",value:void 0===f.table?'':String(f.table),onChangeText:e=>h('table',e.trim()?e.trim().toUpperCase():void 0)})})]}):null,m.form&&'add_rota_shift'===m.id?(0,y.jsxs)(l.default,{style:{gap:6},children:[(0,y.jsx)(i.Muted,{size:12,children:"Who"}),(0,y.jsx)(i.Row,{wrap:!0,gap:6,children:c.slice(0,14).map(e=>(0,y.jsx)(i.Chip,{label:e.name.replace(' (example)','').split(' ')[0],selected:f.staffId===e.id,onPress:()=>h('staffId',e.id)},e.id))}),(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(l.default,{style:{flex:1.3},children:(0,y.jsx)(i.Field,{label:"Date (DD/MM/YYYY)",...(0,s.slashBox)(String(f.date??t),e=>h('date',e)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Start (24h)",value:String(f.start??''),onChangeText:e=>h('start',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"End (24h)",value:String(f.end??''),onChangeText:e=>h('end',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})})]})]}):null,(0,y.jsx)(i.T,{children:w?m.preview(f,{rid:'',today:t,go:()=>{}}):'Fill in the missing details above.'}),u?(0,y.jsx)(i.Muted,{children:"This Assistant does not send, pay or delete. Confirm only shows what would happen."}):(0,y.jsx)(i.Muted,{children:"Nothing happens until you tap Confirm."}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.Button,{kind:u?'danger':'success',label:u?'Confirm (nothing is sent)':'Confirm',testID:"assistant-confirm-yes",disabled:!w,onPress:n,style:{flex:1}}),(0,y.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:o,style:{flex:1}})]})]})}},1526,[812,1031,779,17,385,85,777,876,1477,1527,1528,1529,804,1055,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.'},{id:'wipe-device',kind:'faq',topic:'Settings',title:'Sign out and wipe a shared tablet or phone',keywords:['wipe','sign out','shared','tablet','leaver','lost','reset device'],body:'Tap the sync badge (bottom left), or go to Settings \u203a Display, and choose Sign out and wipe this device. It signs out and removes everything CoverCharge keeps on that device: sign-ins, pairing, saved screens and changes not sent yet. The venue\u2019s shared data is not touched. On the Display you type the wake PIN first.'}],o=t=>a.find(a=>a.id===t)},1527,[]); __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}},1528,[]); __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}},1529,[1530,1098,843,1531,1532,876,858,996,1477,1527,1528,1534,1533,1536,1537,994,995]); __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))}}]},1530,[1062,1061,1021]); -__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.`)}}]},1531,[896,1098,820,843,1118,1096,1112,922,858,816,996,895,897,1008,876,1065,867,847,845]); +__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.`)}}]},1531,[896,1098,820,843,1119,1096,1113,922,858,816,996,895,897,1008,876,1065,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.'}}]},1532,[820,858,816,996,876,1001,1012,1013,927,926,1006,839,1032,1033,1034,1002,1065,867,1074,993,854,1533,1531]); __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.'}}]},1533,[820,891,1098,843,1138,1259,858,816,996,1001,910,846,845,1074,1075,993,1002,851,1534,1535]); __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)}))},1534,[824,831,834]); @@ -1643,7 +1643,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.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},1560,[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}`},1561,[1556]); __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)},1562,[]); -__d(function(_g,_r,_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]}},1563,[17,385,85,409,812,777,1070,1030,1177,1119,1089,858,1006,876,1053,839,889,899,804,1415,1055,1454,1564,1553,1562,1565,8]); +__d(function(_g,_r,_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]}},1563,[17,385,85,409,812,777,1070,1030,1177,1120,1089,858,1006,876,1053,839,889,899,804,1415,1055,1454,1564,1553,1562,1565,8]); __d(function(g,_r,_i,_a,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},1564,[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)}.`}},1565,[17,85,780,777,804,1564,1562,8]); __d(function(_g,_r,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}]},1566,[17,264,385,85,780,777,858,876,1567,915,1211,1461,804,1557,1055,1564,1568,1562,1565,1563,8]); diff --git a/car-app/index.html b/car-app/index.html index 8f5e3ed94a9a030bce9eef14e24a267522f302bb..ba22580b9ad67add4882b8a4ce1a4a7449d68ba1 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 d0f7c3367bcd92626981bbf88b3649dfad15e969..45f6d3a5a17e55a9b6368063467926048c5ab29a 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 d702d69706ce0fad47f12f1be6193167e146bf38..4f7dd8b9bf06c05b0a06cc58b5521201135fffb3 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-6b7044e1cd"; +const V = "cc-car-a9ddad4252"; 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=6b7044e1cd7b865345062aaad5a7efe9c36adbe628b74ae40689d24c0067a129"]; +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=a9ddad425269a8a1c3063575ab23876515a871c1a60f370b4ca82b1b3d121695"]; // 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 cab6933f4cb1ecfac71ff0c344648d8a2c65e071..cb2e25293723b378c82c13c74fd3cf96e4d88a64 100644 --- a/chef-app/_expo/static/js/web/bundle.js +++ b/chef-app/_expo/static/js/web/bundle.js @@ -1058,7 +1058,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.205'},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.206'},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 c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},979,[980,981,928,972,976]); __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]); @@ -1166,17 +1166,17 @@ __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,"useChatOpen",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)()(t=>({request:n=>t({ch:n})}))},1083,[831]); __d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},1084,[912,17,1010,876,816,913,927,1066,916,1065]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:u}){const h=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const f=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==u||'seated'!==s.status||s.date!==(0,c.venueYmd)(new Date)||!(0,l.hasAllergens)(s)||h.current.has(s.id))continue;const n=f.get(s.id);n&&'seated'!==n&&(h.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} Covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[u]),null},e.useKitchenTodoChime=function(t,c,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=c&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,u.soundAllowed)()&&(0,u.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} Covers \xb7 ${t.date===c?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6])},1085,[843,17,916,858,1053,863,1016]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:s,today:o,by:S,app:j}){const $=(0,n.useBookings)(s).filter(e=>e.date===o&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),w=$.reduce((e,t)=>e+(t.diet?.vegan??0),0),T=$.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,x.jsxs)(a.default,{style:{gap:12},testID:"todays-bookings",children:[(0,x.jsx)(p.CoversToday,{rid:s}),(0,x.jsx)(b.PlattersBooked,{rid:s,date:o,label:"Platters booked today"}),w||T?(0,x.jsxs)(l.T,{colour:h.colours.ok,children:["\u24cb ",w?`${w} vegan`:'',w&&T?' \xb7 ':'',T?`${T} vegetarian`:''," today"]}):null,(0,x.jsx)(b.KitchenSignoffs,{rid:s,today:o,by:S,app:j,showAll:!0}),$.length?$.map(o=>(0,x.jsxs)(a.default,{testID:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?`kitchen-seated-${o.id}`:`kitchen-booking-${o.id}`,style:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?{gap:6,padding:14,borderRadius:16,...(0,c.seatedHighlightStyle)()}:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface,opacity:'finished'===o.status?.55:1},children:[(0,x.jsxs)(l.T,{weight:"semibold",colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,accessibilityLabel:`${o.time}, ${o.walkIn?`Walk-in ${o.ref}`:o.name}, ${o.partySize} Covers${o.table?`, ${(0,e.tableNumbersA11y)(o.table)}`:''}`,children:[o.time," \xb7 ",o.walkIn?`Walk-in ${o.ref}`:o.name," \xb7 ",o.partySize," Covers",o.table?` \xb7 ${(0,e.tableNumbers)(o.table)}`:'']}),(0,x.jsx)(t.DepositChip,{b:o,money:!0,testID:`kitchen-deposit-${o.id}`}),(0,x.jsx)(k.BookingTableButton,{rid:s,booking:o,readOnly:'chef'===j}),'chef'!==j&&o.walkIn?(0,x.jsx)(y.CancelWalkInButton,{rid:s,b:o,small:!0}):null,o.notes?(0,x.jsxs)(l.T,{size:16,colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,testID:`kitchen-notes-${o.id}`,children:["Notes: ",o.notes]}):null,(0,x.jsx)(f.BookingEditButton,{rid:s,booking:o,who:S,inStaffApp:'staff'===j}),(0,x.jsx)(b.BookingNeeds,{b:o}),'seated'===(0,u.shownStatus)(o)?(0,x.jsx)(l.T,{weight:"semibold",colour:c.SEATED_FG,children:"Seated"}):'finished'===o.status?(0,x.jsx)(l.Muted,{children:"Finished"}):null]},o.id)):(0,x.jsx)(l.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var s,o=r(d[3]),a=(s=o)&&s.__esModule?s:{default:s},l=r(d[4]),n=r(d[5]),u=r(d[6]),h=r(d[7]),c=r(d[8]),b=r(d[9]),k=r(d[10]),y=r(d[11]),f=r(d[12]),p=r(d[13]),x=r(d[14])},1086,[843,1087,17,85,777,858,1053,804,1088,1076,1089,1114,1119,1070,8]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:s,today:o,by:S,app:j}){const $=(0,n.useBookings)(s).filter(e=>e.date===o&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),w=$.reduce((e,t)=>e+(t.diet?.vegan??0),0),T=$.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,x.jsxs)(a.default,{style:{gap:12},testID:"todays-bookings",children:[(0,x.jsx)(p.CoversToday,{rid:s}),(0,x.jsx)(b.PlattersBooked,{rid:s,date:o,label:"Platters booked today"}),w||T?(0,x.jsxs)(l.T,{colour:h.colours.ok,children:["\u24cb ",w?`${w} vegan`:'',w&&T?' \xb7 ':'',T?`${T} vegetarian`:''," today"]}):null,(0,x.jsx)(b.KitchenSignoffs,{rid:s,today:o,by:S,app:j,showAll:!0}),$.length?$.map(o=>(0,x.jsxs)(a.default,{testID:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?`kitchen-seated-${o.id}`:`kitchen-booking-${o.id}`,style:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?{gap:6,padding:14,borderRadius:16,...(0,c.seatedHighlightStyle)()}:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface,opacity:'finished'===o.status?.55:1},children:[(0,x.jsxs)(l.T,{weight:"semibold",colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,accessibilityLabel:`${o.time}, ${o.walkIn?`Walk-in ${o.ref}`:o.name}, ${o.partySize} Covers${o.table?`, ${(0,e.tableNumbersA11y)(o.table)}`:''}`,children:[o.time," \xb7 ",o.walkIn?`Walk-in ${o.ref}`:o.name," \xb7 ",o.partySize," Covers",o.table?` \xb7 ${(0,e.tableNumbers)(o.table)}`:'']}),(0,x.jsx)(t.DepositChip,{b:o,money:!0,testID:`kitchen-deposit-${o.id}`}),(0,x.jsx)(k.BookingTableButton,{rid:s,booking:o,readOnly:'chef'===j}),'chef'!==j&&o.walkIn?(0,x.jsx)(y.CancelWalkInButton,{rid:s,b:o,small:!0}):null,o.notes?(0,x.jsxs)(l.T,{size:16,colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,testID:`kitchen-notes-${o.id}`,children:["Notes: ",o.notes]}):null,(0,x.jsx)(f.BookingEditButton,{rid:s,booking:o,who:S,inStaffApp:'staff'===j}),(0,x.jsx)(b.BookingNeeds,{b:o}),'seated'===(0,u.shownStatus)(o)?(0,x.jsx)(l.T,{weight:"semibold",colour:c.SEATED_FG,children:"Seated"}):'finished'===o.status?(0,x.jsx)(l.Muted,{children:"Finished"}):null]},o.id)):(0,x.jsx)(l.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var s,o=r(d[3]),a=(s=o)&&s.__esModule?s:{default:s},l=r(d[4]),n=r(d[5]),u=r(d[6]),h=r(d[7]),c=r(d[8]),b=r(d[9]),k=r(d[10]),y=r(d[11]),f=r(d[12]),p=r(d[13]),x=r(d[14])},1086,[843,1087,17,85,777,858,1053,804,1088,1076,1089,1115,1120,1070,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DepositChip=function({b:e,money:o,big:n,testID:b}){const f=(0,s.depositView)(e,o);if(!f)return null;const h={gold:[t.colours.goldTint,t.colours.goldLight,t.colours.gold],amber:[t.colours.amberBg,'#FFE2A8',t.colours.amber],red:[t.colours.redBg,'#FFD9D4',t.colours.red],neutral:[t.colours.surface2,t.colours.muted,t.colours.border]}[f.kind];return(0,u.jsxs)(l.default,{accessible:!0,accessibilityRole:"text",accessibilityLabel:f.a11y,testID:b??'deposit-chip',style:{alignSelf:'flex-start',maxWidth:'100%'},children:[(0,u.jsx)(l.default,{style:{backgroundColor:h[0],borderColor:h[2],borderWidth:n?2:1,borderRadius:8,paddingHorizontal:n?12:8,paddingVertical:n?6:3},children:(0,u.jsx)(c.T,{size:16,weight:"semibold",colour:h[1],children:f.label})}),f.note?(0,u.jsx)(c.Muted,{size:12,children:f.note}):null]})},r(d[0]);var e,o=r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),c=r(d[4]),u=r(d[5])},1087,[17,85,841,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEATED_BG",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SEATED_FG",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEATED_MUTED",{enumerable:!0,get:function(){return u}}),e.isSeatedHighlight=function(t,o){return'seated'===t&&!o?.otherDay},e.seatedHighlightStyle=function(u){return{backgroundColor:o,borderColor:t.colours.goldLight,borderWidth:1.5,borderLeftWidth:8,borderLeftColor:n,...u}};var t=r(d[0]);const o=t.colours.gold,n=t.colours.onGold,u='#3F3218'},1088,[804]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f,canClear:h=!0}){const[j,k]=(0,t.useState)(!1),x=(0,s.tableButtonLabel)(l.table),_=f??`table-btn-${l.id}`;if(y)return(0,b.jsx)(n.default,{testID:_,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,b.jsx)(u.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:x})});return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u.Button,{kind:"secondary",label:x,testID:_,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>k(!0),style:{minHeight:44}}),j?(0,b.jsx)(c.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>k(!1),canClear:h}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6])},1089,[17,85,1090,804,1091,777,8]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const u={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(u)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(u,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}}),e.splitChoices=function(t){const n=String(t??'').split('+').map(t=>t.trim()).filter(Boolean);return n.length>1?[...new Set(n)]:[]};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1090,[843,1074]); -__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,t,s){const l=(0,p.tableKey)(s);if('finished'===t.status&&l)return void await(0,j.restoreFinishedToTable)(e,t,s);const o=(0,g.tablesOf)(t.table);await h.repo.bookings.update(t.id,(0,y.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(t=>g.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,m.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:m=90,onClose:T,onSaved:S,onPickOnPlan:L,canClear:P=!0}){const W=(0,g.usePlan)(e),z=(0,h.useBookings)(e),[D,I]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),R=(0,l.useMemo)(()=>(0,p.pickGroups)(W),[W]),B=z.filter(e=>e.date===y.date),O=(0,p.seatsOf)(W,D),N=(0,p.seatLine)(O.total,y.partySize),F=(0,p.pickClashes)(y,D,B,m),M=e=>(0,p.pickClashes)(y,[e],B,m)[0]?.with,Y=(0,p.tableKey)(D)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,C.useBlocks)(e=>e.blocks),A=(0,C.blockAt)(_,e,y.date,y.time),[G,K]=(0,l.useState)(null),E=e=>{K(null),I(t=>(0,p.toggleTable)(t,e))},[H]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{H&&(0,c.announce)(`Tables can't be saved: ${H}.`)},[H]);const[U,V]=(0,l.useState)(!1),[q,J]=(0,l.useState)(!1),Q=async t=>{(0,o.guardBookingChange)(S,{b:y,tables:t})?(V(!0),T(),await(0,o.saveTablesReported)(e,y,t,f,(0,p.seatsOf)(W,t).total,e=>S?.(e))):T()},X=(0,w.jsxs)(u.default,{style:{gap:8},children:[(0,w.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(D)} picked. ${N.text}.`,children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(D)}),(0,w.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:N.text})]}),A?(0,w.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,w.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,F.length?(0,w.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(F)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,w.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(F)," You can still save."]})}):null,q?(0,w.jsx)(j.RestoreSeatedConfirm,{prompt:(0,v.restoreSeatedPrompt)(f,(0,p.tableKey)(D)),onYes:()=>{J(!1),Q(D)},onNo:()=>J(!1)}):null,G?(0,w.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:G,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,w.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:G}),(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(D)} for ${f}, ${y.partySize} people`,disabled:U,onPress:()=>{Q(D)},style:[$,{flexGrow:1}]}),(0,w.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>K(null),style:$})]})]}):null,(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[G?null:(0,w.jsx)(x.Button,{testID:"table-pick-save",label:U?'Saving\u2026':F.length?'Save anyway':'Save tables',disabled:!Y||!D.length||U,accessibilityLabel:`${F.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(D)} for ${f}. ${N.text}.${F.length?` ${(0,p.clashWords)(F)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(S,{b:y,tables:D}))return void T();const e=(0,p.overCapacityAsk)(D,O.total,y.partySize);!e||G?'finished'!==y.status||!D.length||q?Q(D):J(!0):K(e)},style:[$,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&P?(0,w.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:U,onPress:()=>Q([]),style:$}):null,(0,w.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:T,style:$})]})]});return(0,w.jsxs)(x.Sheet,{visible:!0,onClose:T,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:X,children:[(0,w.jsx)(t.TableNumberWarning,{plan:W}),H?(0,w.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${H}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,w.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${H}.`})}):null,(0,w.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),L?(0,w.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>L(D),style:$}):null,R.map(e=>(0,w.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,w.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,w.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=D.includes(e.name),l=M(e.name);return(0,w.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,t,l),onPress:()=>E(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",colour:t?k.colours.onGold:k.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,w.jsxs)(x.T,{size:14,colour:t?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),R.length?null:(0,w.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),m=r(d[15]),j=r(d[16]),v=r(d[17]),C=r(d[18]),w=r(d[19]);const $={minHeight:56}},1091,[1092,843,17,1093,899,1095,385,85,858,996,1090,1094,804,863,777,1096,1112,1111,993,8]); +__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,t,s){const l=(0,p.tableKey)(s);if('finished'===t.status&&l)return void await(0,j.restoreFinishedToTable)(e,t,s);const o=(0,g.tablesOf)(t.table);await h.repo.bookings.update(t.id,(0,y.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(t=>g.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,m.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:m=90,onClose:T,onSaved:S,onPickOnPlan:L,canClear:P=!0}){const W=(0,g.usePlan)(e),z=(0,h.useBookings)(e),[D,I]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),R=(0,l.useMemo)(()=>(0,p.pickGroups)(W),[W]),B=z.filter(e=>e.date===y.date),O=(0,p.seatsOf)(W,D),N=(0,p.seatLine)(O.total,y.partySize),F=(0,p.pickClashes)(y,D,B,m),M=e=>(0,p.pickClashes)(y,[e],B,m)[0]?.with,Y=(0,p.tableKey)(D)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,C.useBlocks)(e=>e.blocks),A=(0,C.blockAt)(_,e,y.date,y.time),[G,K]=(0,l.useState)(null),E=e=>{K(null),I(t=>(0,p.toggleTable)(t,e))},[H]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{H&&(0,c.announce)(`Tables can't be saved: ${H}.`)},[H]);const[U,V]=(0,l.useState)(!1),[q,J]=(0,l.useState)(!1),Q=async t=>{(0,o.guardBookingChange)(S,{b:y,tables:t})?(V(!0),T(),await(0,o.saveTablesReported)(e,y,t,f,(0,p.seatsOf)(W,t).total,e=>S?.(e))):T()},X=(0,w.jsxs)(u.default,{style:{gap:8},children:[(0,w.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(D)} picked. ${N.text}.`,children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(D)}),(0,w.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:N.text})]}),A?(0,w.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,w.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,F.length?(0,w.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(F)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,w.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(F)," You can still save."]})}):null,q?(0,w.jsx)(j.RestoreSeatedConfirm,{prompt:(0,v.restoreSeatedPrompt)(f,(0,p.tableKey)(D)),onYes:()=>{J(!1),Q(D)},onNo:()=>J(!1)}):null,G?(0,w.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:G,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,w.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:G}),(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(D)} for ${f}, ${y.partySize} people`,disabled:U,onPress:()=>{Q(D)},style:[$,{flexGrow:1}]}),(0,w.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>K(null),style:$})]})]}):null,(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[G?null:(0,w.jsx)(x.Button,{testID:"table-pick-save",label:U?'Saving\u2026':F.length?'Save anyway':'Save tables',disabled:!Y||!D.length||U,accessibilityLabel:`${F.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(D)} for ${f}. ${N.text}.${F.length?` ${(0,p.clashWords)(F)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(S,{b:y,tables:D}))return void T();const e=(0,p.overCapacityAsk)(D,O.total,y.partySize);!e||G?'finished'!==y.status||!D.length||q?Q(D):J(!0):K(e)},style:[$,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&P?(0,w.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:U,onPress:()=>Q([]),style:$}):null,(0,w.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:T,style:$})]})]});return(0,w.jsxs)(x.Sheet,{visible:!0,onClose:T,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:X,children:[(0,w.jsx)(t.TableNumberWarning,{plan:W}),H?(0,w.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${H}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,w.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${H}.`})}):null,(0,w.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),L?(0,w.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>L(D),style:$}):null,R.map(e=>(0,w.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,w.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,w.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=D.includes(e.name),l=M(e.name);return(0,w.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,t,l),onPress:()=>E(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",colour:t?k.colours.onGold:k.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,w.jsxs)(x.T,{size:14,colour:t?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),R.length?null:(0,w.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),m=r(d[15]),j=r(d[16]),v=r(d[17]),C=r(d[18]),w=r(d[19]);const $={minHeight:56}},1091,[1092,843,17,1093,899,1095,385,85,858,996,1090,1094,804,863,777,1096,1113,1111,993,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},1092,[17,842,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.guardBookingChange=w,_e.saveTablesReported=async function(e,t,n,o,s,u){if(!w(u,{b:t,tables:n}))return!1;const v=n.length?(0,h.notSavedWhat)({...t,name:o,table:n.join('+')}):`Taking the table off ${o}`;u(`Saving ${v}\u2026`);try{await(0,b.saveBookingTables)(e,t,n)}catch(e){const t=`${v} did not save: ${String(e?.message??e).slice(0,120)}`;return u(t),(0,l.announce)(t),!1}const y=await(0,c.waitForBookingSave)(t.id);if('saved'===y.state||'local'===y.state){const e=(0,r.savedWords)(o,t.partySize,n,s);return u(e),(0,l.announce)(e),!0}const k='waiting'===y.state?`${v}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${v} did not save. ${f("why"in y?y.why:"the shared system did not take it")}. Tap the red banner to try again.`;return u(k),(0,l.announce)(k),!1},_e.reportBookingSave=async function(e,t,n,o){const s=await(0,c.waitForBookingSave)(e);if('saved'===s.state||'local'===s.state)return o(t),(0,l.announce)(t),!0;const r='waiting'===s.state?`${n}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${n} did not save. ${f('why'in s?s.why:'the shared system did not take it')}. Tap the red banner to try again.`;return o(r),(0,l.announce)(r),!1},_e.BookingSaveBanner=function({rid:e,testID:r="booking-save-banner",margin:c}){const b=(0,h.useBookingSaves)(e=>e.notSaved),w=(0,s.useBookings)(e).filter(e=>b[e.id]).map(e=>void 0!==b[e.id].want?{...e,table:b[e.id].want||void 0}:e),{msg:S,retry:$}=k(),m=(0,t.useRef)(''),p=w.map(e=>(0,h.notSavedLine)(e)),B=w.map(e=>e.id).sort().join(',');if((0,t.useEffect)(()=>{B&&B!==m.current&&(0,l.announce)(1===w.length?p[0]:`${w.length} booking changes did not save. Tap the red banner to try again.`),m.current=B},[B]),!w.length)return null;const j=1===w.length?p[0]:`${w.length} booking changes did not save. Tap to try again.`;return(0,y.jsx)(n.default,{testID:r,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${j}${w.length>1?` ${w.map(e=>(0,h.notSavedWhat)(e)).join('. ')}.`:''} ${f(b[w[0].id].why)}.`,onPress:$,style:{...c??{},alignSelf:'stretch',gap:4,padding:12,borderRadius:12,borderWidth:2,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:(0,y.jsxs)(o.default,{accessibilityRole:"alert",style:{alignItems:'center',gap:4},children:[(0,y.jsx)(v.T,{testID:`${r}-title`,size:17,weight:"semibold",center:!0,colour:"#FFD2CC",children:j}),w.length>1?w.slice(0,6).map(e=>(0,y.jsx)(v.T,{testID:`${r}-line`,size:15,center:!0,colour:"#FFD2CC",children:(0,h.notSavedWhat)(e)},e.id)):null,(0,y.jsx)(v.T,{testID:`${r}-why`,size:14,center:!0,colour:"#FFB3AA",children:w.length>1?`${f(b[w[0].id].why)}${w.length>6?` \xb7 and ${w.length-6} more`:''}`:f(b[w[0].id].why)}),S?(0,y.jsx)(v.T,{testID:`${r}-msg`,size:14,center:!0,colour:u.colours.goldLight,children:S}):null]})})},_e.BookingNotSavedLine=function({b:e}){const t=(0,h.useBookingSaves)(t=>t.notSaved[e.id]),{msg:o,retry:s}=k();if(!t)return null;void 0!==t.want&&(e={...e,table:t.want||void 0});return(0,y.jsxs)(n.default,{testID:`booking-not-saved-${e.id}`,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${(0,h.notSavedLine)(e)} ${f(t.why)}.`,onPress:s,style:{alignSelf:'stretch',padding:8,borderRadius:10,borderWidth:1.5,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:[(0,y.jsx)(v.T,{size:15,weight:"semibold",center:!0,colour:"#FFD2CC",children:(0,h.notSavedLine)(e)}),o?(0,y.jsx)(v.T,{size:13,center:!0,colour:u.colours.goldLight,children:o}):null]})};var t=_r(d[0]),n=e(_r(d[1])),o=e(_r(d[2])),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),b=_r(d[9]),v=_r(d[10]),y=_r(d[11]);const f=e=>e.charAt(0).toUpperCase()+e.slice(1);function w(e,t){const n=(0,c.bookingSaveBlocker)();if(!n)return!0;t&&h.useBookingSaves.getState().mark({id:t.b.id,table:t.b.walkIn?'walk_ins':'bookings',why:n,...t.tables?{want:t.tables.join('+')}:{}});const o=`${t?(0,h.notSavedWhat)({...t.b,...t.tables?{table:t.tables.join('+')||void 0}:{}}):'This change'} did not save: ${n}.`;return e?.(o),(0,l.announce)(o),!1}function k(){const[e,n]=(0,t.useState)('');return{msg:e,retry:async()=>{n('Saving\u2026'),(0,l.announce)('Saving');const e=await(0,c.saveBookingsNow)(!0),t=e?`Not saved: ${e}.`:h.useBookingSaves.getState().count()?'Sent again. The banner clears when the shared system takes it.':'Nothing is left waiting. Check the plan and make the change again if it is not there.';n(t),(0,l.announce)(t)}}}},1093,[17,385,85,858,1094,1095,899,983,804,1091,777,8]); __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=u,e.requestedFreeTable=function(t,n,a,s,l=90){const o={id:n.id??'new',status:'confirmed',...n};for(const n of t)if(a.includes(n)&&!u(o,[n],s,l).length)return n;return null},e.overCapacityAsk=function(n,s,l){const u=a(o(n));if(!u.length||s>=l)return null;const c=u.map(n=>(0,t.tableNumbers)(n));return`${1===c.length?`Table ${c[0]} seats`:`Tables ${c.slice(0,-1).join(', ')} and ${c[c.length-1]} seat`} ${s} \u2013 this booking is ${l}. Use it anyway?`},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=c,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${c(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${c(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${c(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))}function c(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1094,[843,1074]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.primeAnnouncer=function(){u()},_e.announce=function(t){const e=String(t??'').trim();if(!e)return;{const t=u();if(!t)return;const n=++o;return t.textContent='',void setTimeout(()=>{n===o&&(t.textContent=e)},80)}},Object.defineProperty(_e,"lastAnnounced",{enumerable:!0,get:function(){return c}});var t,e=r(d[0]);(t=e)&&t.__esModule;r(d[1]);let n=null,o=0;function u(){if('undefined'==typeof document||!document.body)return null;if(n&&document.body.contains(n))return n;const t=document.createElement('div');return t.id='cc-announcer',t.setAttribute('aria-live','assertive'),t.setAttribute('aria-atomic','true'),t.setAttribute('role','status'),t.setAttribute('data-testid','cc-announcer'),Object.assign(t.style,{position:'absolute',width:'1px',height:'1px',margin:'-1px',padding:'0',overflow:'hidden',clip:'rect(0 0 0 0)',whiteSpace:'nowrap',border:'0'}),document.body.appendChild(t),n=t,t}const c=()=>n?.textContent??''},1095,[264,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,"TABLES",{enumerable:!0,get:function(){return A}}),_e.useTableNames=R,_e.resetTableLive=W,_e.seatBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'seated'),W(e,t.table)},_e.finishBookingNow=async function(e,t){const s=(new Date).toISOString();await k.repo.bookings.update(t.id,(0,N.finishClearPatch)(s,t.table)),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=E,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return _}}),_e.TablePicker=H,_e.WalkInSheet=q,_e.AssignTableSheet=G,_e.undoNotice=Y,_e.NewBookingSheet=V,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[n,i]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>i({b:e}),combineTables:e=>i({b:e,combine:!0}),elements:(0,L.jsxs)(L.Fragment,{children:[s?(0,L.jsx)(q,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,L.jsx)(V,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,L.jsx)(G,{booking:n.b,combine:n.combine,onClose:()=>i(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),z=_r(_d[29]),B=_r(_d[30]),M=_r(_d[31]),N=_r(_d[32]),L=_r(_d[33]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),A=Array.from({length:12},(e,t)=>String(t+1));function R(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function W(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function E(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=R(e),a=(0,v.useFloor)(t=>t.live[e])??{},n=(0,v.usePlan)(e),i=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(i,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const _=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function H({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=n?6:8,f=n?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(i??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,L.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],i=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!i,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,L.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:i?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,L.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,L.jsx)(C.T,{weight:"bold",size:22,colour:i?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,L.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,L.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,L.jsx)(C.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const U=[1,2,3,4,5,6,7,8];function q({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:r,r:d,now:u}=(0,y.useCtx)(15e3),x=E(r,u),[T,I]=(0,c.useState)(2),[P,$]=(0,c.useState)(!1),[O,z]=(0,c.useState)(i??null),B=(0,v.usePlan)(r),N=(0,k.useBookings)(r),A=(0,D.useBlocks)(e=>e.blocks),R=(0,D.closedAreasAt)(A,r,(0,w.ymd)(u),(0,w.hm)(u)),_=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(x).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(B,N.filter(e=>e.date===(0,w.ymd)(u)),e,T,u,(0,j.turnFor)(T,d.settings.turnMins),90,void 0,{closed:R})?.table??null},[B,N,x,T,R.size,u.getTime()]);(0,c.useEffect)(()=>{O&&(0,v.tablesOf)(O).some(e=>'Closed'===x[e]?.label)&&z(null)},[O,R.size]);const[q,G]=(0,c.useState)(!1),[Y,V]=(0,c.useState)(''),K=(e,t=String(e),s=()=>{$(!1),I(e)})=>{const o='9+'===t?P:!P&&T===e;return(0,L.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,L.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},Q=(0,L.jsx)(s.PartySizeInput,{value:T,onChange:I,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),X=(0,L.jsxs)(m.default,{style:{gap:8,width:n?256:void 0},children:[(0,L.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,L.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[U.map(e=>K(e)),K(9,'9+',()=>{$(!0),I(e=>e>=9?e:9)})]}),P?Q:null]}),[J,Z]=(0,c.useState)(!1),ee=async(t=O)=>{if(!J&&(0,M.guardBookingChange)(F)){Z(!0);try{const s=await k.repo.bookings.seatWalkIn(r,T,t??void 0,Y);W(r,t??void 0),a(s),e()}finally{Z(!1)}}},te=(0,L.jsxs)(m.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,L.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,L.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),O?(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>z(null)}):null]}),(0,L.jsx)(H,{use:x,value:O,onPick:e=>{x[e]&&!x[e].busy?ee(e):z(O===e?null:e)},big:n,dense:n,best:_,bestSet:(0,h.bestTables)(B)}),(0,L.jsxs)(C.Muted,{children:["Tap a free table to seat them there",_&&!O?` (suggested for ${T}: ${(0,l.tableNumbers)(_)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(u)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,L.jsx)(C.Button,{label:`Seat walk-in \xb7 ${T} ${1===T?'person':'people'}${O?` \xb7 ${(0,l.tableNumbers)(O)}`:''}`,disabled:J,onPress:()=>{ee()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,L.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[X,te]}):(0,L.jsxs)(L.Fragment,{children:[X,te]}),(0,L.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[q?(0,L.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:Y,onChangeText:V,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,L.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,L.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function G({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,y.useCtx)(15e3),i=E(o,n),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(n)),t,e.partySize,n,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,n.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),P=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,$=D.reduce((e,t)=>e+P(t),0),O=D.length>0&&${if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&W(o,l),t()},B=x?(0,L.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,L.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,L.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${$} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,L.jsx)(m.default,{testID:"combine-short",children:(0,L.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-$," more needed. Add another table."]})}):null,(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,L.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,L.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,L.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,L.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${_(e)}`,testID:"assign-table-sheet",footer:B,children:[f&&!x?(0,L.jsx)(m.default,{testID:"assign-suggested",children:(0,L.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,L.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,L.jsx)(H,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function Y(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${_(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function V({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:N}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const A=(0,w.ymd)(p),[R,W]=(0,c.useState)(ee.blocks),[H,U]=(0,c.useState)(!1),[q,G]=(0,c.useState)(''),[Y,V]=(0,c.useState)(2),[K,Q]=(0,c.useState)(0),X=Math.min(K,Math.max(0,Y-1)),[J,Z]=(0,c.useState)(null),[ee,te]=(0,c.useState)(''),[se,oe]=(0,c.useState)(''),[le,ae]=(0,c.useState)(''),[ne,ie]=(0,c.useState)(!1),[re,de]=(0,c.useState)('phone'),[ue,ce]=(0,c.useState)((0,P.emptyNeeds)()),be=(0,P.needsMissing)(ue),[ge,he]=(0,c.useState)(null),pe=(0,v.usePlan)(b),me=(0,O.dogSetUp)(pe),fe=!0===ue.dog&&me,ye=ue.dog?ue.dogs:0,ke=(0,w.parseYmd)(R),xe=(0,j.turnFor)(Y,h.settings.turnMins),je=E.filter(e=>e.date===R),we=e=>(0,j.dogTablesAt)(pe,je,Y,(0,j.slotStart)(R,e),xe,h.settings.turnMins,(0,D.closedAreasAt)(_,b,R,e)),Se=fe&&J?we(J):[];(0,c.useEffect)(()=>{he(null)},[fe,J,Y]);const Te=(0,x.bookingSlots)(h,ke,e=>E.filter(t=>t.date===R&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Y,R===(0,w.ymd)(p)?p:(0,w.addMins)(ke,0),e=>E.filter(t=>t.date===R&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),Ce=(0,T.guestPhone)(se),[ve,De]=(0,c.useState)(!1),Ie=J?Te.find(e=>e.time===J):void 0,Pe=Ie&&Ie.left=2&&!!J&&(!Oe||ve)&&(0,o.validParty)(Y)&&Ce.ok&&(0,T.emailOk)(le)&&(!ze||Be&&H)&&(!fe||Se.length>0)&&!Me,Le=ue.wheelchair>0||ue.stepFree,Fe=(0,$.bookingRulesOf)(h),Ae=(0,$.largeGroupTables)(Fe,Y),Re=(0,$.dogPartyCheck)(Fe,Y,!0===ue.dog,ue.assistDog),We=(0,$.bookingDepositSplit)((0,n.depositOf)(h.settings),Y,X,(0,P.needsPatch)(ue),(0,O.reservablesOf)(h));return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(ke)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,L.jsx)(P.FirstQuestions,{rid:b,value:ue,onChange:ce,party:Y,audience:"staff"}),ue.dog&&!me?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,L.jsx)(I.BookingDatePicker,{r:h,today:p,value:R,onChange:e=>{e!==R&&(W(e),Z(null),U(!1))}}),(0,L.jsxs)(C.Row,{gap:6,children:[(0,L.jsx)(C.Chip,{label:"Phone",selected:'phone'===re,onPress:()=>de('phone')}),(0,L.jsx)(C.Chip,{label:"In person",selected:'in-person'===re,onPress:()=>de('in-person')})]}),(0,L.jsx)(C.Field,{label:"Name",value:q,onChangeText:G,placeholder:"e.g. Reid",testID:"nb-name"}),(0,L.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:se,onChangeText:oe,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!Ce.ok&&se?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:Ce.error}):null,(0,L.jsx)(C.Field,{label:"Email (optional)",value:le,onChangeText:ae,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email",testID:"nb-email"}),(0,T.emailOk)(le)?null:(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),le.trim()&&Fe.marketingOptIn?(0,L.jsx)(C.Toggle,{label:Fe.marketingWords,value:ne,onChange:ie,testID:"nb-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,L.jsx)(i.AdultsChildren,{value:(0,r.peopleOf)(Y,X),onChange:e=>{V(e.partySize),Q(e.children),De(!1)},depositsOn:(0,n.depositOf)(h.settings).on&&(0,n.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:Te.map(e=>{const t=fe&&e.available&&!we(e.time).length||!(0,P.dogTimeOk)(h,E,R,e.time,ye);return(0,L.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(_,b,R,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:J===e.time,onPress:()=>{Z(e.time),U(!1),De(!1)}},e.time)})}),Oe?(0,L.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[Pe?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Y,Pe.left,Pe.time)}):null,$e?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)($e.time,$e.cap)}):null,(0,L.jsx)(C.Chip,{label:ve?'Booking over the limit: on':'Book anyway (over the limit)',selected:ve,onPress:()=>De(e=>!e),testID:"nb-over-ok"})]}):null,fe&&J?(0,L.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,L.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,L.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",pe.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),Se.length?pe.areas.filter(e=>Se.some(t=>t.area===e.name)).map(e=>(0,L.jsxs)(m.default,{style:{gap:6},accessibilityLabel:e.name,children:[(0,L.jsxs)(C.T,{size:13,center:!0,colour:S.colours.muted,children:[e.name,e.outdoor?' (outdoor)':'']}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:Se.filter(t=>t.area===e.name).map(e=>{const t=Se[0]?.table===e.table;return(0,L.jsx)(C.Chip,{testID:`nb-dog-table-${(0,l.tableNumbers)(e.table)}`,label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.seats} seats${t?' \xb7 best':''}${Le&&(0,O.accessibleSetUp)(pe)&&!(0,O.isAccessible)(pe,e.table)?' \xb7 not step-free':''}`,selected:(ge??Se[0].table)===e.table,onPress:()=>he(e.table)},e.table)})})]},e.id)):(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Y," at ",J,". Try another time."]})]}):null,ze?(0,L.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,L.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",ze.from,"\u2013",ze.to,ze.reason?` (${ze.reason})`:'']}),Be?(0,L.jsx)(C.Chip,{label:H?'Manager override on':'Override and book anyway',selected:H,onPress:()=>U(e=>!e)}):(0,L.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,Te.length?null:(0,L.jsx)(m.default,{testID:"nb-closed",children:(0,L.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(ke)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,L.jsx)(P.MoreQuestions,{rid:b,r:h,value:ue,onChange:ce,party:Y,date:R,time:J,today:(0,w.ymd)(p),bookings:E,audience:"staff",showTables:!1!==h.settings.tableRequests}),Le&&!(0,O.accessibleSetUp)(pe)?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,Ae&&!fe?(0,L.jsxs)(C.T,{size:14,colour:S.colours.goldLight,testID:"nb-large-group",children:["Large group: tables ",Ae.join(' + ')," joined."]}):null,Re.ok?null:(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,testID:"nb-dog-cap",children:["Online, a dog booking is for up to ",Fe.dogMaxParty," people. You can still book it here: check where they can sit."]}),(0,L.jsx)(C.Field,{label:"Notes (optional)",value:ee,onChangeText:te,placeholder:Fe.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"nb-notes"}),We.preorders?(0,L.jsxs)(C.Muted,{testID:"nb-preorder-deposit",children:["Pre-order deposit: ",(0,a.gbp)(We.preorders),We.adults?`, plus the group deposit: ${(0,a.gbp)(We.total)} in total`:'',". Staff can waive it."]}):null,(0,n.depositDue)((0,n.depositOf)(h.settings),Y,X)?(0,L.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(h.settings),Y,X))," (",(0,a.gbp)((0,n.depositOf)(h.settings).perPersonPence)," per adult for tables of ",(0,n.depositOf)(h.settings).fromParty,"+ adults",X?`; ${X} ${1===X?'child':'children'} free`:'; children free, and they do not count towards the number that needs a deposit',"). Staff can waive it. Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,L.jsx)(C.Muted,{children:"CoverCharge confirms the guest by email automatically (preview mode: shown in the Outbox, not sent)."}),Me?(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",J,". Try another time: dogs are very welcome then."]}):null,(0,L.jsx)(C.Button,{label:be.length?be[0]:'Save booking',testID:"nb-save",disabled:!Ne,onPress:()=>{if(R<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,P.needsPatch)(ue),s=ue.tableReq.find(e=>!fe||Se.some(t=>t.table===e)),o=fe?null:(0,B.requestedFreeTable)(ue.tableReq,{date:R,time:J,partySize:Y},pe.tables.map(e=>e.name),je,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:q.trim(),partySize:Y,date:R,time:J,notes:ee.trim(),security:We.total?'deposit':'none',depositPaid:0,...X?{children:X}:{},...We.total?{...(0,$.depositFields)(We),depositPolicy:(0,n.depositWords)((0,n.depositOf)(h.settings),Y,h.name,X).join(' '),depositRefundable:(0,n.depositOf)(h.settings).refundable,depositCutoffHours:(0,n.depositOf)(h.settings).cutoffHours}:{},phone:Ce.pretty,email:le.trim()||void 0,...ne?(0,$.marketingChoice)(le,!0):{},source:re,...e,...Te.find(e=>e.time===J)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...fe?{table:ge??s??Se[0]?.table}:o?{table:o}:{}}).then(e=>(0,z.postNewBookingToKitchen)(e,N)).catch(()=>{}),u?.({date:R,time:J,name:q.trim()}),t()}})]})}},1096,[812,1097,1098,843,851,841,1099,1100,1101,1102,17,842,385,85,856,1055,858,1103,1074,863,804,848,777,996,993,1104,1105,1077,1053,1076,1094,1093,1111,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return R}}),_e.useTableNames=W,_e.resetTableLive=E,_e.seatBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'seated'),E(e,t.table)},_e.finishBookingNow=async function(e,t){const s=(new Date).toISOString();await k.repo.bookings.update(t.id,(0,N.finishClearPatch)(s,t.table)),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=_,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return H}}),_e.TablePicker=U,_e.WalkInSheet=G,_e.AssignTableSheet=V,_e.undoNotice=Y,_e.NewBookingSheet=K,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[n,i]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>i({b:e}),combineTables:e=>i({b:e,combine:!0}),elements:(0,A.jsxs)(A.Fragment,{children:[s?(0,A.jsx)(G,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,A.jsx)(K,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,A.jsx)(V,{booking:n.b,combine:n.combine,onClose:()=>i(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),z=_r(_d[29]),B=_r(_d[30]),M=_r(_d[31]),N=_r(_d[32]),L=_r(_d[33]),A=_r(_d[34]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),R=Array.from({length:12},(e,t)=>String(t+1));function W(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function E(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function _(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=W(e),a=(0,v.useFloor)(t=>t.live[e])??{},n=(0,v.usePlan)(e),i=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(i,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const H=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function U({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=n?6:8,f=n?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(i??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,A.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],i=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!i,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,A.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:i?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,A.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,A.jsx)(C.T,{weight:"bold",size:22,colour:i?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,A.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,A.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,A.jsx)(C.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const q=[1,2,3,4,5,6,7,8];function G({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:r,r:d,now:u}=(0,y.useCtx)(15e3),x=_(r,u),[T,I]=(0,c.useState)(2),[P,$]=(0,c.useState)(!1),[O,z]=(0,c.useState)(i??null),B=(0,v.usePlan)(r),N=(0,k.useBookings)(r),L=(0,D.useBlocks)(e=>e.blocks),R=(0,D.closedAreasAt)(L,r,(0,w.ymd)(u),(0,w.hm)(u)),W=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(x).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(B,N.filter(e=>e.date===(0,w.ymd)(u)),e,T,u,(0,j.turnFor)(T,d.settings.turnMins),90,void 0,{closed:R})?.table??null},[B,N,x,T,R.size,u.getTime()]);(0,c.useEffect)(()=>{O&&(0,v.tablesOf)(O).some(e=>'Closed'===x[e]?.label)&&z(null)},[O,R.size]);const[H,G]=(0,c.useState)(!1),[V,Y]=(0,c.useState)(''),K=(e,t=String(e),s=()=>{$(!1),I(e)})=>{const o='9+'===t?P:!P&&T===e;return(0,A.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,A.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},Q=(0,A.jsx)(s.PartySizeInput,{value:T,onChange:I,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),X=(0,A.jsxs)(m.default,{style:{gap:8,width:n?256:void 0},children:[(0,A.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,A.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[q.map(e=>K(e)),K(9,'9+',()=>{$(!0),I(e=>e>=9?e:9)})]}),P?Q:null]}),[J,Z]=(0,c.useState)(!1),ee=async(t=O)=>{if(!J&&(0,M.guardBookingChange)(F)){Z(!0);try{const s=await k.repo.bookings.seatWalkIn(r,T,t??void 0,V);E(r,t??void 0),a(s),e()}finally{Z(!1)}}},te=(0,A.jsxs)(m.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,A.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,A.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),O?(0,A.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>z(null)}):null]}),(0,A.jsx)(U,{use:x,value:O,onPick:e=>{x[e]&&!x[e].busy?ee(e):z(O===e?null:e)},big:n,dense:n,best:W,bestSet:(0,h.bestTables)(B)}),(0,A.jsxs)(C.Muted,{children:["Tap a free table to seat them there",W&&!O?` (suggested for ${T}: ${(0,l.tableNumbers)(W)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(u)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,A.jsx)(C.Button,{label:`Seat walk-in \xb7 ${T} ${1===T?'person':'people'}${O?` \xb7 ${(0,l.tableNumbers)(O)}`:''}`,disabled:J,onPress:()=>{ee()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,A.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[X,te]}):(0,A.jsxs)(A.Fragment,{children:[X,te]}),(0,A.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[H?(0,A.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:V,onChangeText:Y,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,A.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,A.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,A.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function V({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,y.useCtx)(15e3),i=_(o,n),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(n)),t,e.partySize,n,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,n.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),P=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,$=D.reduce((e,t)=>e+P(t),0),O=D.length>0&&${if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&E(o,l),t()},B=x?(0,A.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,A.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,A.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${$} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,A.jsx)(m.default,{testID:"combine-short",children:(0,A.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-$," more needed. Add another table."]})}):null,(0,A.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,A.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,A.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,A.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,A.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,A.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${H(e)}`,testID:"assign-table-sheet",footer:B,children:[f&&!x?(0,A.jsx)(m.default,{testID:"assign-suggested",children:(0,A.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,A.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,A.jsx)(U,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function Y(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${H(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function K({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:N}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const R=(0,w.ymd)(p),[W,E]=(0,c.useState)(ee.blocks),[U,q]=(0,c.useState)(!1),[G,V]=(0,c.useState)(''),[Y,K]=(0,c.useState)(2),[Q,X]=(0,c.useState)(0),J=Math.min(Q,Math.max(0,Y-1)),[Z,ee]=(0,c.useState)(null),[te,se]=(0,c.useState)(''),[oe,le]=(0,c.useState)(''),[ae,ne]=(0,c.useState)(''),[ie,re]=(0,c.useState)(!1),[de,ue]=(0,c.useState)('phone'),[ce,be]=(0,c.useState)([]),[ge,he]=(0,c.useState)(''),[pe,me]=(0,c.useState)((0,P.emptyNeeds)()),fe=(0,P.needsMissing)(pe),[ye,ke]=(0,c.useState)(null),xe=(0,v.usePlan)(b),je=(0,O.dogSetUp)(xe),we=!0===pe.dog&&je,Se=pe.dog?pe.dogs:0,Te=(0,w.parseYmd)(W),Ce=(0,j.turnFor)(Y,h.settings.turnMins),ve=_.filter(e=>e.date===W),De=e=>(0,j.dogTablesAt)(xe,ve,Y,(0,j.slotStart)(W,e),Ce,h.settings.turnMins,(0,D.closedAreasAt)(H,b,W,e)),Ie=we&&Z?De(Z):[];(0,c.useEffect)(()=>{ke(null)},[we,Z,Y]);const Pe=(0,x.bookingSlots)(h,Te,e=>_.filter(t=>t.date===W&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Y,W===(0,w.ymd)(p)?p:(0,w.addMins)(Te,0),e=>_.filter(t=>t.date===W&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),$e=(0,T.guestPhone)(oe),[Oe,ze]=(0,c.useState)(!1),Be=Z?Pe.find(e=>e.time===Z):void 0,Me=Be&&Be.left=2&&!!Z&&(!Le||Oe)&&(0,o.validParty)(Y)&&$e.ok&&(0,T.emailOk)(ae)&&(!Ae||Fe&&U)&&(!we||Ie.length>0)&&!Re,Ee=pe.wheelchair>0||pe.stepFree,He=(0,$.bookingRulesOf)(h),Ue=(0,$.largeGroupTables)(He,Y),qe=(0,$.dogPartyCheck)(He,Y,!0===pe.dog,pe.assistDog),Ge=(0,$.bookingDepositSplit)((0,n.depositOf)(h.settings),Y,J,(0,P.needsPatch)(pe),(0,O.reservablesOf)(h));return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(Te)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,A.jsx)(P.FirstQuestions,{rid:b,value:pe,onChange:me,party:Y,audience:"staff"}),pe.dog&&!je?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,A.jsx)(I.BookingDatePicker,{r:h,today:p,value:W,onChange:e=>{e!==W&&(E(e),ee(null),q(!1))}}),(0,A.jsxs)(C.Row,{gap:6,children:[(0,A.jsx)(C.Chip,{label:"Phone",selected:'phone'===de,onPress:()=>ue('phone')}),(0,A.jsx)(C.Chip,{label:"In person",selected:'in-person'===de,onPress:()=>ue('in-person')})]}),(0,A.jsx)(C.Field,{label:"Name",value:G,onChangeText:V,placeholder:"e.g. Reid",testID:"nb-name"}),(0,A.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:oe,onChangeText:le,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!$e.ok&&oe?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:$e.error}):null,(0,A.jsx)(C.Field,{label:"Email (optional)",value:ae,onChangeText:ne,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email",testID:"nb-email"}),(0,T.emailOk)(ae)?null:(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),ae.trim()&&He.marketingOptIn?(0,A.jsx)(C.Toggle,{label:He.marketingWords,value:ie,onChange:re,testID:"nb-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,A.jsx)(i.AdultsChildren,{value:(0,r.peopleOf)(Y,J),onChange:e=>{K(e.partySize),X(e.children),ze(!1)},depositsOn:(0,n.depositOf)(h.settings).on&&(0,n.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,children:Pe.map(e=>{const t=we&&e.available&&!De(e.time).length||!(0,P.dogTimeOk)(h,_,W,e.time,Se);return(0,A.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(H,b,W,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:Z===e.time,onPress:()=>{ee(e.time),q(!1),ze(!1)}},e.time)})}),Le?(0,A.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[Me?(0,A.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Y,Me.left,Me.time)}):null,Ne?(0,A.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)(Ne.time,Ne.cap)}):null,(0,A.jsx)(C.Chip,{label:Oe?'Booking over the limit: on':'Book anyway (over the limit)',selected:Oe,onPress:()=>ze(e=>!e),testID:"nb-over-ok"})]}):null,we&&Z?(0,A.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,A.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,A.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",xe.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),Ie.length?xe.areas.filter(e=>Ie.some(t=>t.area===e.name)).map(e=>(0,A.jsxs)(m.default,{style:{gap:6},accessibilityLabel:e.name,children:[(0,A.jsxs)(C.T,{size:13,center:!0,colour:S.colours.muted,children:[e.name,e.outdoor?' (outdoor)':'']}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,children:Ie.filter(t=>t.area===e.name).map(e=>{const t=Ie[0]?.table===e.table;return(0,A.jsx)(C.Chip,{testID:`nb-dog-table-${(0,l.tableNumbers)(e.table)}`,label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.seats} seats${t?' \xb7 best':''}${Ee&&(0,O.accessibleSetUp)(xe)&&!(0,O.isAccessible)(xe,e.table)?' \xb7 not step-free':''}`,selected:(ye??Ie[0].table)===e.table,onPress:()=>ke(e.table)},e.table)})})]},e.id)):(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Y," at ",Z,". Try another time."]})]}):null,Ae?(0,A.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,A.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",Ae.from,"\u2013",Ae.to,Ae.reason?` (${Ae.reason})`:'']}),Fe?(0,A.jsx)(C.Chip,{label:U?'Manager override on':'Override and book anyway',selected:U,onPress:()=>q(e=>!e)}):(0,A.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,Pe.length?null:(0,A.jsx)(m.default,{testID:"nb-closed",children:(0,A.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(Te)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,A.jsx)(P.MoreQuestions,{rid:b,r:h,value:pe,onChange:me,party:Y,date:W,time:Z,today:(0,w.ymd)(p),bookings:_,audience:"staff",showTables:!1!==h.settings.tableRequests}),Ee&&!(0,O.accessibleSetUp)(xe)?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,Ue&&!we?(0,A.jsxs)(C.T,{size:14,colour:S.colours.goldLight,testID:"nb-large-group",children:["Large group: tables ",Ue.join(' + ')," joined."]}):null,qe.ok?null:(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,testID:"nb-dog-cap",children:["Online, a dog booking is for up to ",He.dogMaxParty," people. You can still book it here: check where they can sit."]}),(0,A.jsx)(C.T,{size:16,center:!0,children:"VIP or regular"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:L.TAGS.map(e=>{const t=ce.includes(e);return(0,A.jsx)(C.Chip,{label:e,selected:t,testID:`nb-tag-${e}`,onPress:()=>be(t?ce.filter(t=>t!==e):[...ce,e].sort())},e)})}),(0,A.jsx)(C.T,{size:16,center:!0,children:"Occasion"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:L.OCCASIONS.map(e=>(0,A.jsx)(C.Chip,{label:e.label,selected:ge===e.id,testID:`nb-occasion-${e.id||'none'}`,onPress:()=>he(e.id)},e.id||'none'))}),(0,A.jsx)(C.Field,{label:"Notes (optional)",value:te,onChangeText:se,placeholder:He.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"nb-notes"}),Ge.preorders?(0,A.jsxs)(C.Muted,{testID:"nb-preorder-deposit",children:["Pre-order deposit: ",(0,a.gbp)(Ge.preorders),Ge.adults?`, plus the group deposit: ${(0,a.gbp)(Ge.total)} in total`:'',". Staff can waive it."]}):null,(0,n.depositDue)((0,n.depositOf)(h.settings),Y,J)?(0,A.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(h.settings),Y,J))," (",(0,a.gbp)((0,n.depositOf)(h.settings).perPersonPence)," per adult for tables of ",(0,n.depositOf)(h.settings).fromParty,"+ adults",J?`; ${J} ${1===J?'child':'children'} free`:'; children free, and they do not count towards the number that needs a deposit',"). Staff can waive it. Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,A.jsx)(C.Muted,{children:"CoverCharge confirms the guest by email automatically (preview mode: shown in the Outbox, not sent)."}),Re?(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",Z,". Try another time: dogs are very welcome then."]}):null,(0,A.jsx)(C.Button,{label:fe.length?fe[0]:'Save booking',testID:"nb-save",disabled:!We,onPress:()=>{if(W<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,P.needsPatch)(pe),s=pe.tableReq.find(e=>!we||Ie.some(t=>t.table===e)),o=we?null:(0,B.requestedFreeTable)(pe.tableReq,{date:W,time:Z,partySize:Y},xe.tables.map(e=>e.name),ve,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:G.trim(),partySize:Y,date:W,time:Z,notes:te.trim(),security:Ge.total?'deposit':'none',depositPaid:0,...J?{children:J}:{},...Ge.total?{...(0,$.depositFields)(Ge),depositPolicy:(0,n.depositWords)((0,n.depositOf)(h.settings),Y,h.name,J).join(' '),depositRefundable:(0,n.depositOf)(h.settings).refundable,depositCutoffHours:(0,n.depositOf)(h.settings).cutoffHours}:{},phone:$e.pretty,email:ae.trim()||void 0,...ie?(0,$.marketingChoice)(ae,!0):{},source:de,...e,...Pe.find(e=>e.time===Z)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...ce.length?{tags:ce}:{},...ge?{occasion:ge}:{},...we?{table:ye??s??Ie[0]?.table}:o?{table:o}:{}}).then(e=>(0,z.postNewBookingToKitchen)(e,N)).catch(()=>{}),u?.({date:W,time:Z,name:G.trim()}),t()}})]})}},1096,[812,1097,1098,843,851,841,1099,1100,1101,1102,17,842,385,85,856,1055,858,1103,1074,863,804,848,777,996,993,1104,1105,1077,1053,1076,1094,1093,1111,1112,8]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,S]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{S(String(e))},[e]);const T=e=>p((0,s.clampParty)(e,b,y)),$=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>T(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:u.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(c.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:u.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?$(-10,'\u221210',"10 fewer people"):null,$(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{S(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&T((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);S(String(e)),T(e)},returnKeyType:"done",blurOnSubmit:!0,onSubmitEditing:e=>{e?.target?.blur?.()},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:u.colours.border,color:u.colours.text,backgroundColor:u.colours.surface,textAlign:'center',fontSize:20,fontFamily:u.fonts.semibold}}),$(1,'+','One more person'),y-b>=20?$(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),u=r(_d[5]),c=r(_d[6]),d=r(_d[7])},1097,[17,385,395,85,1098,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"overCapacityNote",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"overPartiesNote",{enumerable:!0,get:function(){return b}});const t=100,n=1,o=`Bookings are for ${n} to ${t} people.`,u=o=>'number'==typeof o&&Number.isInteger(o)&&o>=n&&o<=t,c=(o,u=n,c=t)=>{const s=parseInt(String(o??'').replace(/\D/g,'').slice(0,4),10);return Math.max(u,Math.min(c,Number.isFinite(s)?s:u))},s=(o,u=n,c=t)=>Math.max(u,Math.min(c,Math.round(Number(o)||u))),f=(t,n,o)=>n<=0?`${o} is already full for booked Covers. Booking ${t} more goes over the venue\u2019s limit: check tables and staffing.`:`${t} is more than the ${n} Covers left at ${o}. Booking goes over the venue\u2019s limit by ${t-n}: check tables and staffing.`,b=(t,n)=>`${t} already has the most bookings we take at one start time (${n}). Booking another goes over the venue\u2019s limit: check tables and staffing.`},1098,[]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdultsChildren=function({value:e,onChange:t,depositsOn:h,testID:x="people"}){const p=e=>t((0,s.storedPeople)(e)),b=(0,s.totalLine)(e);return(0,o.jsxs)(l.default,{testID:x,style:{gap:8,alignItems:'center',width:'100%'},children:[(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",children:"Adults"}),(0,o.jsx)(n.PartySizeInput,{value:e.adults,min:1,max:(0,s.maxAdults)(e.children),onChange:t=>p({adults:t,children:e.children}),label:"Adults",testID:`${x}-adults`}),(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",children:"Children"}),(0,o.jsx)(n.PartySizeInput,{value:e.children,min:0,max:(0,s.maxKids)(e.adults),onChange:t=>p({adults:e.adults,children:t}),label:"Children",testID:`${x}-children`}),(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",colour:c.colours.goldLight,testID:`${x}-total`,accessibilityLabel:b,children:b}),h?(0,o.jsx)(u.Muted,{center:!0,children:"Children never pay a deposit."}):null]})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4]),c=r(d[5]),o=r(d[6])},1099,[17,85,1100,1097,777,804,8]); @@ -1192,18 +1192,18 @@ __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,"ARM_MS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SELECT_HINT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SELECTED_A11Y",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"TABLE_SELECT_HINT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isArmed",{enumerable:!0,get:function(){return l}}),e.releaseOn=function(n,o,c,u){const b=l(n,o,u);return c?b?{arm:null,action:'move'}:{arm:n&&u-n.at!!n&&n.id===o&&c-n.at!e.signOff),S=k.filter(e=>e.signOff),_=j.map(o.allergenLabel).join(', '),C=e=>e.map(e=>e.name).join(', ')||'none';return(0,f.jsxs)(l.default,{testID:"menu-allergy-check",style:{gap:6,borderWidth:1,borderColor:p.length?h.colours.red:h.colours.border,borderRadius:12,padding:10,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(u.T,{weight:"semibold",children:["Allergy check against the menu (",_,")"]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.red,children:["Contains: ",p.length," dish",1===p.length?'':'es']}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.amber,children:["May contain: ",M.length]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.ok,children:["Free from ",1===j.length?'it':'them'," (signed off): ",S.length]}),w.length?(0,f.jsxs)(u.Muted,{children:[w.length," more awaiting the head chef's sign-off, so not shown as safe."]}):null,(0,f.jsx)(n.default,{testID:"menu-allergy-details",accessibilityRole:"button",onPress:()=>y(!x),hitSlop:6,children:(0,f.jsx)(u.T,{size:14,colour:h.colours.gold,children:x?'Hide dishes':'Show dishes'})}),x?(0,f.jsxs)(l.default,{style:{gap:4},children:[(0,f.jsxs)(u.Muted,{children:["Contains: ",C(p)]}),(0,f.jsxs)(u.Muted,{children:["May contain: ",C(M)]}),(0,f.jsxs)(u.Muted,{children:["Free from: ",C(S)]})]}):null,(0,f.jsx)(u.Muted,{children:'guest'===m?'From the kitchen\u2019s signed-off recipe cards. Specials on the board are checked by staff on the day.':'From the signed-off recipe cards. Specials on the board have their own allergens. Still check with the guest and the kitchen.'})]})};var s=r(d[0]),n=e(r(d[1])),l=e(r(d[2])),t=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8])},1110,[17,385,85,858,845,847,804,777,8]); __d(function(g,r,i,_a,m,_e,d){"use strict";function t(t){return String(t??'').split('+').map(t=>t.trim()).filter(Boolean)}function e(t){return t.length<=1?t[0]??'':2===t.length?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`}function n(n){const o=t(n);return o.length>1?`tables ${e(o)}`:o.length?`table ${o[0]}`:''}Object.defineProperty(_e,'__esModule',{value:!0}),_e.tableWords=n,Object.defineProperty(_e,"RECENT_SEATED_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"FINISH_UNDO_MS",{enumerable:!0,get:function(){return a}}),_e.seatedAgoMs=s,_e.seatedAgoWords=u,_e.needsRecentSeatedWarning=c,_e.finishConfirmPrompt=function(t){const e=t.name.trim()||'This party',n=t.parties&&t.parties>1?t.parties:1,o=t.seated&&c({seatedAt:t.seatedAt},t.now),a=o?u(s({seatedAt:t.seatedAt},t.now)):'',l=f(t.table);if(!t.seated)return`Mark ${e} finished without seating?`;if(n>1){return`${n} parties seated here${o?`, including ${e} seated ${a}`:''}. Mark all finished${l}?`}return o?`${e} seated ${a}. Mark finished${l}?`:`Mark ${e} finished${l}?`},_e.restoreSeatedPrompt=function(t,e){return`${t.trim()||'This party'} is finished. Seat them at ${n(e)}?`},_e.lastTableFromAudit=l,_e.tableForUndo=function(t,e){const n=String(t.table??'').trim();if(n)return n;const o=String(t.lastTable??'').trim();return o||l(e)},_e.finishClearPatch=function(t,e){const n=String(e??'').trim();return{status:'finished',finishedAt:t,table:void 0,...n?{lastTable:n}:{}}},_e.finishUndoPatch=function(t){const e=String(t??'').trim();return{status:'seated',finishedAt:void 0,lastTable:void 0,...e?{table:e}:{table:void 0}}};const o=15,a=15e3;function s(t,e){if(!t.seatedAt)return null;const n=new Date(t.seatedAt).getTime();return Number.isFinite(n)?Math.max(0,e.getTime()-n):null}function u(t){const e=Math.round(t/1e3);if(e<1)return'just now';if(e<60)return`${e} second${1===e?'':'s'} ago`;const n=Math.round(e/60);if(n<60)return`${n} minute${1===n?'':'s'} ago`;const o=Math.round(n/60);return`${o} hour${1===o?'':'s'} ago`}function c(t,e){const n=s(t,e);return null!=n&&n<9e5}function f(t){const e=t?n(t):'';return e?` and set ${e} to needs clearing`:''}function l(t){if(!t?.length)return;const e=[...t].sort((t,e)=>String(e.at??'').localeCompare(String(t.at??'')));for(const t of e){if(t.action&&'tables'!==t.action)continue;const e=String(t.from_value??'').trim(),n=String(t.to_value??'').trim();if(e&&!n)return e.replace(/\+/g,'+')}for(const t of e){if(t.action&&'tables'!==t.action)continue;const e=String(t.to_value??'').trim();if(e)return e;const n=String(t.from_value??'').trim();if(n)return n}}},1111,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FinishConfirm=I,_e.RestoreSeatedConfirm=function({prompt:e,onYes:t,onNo:n}){return(0,k.jsxs)(s.default,{testID:"restore-seated-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:"Yes, seat them",testID:"restore-seated-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"restore-seated-no",onPress:n,style:w})]})},Object.defineProperty(_e,"finishBookingNow",{enumerable:!0,get:function(){return p.finishBookingNow}}),_e.undoFinishedNow=D,_e.restoreFinishedToTable=async function(e,t,s){const o=(0,b.tableKey)(s);await n.repo.bookings.update(t.id,{...(0,f.tablePatch)(o||null),status:'seated',finishedAt:void 0,lastTable:void 0}),o&&(0,p.resetTableLive)(e,o)},_e.offerFinishUndo=F,_e.finishAndOfferUndo=v,_e.finishUnseatedAndOfferUndo=N,_e.FinishButton=function({rid:e,b:s,name:n,allowed:o=!0,hint:c,small:b,bigToast:f,testID:u,label:h="Finished",a11y:p,kind:D="secondary"}){const[F,j]=t.default.useState(!1);if(!o)return null;const x=(0,l.finishConfirmPrompt)({name:n,table:s.table,seatedAt:s.seatedAt,now:new Date,seated:'seated'===s.status});if(F)return(0,k.jsx)(I,{prompt:x,onNo:()=>j(!1),onYes:()=>{j(!1),'seated'===s.status?v(e,[s],n,{big:f,table:s.table}):N(e,s,n,{big:f})}});return(0,k.jsx)(y.Button,{small:b,kind:D,label:h,testID:u,accessibilityLabel:p??`${h}: ${n}`,accessibilityHint:c,disabled:!o,onPress:()=>j(!0),style:b?void 0:w})};var t=e(r(d[0])),s=e(r(d[1])),n=r(d[2]),o=r(d[3]),l=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),u=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]);const w={minHeight:64};function I({prompt:e,onYes:t,onNo:n,yesLabel:o="Yes, finish"}){return(0,k.jsxs)(s.default,{testID:"finish-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:o,testID:"finish-confirm-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"finish-confirm-no",onPress:n,style:w})]})}async function D(e,t,s){const c=(0,l.tableForUndo)(t,s);await n.repo.bookings.update(t.id,(0,l.finishUndoPatch)(c)),c&&(0,o.tablesOf)(c).forEach(t=>o.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function F(e){const t=e.bookings[0];if(!t)return;const s=e.bookings.length>1?`${e.bookings.length} parties finished.`:`${e.name} finished.`,n=e.table?`${(0,c.tableWords)(e.table).replace(/^t/,'T')} needs clearing.`:void 0,o=`finish-undo-${t.id}`;(0,u.notify)({id:o,title:s,body:n,timeoutMs:l.FINISH_UNDO_MS,big:e.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{for(const t of e.bookings)await D(e.rid,{...t,table:void 0,lastTable:t.table||t.lastTable});(0,u.dismissNotice)(o)})()}}]})}async function v(e,t,s,n){const o=n?.table??t.find(e=>e.table)?.table;for(const s of t)await(0,p.finishBookingNow)(e,s);F({rid:e,bookings:t,name:s,table:o,big:n?.big})}async function N(e,t,s,o){await n.repo.bookings.setStatus(t.id,'finished');const c=`finish-undo-${t.id}`;(0,u.notify)({id:c,title:`${s} finished.`,timeoutMs:l.FINISH_UNDO_MS,big:o?.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{await n.repo.bookings.setStatus(t.id,t.walkIn?'cancelled':'confirmed'),(0,u.dismissNotice)(c)})()}}]})}},1112,[17,85,858,996,1111,1113,1094,1090,916,804,777,1096,8]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return s.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return c}}),e.freeTablesNow=function(t,a,s=!1){const l=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),n=l.filter(([,t])=>t.table.maxSeats>=a),o=t=>t.map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}));return s?[...o(n),...o(l.filter(([,t])=>t.table.maxSeatsh[t]&&(l.includes(h[t].status)||'dirty'===h[t].status||'blocked'===h[t].status));if(p.length&&p.every(t=>h[t])&&!t.length)f.push({id:'seat',label:`Seat at ${b(s.table).replace(/^t/,'T')}`,a11y:`Seat ${n}, ${u(s.partySize)}, at ${b(s.table)}`,table:s.table});else if(c(s,$)){const a=p.length?t.length?`${b(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===h[t[0]].status?'waiting to be cleared':'blocked'===h[t[0]].status?'blocked':'in use'}`:`${b(s.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';f.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${n}, ${u(s.partySize)}. ${a}.`,note:a})}c(s,$)&&f.push({id:'finished',label:'Finished',a11y:`Finished, ${n}, ${s.time} booking, without seating at a table`}),o($,s)<=0&&f.push({id:'noshow',label:'No-show',a11y:`No-show, ${n}, ${s.time} booking`})}return f.push({id:'details',label:'Guest details',a11y:`Guest details, ${n}`}),f};var t=r(d[0]),a=r(d[1]),s=r(d[2]);const l=['seated','mains','dessert','bill'],n=t=>new Date(`${t.date}T${t.time}:00`),o=(t,a)=>(n(a).getTime()-t.getTime())/6e4,b=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},u=t=>`${t} ${1===t?'person':'people'}`,c=(t,a)=>o(a,t)<=45},1113,[996,863,1074]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return x}}),_e.cancelWalkInWords=I,_e.reinstateWalkInWords=$,_e.cancelWalkInNow=j,_e.reinstateWalkInNow=C,_e.CancelWalkInButton=function({rid:e,b:t,onDone:o,small:c,big:u}){const[b,f]=(0,n.useState)(!1),k=(0,l.useInStaffApp)(),x=(0,s.useSeatClearFinish)();return p(t)?k&&!x.ok?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(w.Button,{kind:"secondary",small:c,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>f(!0),style:u?{minHeight:64}:c?{minHeight:44}:h}),b?(0,y.jsx)(W,{rid:e,b:t,onClose:()=>f(!1),onDone:o}):null]}):null},_e.CancelWalkInConfirm=W,_e.ReinstateWalkInButton=function({rid:e,b:t,today:o,onDone:u,small:b}){const[f,p]=(0,n.useState)(!1),I=(0,l.useInStaffApp)(),j=(0,s.useSeatClearFinish)();if(!x(t,o))return null;if(I&&!j.ok)return null;const W=$(t);if(!f)return(0,y.jsx)(w.Button,{kind:"ghost",small:b,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>p(!0),style:b?{minHeight:44}:h});return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:()=>p(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:W,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:W})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[h,{flexGrow:1}],onPress:async()=>{await C(e,t),p(!1),u?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>p(!1),style:h})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]),o=r(d[4]),c=(e=o)&&e.__esModule?e:{default:e},u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]),w=r(d[9]),y=r(d[10]);const h={minHeight:56},p=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),x=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function I(e){const t=(0,b.tablesOf)(e.table),n=(0,f.tablesWords)(t);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${t.length?` at ${n}`:''}, arrived ${e.time}? It comes off the Covers${t.length?` and ${n} ${t.length>1?'go':'goes'} back to Free`:''}.`}function $(e){return`Put walk-in ${e.ref} back to seated? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`}async function j(e,n){await u.repo.bookings.setStatus(n.id,'cancelled'),await u.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,b.tablesOf)(n.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function C(e,t){await u.repo.bookings.setStatus(t.id,'seated'),(0,b.tablesOf)(t.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function W({rid:e,b:t,onClose:n,onDone:l}){const s=I(t);return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:s,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:s})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[h,{flexGrow:1}],onPress:async()=>{await j(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,b.tablesOf)(t.table).length?` ${(0,f.tablesWords)((0,b.tablesOf)(t.table))} free.`:''}`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:h})]})]})}},1114,[1115,17,1055,1117,85,858,996,1094,804,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.cancelStamp=C,_e.cancelBookingNow=w,_e.reinstateBookingNow=$,_e.CancelBookingButton=function({rid:e,b:n,name:o,onDone:s,big:l,small:c}){const[u,f]=(0,t.useState)(!1);return(0,b.canCancelBooking)(n)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(x.Button,{kind:"secondary",small:c,label:"Cancel booking",testID:`cancel-booking-${n.id}`,accessibilityLabel:`Cancel booking for ${o}, ${n.time}, ${n.partySize} Covers`,onPress:()=>f(!0),style:l?{minHeight:64}:c?{minHeight:44}:j}),u?(0,h.jsx)(D,{rid:e,b:n,name:o,onClose:()=>f(!1),onDone:s}):null]}):null},_e.CancelBookingConfirm=D,_e.ReinstateBookingButton=function({b:e,name:n,today:s,onDone:l}){const[c,u]=(0,t.useState)(!1);if(!(0,b.canReinstateBooking)(e,s))return null;const y=(0,b.reinstateBookingWords)(e,n);if(!c)return(0,h.jsx)(x.Button,{kind:"ghost",label:"Undo cancel",testID:`reinstate-booking-${e.id}`,accessibilityLabel:`Undo cancel for ${n}`,onPress:()=>u(!0),style:j});return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:()=>u(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center'},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, put back to booked",testID:"reinstate-booking-yes",accessibilityLabel:`Yes, put ${n} back to booked`,style:[j,{flexGrow:1}],onPress:async()=>{await $(e),u(!1),l?.(`${n} put back to booked.`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-booking-no",onPress:()=>u(!1),style:j})]})]})};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]),c=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]),y=r(d[8]),k=r(d[9]),p=r(d[10]),x=r(d[11]),h=r(d[12]);const j={minHeight:56},B={display:'Display',owner:'Managers app',staff:'Staff app',chef:'Kitchen app',customer:'Customer page'};function C(e){const t=y.useSession.getState().meId,n=t?k.useOwner.getState().staff.find(e=>e.id===t):void 0,o=B[p.APP_VARIANT]??'CoverCharge';return{by:n?`${n.name.replace(' (example)','')} (${o})`:o,at:(new Date).toISOString(),app:o,...e.table?{table:e.table}:{}}}async function w(e,t){const n=(0,l.tablesOf)(t.table);await s.repo.bookings.update(t.id,{status:'cancelled',cancelled:C(t),...(0,c.tablePatch)(null)}),n.forEach(t=>l.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function $(e){await s.repo.bookings.setStatus(e.id,'confirmed')}function D({rid:e,b:t,name:n,onClose:s,onDone:c}){const y=(0,b.cancelBookingWords)(t,n),k=(0,l.tablesOf)(t.table);return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:s,title:"Cancel booking?",maxWidth:560,testID:"cancel-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center',gap:8},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, cancel booking",testID:"cancel-booking-yes",accessibilityLabel:`Yes, cancel booking for ${n}`,style:[j,{flexGrow:1}],onPress:async()=>{await w(e,t),s(),c?.(`${n} cancelled.${k.length?` ${(0,u.tablesWords)(k)} free.`:''}`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep booking",testID:"cancel-booking-no",accessibilityLabel:`Keep booking for ${n}`,onPress:s,style:j})]})]})}},1115,[17,85,858,996,1090,1116,1094,804,920,876,856,777,8]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canCancelBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canReinstateBooking",{enumerable:!0,get:function(){return t}}),e.cancelBookingWords=function(n,t){const o=`${n.partySize} Cover${1===n.partySize?'':'s'}`;return`Cancel booking for ${t}, ${n.time}, ${o}? The table is freed. Website bookings will cancel it on the website and may email the guest.`},e.reinstateBookingWords=function(n,t){return`Put ${t} back to booked for ${n.time}? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`},e.cancelledOnDay=o,e.cancelledDayTally=function(n,t){const a=o(n,t),l=a.filter(n=>!!n.walkIn),c=a.filter(n=>!n.walkIn);return{count:a.length,covers:a.reduce((n,t)=>n+t.partySize,0),bookings:c.length,bookingCovers:c.reduce((n,t)=>n+t.partySize,0),walkIns:l.length,walkInCovers:l.reduce((n,t)=>n+t.partySize,0),list:a}},e.cancelledTallyWords=function(n,t="today"){if(!n.count)return`No cancellations ${t}`;const o=[],a=n.bookings??0,l=n.walkIns??0;a&&o.push(`${a} booking${1===a?'':'s'} (${n.bookingCovers??0} Cover${1===(n.bookingCovers??0)?'':'s'})`);l&&o.push(`${l} walk-in${1===l?'':'s'} (${n.walkInCovers??0} Cover${1===(n.walkInCovers??0)?'':'s'})`);if(!o.length)return`Cancelled ${t}: ${n.count} \xb7 ${n.covers} Cover${1===n.covers?'':'s'}`;return`Cancelled ${t}: ${o.join(' \xb7 ')}`};const n=n=>!n.walkIn&&('confirmed'===n.status||'pending'===n.status||'seated'===n.status),t=(n,t)=>!n.walkIn&&'cancelled'===n.status&&n.date>=t;function o(n,t){return n.filter(n=>n.date===t&&'cancelled'===n.status).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name))}},1116,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSeatClearFinish=function(){const t=(0,A.useSignedIn)(),o=(0,A.useInStaffApp)(),_='staff'===s.APP_VARIANT||'chef'===s.APP_VARIANT||o,l=(0,c.canSeatClearFinish)({device:s.IS_CAR||'display'===s.APP_VARIANT||!_&&!t,viaDisplay:(0,n.isKitchenViaDisplay)(),role:t?.role,ownerAccess:t?.ownerAccess,managerAccess:t?.managerAccess});return{ok:l,hint:l?void 0:c.SEAT_CLEAR_HINT}};var s=r(d[0]),n=r(d[1]),c=r(d[2]),A=r(d[3])},1117,[856,922,1118,1055]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEAT_CLEAR_HINT",{enumerable:!0,get:function(){return n}}),e.canSeatClearFinish=function(n){return!(!n.device&&!n.viaDisplay)||('owner'===n.role||'manager'===n.role||!(!n.ownerAccess&&!n.managerAccess))};const n='Ask a manager to seat, finish or clear a table.'},1118,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:s,who:i,role:n,inStaffApp:l,shiftManager:a,big:o,testID:d}){const[h,u]=(0,t.useState)(!1),p=(0,b.useSession)(e=>e.meId),y=(0,m.useOwner)(e=>e.staff.find(e=>e.id===p&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:l,role:n,shiftManager:a})||p&&!(0,x.canChangeBookings)(y)?null:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:d??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),h?(0,N.jsx)(V,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:n,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,l.useBookings)(e).filter(e=>!e.walkIn&&e.date>=s&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,200);return o?(0,N.jsx)(V,{rid:e,id:o,who:i,hidePrivate:a,onClose:n}):(0,N.jsxs)(z.Sheet,{visible:!0,onClose:n,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,N.jsx)(z.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${L(e.date,s)} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${L(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,N.jsx)(z.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,N.jsx)(z.Button,{kind:"ghost",label:"Close",onPress:n,style:{minHeight:44}})]})},_e.EditBookingSheet=V;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=(e=i)&&e.__esModule?e:{default:e},l=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),f=_r(_d[19]),C=_r(_d[20]),I=_r(_d[21]),k=_r(_d[22]),w=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),O=_r(_d[28]),W=_r(_d[29]),z=_r(_d[30]),B=_r(_d[31]),N=_r(_d[32]);const E=/^([01]\d|2[0-3]):[0-5]\d$/,R=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const L=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,D.ymd)(s)?'Tomorrow':F(e)};const A=e=>e?(e/100).toFixed(e%100?2:0):'',M=e=>{const t=(0,B.parseMoneyInput)(e);return null!=t&&t>=0?Math.round(100*t):NaN},F=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',H=e=>{const t=e.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);return t?`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`:''},_=e=>e.charAt(0).toUpperCase()+e.slice(1);function Y({title:e,children:t,testID:s}){return(0,N.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,N.jsx)(z.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const G=({label:e,value:t,onChange:s,max:i=20,testID:n})=>(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:e}),(0,N.jsx)(z.Stepper,{testID:n,value:t,min:0,max:i,onChange:s,label:e})]});function V({rid:e,id:i,who:b,onClose:m,hidePrivate:x=!1}){(0,$.useBlurOutside)();const B=(0,l.useBookings)(e),L=B.find(e=>e.id===i),V=(0,d.useRestaurant)(e),K=(0,a.usePlan)(e),U=(0,o.useBlocks)(e=>e.blocks),[q,X]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Q,J]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Z,ee]=(0,t.useState)(!1),[te,se]=(0,t.useState)(null),[ie,ne]=(0,t.useState)(null),[le,ae]=(0,t.useState)(!1),[oe,de]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositDue:0)),[re,ce]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositAmount:0)),[he,ue]=(0,t.useState)(F(L?(0,c.draftOf)(L).depositDate:''));if(!L||!q||!V)return null;const pe=e=>{se(null),ne(null),X({...q,...e})},ge=(0,O.depositOf)(V.settings),be=e=>{const t=e.partySize??q.partySize,s=Math.min(e.children??q.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(L)&&q.depositOn&&!q.depositPaid&&M(oe||'0')===(0,O.depositDue)(ge,q.partySize,q.children??0)){const e=(0,O.depositDue)(ge,t,s);e>0&&de(A(e))}pe({...e,children:s})},me=(0,v.bookingSlotMinutesOf)(V),xe=R(q.time),ye=E.test(xe),je=q.area?K.areas.filter(e=>e.name===q.area).map(e=>e.id):null,De=e=>!je||e.split('+').every(e=>je.includes(K.tables.find(t=>t.name===e)?.areaId??'')),ve=(0,y.tableOptions)(K,B.filter(e=>e.date===q.date),q.table).filter(e=>De(e)||e===q.table),fe=!(q.depositOn&&(Number.isNaN(M(oe||'0'))||q.depositPaid&&(Number.isNaN(M(re||'0'))||he.trim()&&!H(he)))),Ce={...q,time:xe,depositDue:M(oe||'0')||0,depositAmount:M(re||'0')||0,depositDate:H(he)},Ie=(0,c.changedDraftFields)(Q??(0,c.draftOf)(L),Ce),ke=V.settings.turnMins??90,we=!!q?.email?.trim()&&q.email.trim()!==(L?.email??'').trim(),Te=(0,u.bookingRulesOf)(V),Se=async()=>{const t=(0,c.editPatch)(L,Ce,{by:b||'Team member',app:r.APP_VARIANT});if(le&&we&&Object.assign(t,(0,u.marketingChoice)(Ce.email,!0)),Object.keys(t).length&&await l.repo.bookings.update(L.id,t),'seated'===L.status&&'table'in t&&t.table!==L.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(L.table),n=s(t.table),l=a.useFloor.getState(),o=i.map(t=>l.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!n.includes(e)).forEach(t=>l.setLive(e,t,{stage:void 0,dirty:!0})),n.forEach(t=>l.setLive(e,t,{stage:o,dirty:!1}))}ne(`Saved. Changed: ${(0,c.editedWords)(Ie)}.`),se(null),m()},$e=()=>{const t=ye?(0,o.blockAt)(U,e,q.date,xe):void 0,s=(0,c.editWarnings)(L,Ce,B,t,ke,K);!s.length||te?Se():se(s)},Pe=q.allergies??[],Oe=e=>pe({allergyNone:!1,allergies:Pe.some(t=>t.allergen===e)?Pe.filter(t=>t.allergen!==e):[...Pe,{allergen:e,severity:'allergy'}]}),We=(0,c.historyLines)(L);return(0,N.jsxs)(z.Sheet,{visible:!0,onClose:()=>{Ie.length?ee(!0):(ee(!1),m())},title:`Edit booking \xb7 ${L.name} \xb7 ${L.ref}`,maxWidth:760,testID:"edit-booking-sheet",onTypingDone:()=>{(0,C.hideKeyboard)(),Ie.length&&ye&&fe&&q.name.trim().length>=1&&$e()},typingDoneLabel:Ie.length?'Done, save changes':'Done, hide the keyboard',footer:(0,N.jsx)(z.Button,{label:te?'Save anyway':'Save changes',testID:"edit-save",disabled:!ye||!fe||q.name.trim().length<1||!Ie.length,onPress:$e,style:{minHeight:56,width:'100%'}}),children:[(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(w.DepositChip,{b:L,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(L)?(0,N.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,N.jsxs)(Y,{title:"Deposit",testID:"edit-section-deposit",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No deposit",selected:!q.depositOn,testID:"edit-deposit-none",onPress:()=>pe({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit due",selected:!!q.depositOn&&!q.depositPaid&&!q.depositWaived,testID:"edit-deposit-due",onPress:()=>pe({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit paid",selected:!!q.depositOn&&!!q.depositPaid,testID:"edit-deposit-paid",onPress:()=>{re||ce(oe),he||ue(F((0,D.ymd)(new Date))),pe({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsx)(z.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsxs)(z.T,{size:15,center:!0,colour:j.colours.goldLight,testID:"edit-deposit-waived-by",children:[L.depositWaived?.by?(0,O.waiverText)(L.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,q.depositWaived||Ie.includes('deposit')?null:(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(P.WaiveDepositButton,{b:L,who:b,onDone:e=>{const t={...q,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e};X(t),J(s=>s?{...s,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e}:t)}})}),q.depositOn?(0,N.jsx)(z.Field,{money:!0,label:"Deposit due (\xa3)",value:oe,onChangeText:e=>{de(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,q.depositOn&&q.depositPaid?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Field,{money:!0,label:"Amount paid (\xa3)",value:re,onChangeText:e=>{ce(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"How was it paid?"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,N.jsx)(z.Chip,{label:_(e),selected:q.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>pe({depositMethod:e})},e))}),(0,N.jsx)(z.Field,{label:"Date paid (DD/MM/YYYY)",value:he,onChangeText:e=>{ue((0,s.slashDate)(e,he)),pe({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),he.trim()&&!H(he)?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,fe?null:(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,N.jsx)(z.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,N.jsxs)(Y,{title:"When",testID:"edit-section-when",children:[(0,N.jsx)(k.BookingDatePicker,{r:V,today:new Date,value:q.date,onChange:e=>pe({date:e})}),(0,N.jsx)(I.TimeRoller,{testID:"edit-time",value:(0,f.snapTime)(q.time,me),onChange:e=>pe({time:e}),step:me}),ye?null:(0,N.jsx)(z.T,{size:15,colour:j.colours.amber,center:!0,children:"Choose a time on the roller."}),(0,N.jsx)(T.AdultsChildren,{value:(0,S.peopleOf)(q.partySize,q.children),onChange:e=>be(e),depositsOn:ge.on&&ge.perPersonPence>0,testID:"edit-people"}),(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:"Table time"}),(0,N.jsx)(z.Stepper,{testID:"edit-duration",value:q.duration||0,min:0,max:360,step:15,onChange:e=>pe({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,N.jsxs)(Y,{title:"Where",testID:"edit-section-where",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"Any area",selected:!q.area,testID:"edit-area-any",onPress:()=>pe({area:''})}),K.areas.map(e=>(0,N.jsx)(z.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:q.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>pe({area:e.name})},e.id))]}),(0,N.jsx)(z.T,{size:18,weight:"semibold",center:!0,children:(0,y.tableButtonLabel)(q.table)}),(0,y.splitChoices)(q.table).length?(0,N.jsxs)(n.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:"Split the joined tables"}),(0,N.jsx)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,y.splitChoices)(q.table).map(e=>(0,N.jsx)(z.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>pe({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:q.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(q.table?'':', chosen'),onPress:()=>pe({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),ve.map(e=>(0,N.jsx)(z.Button,{kind:e===q.table?'primary':'secondary',label:(0,y.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,y.tableButtonLabel)(e)}${e===q.table?', chosen':''}`,onPress:()=>pe({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,N.jsxs)(Y,{title:"Guest",testID:"edit-section-guest",children:[(0,N.jsx)(z.Field,{label:"Name",value:q.name,onChangeText:e=>pe({name:e}),testID:"edit-name"}),(0,N.jsx)(z.Field,{label:"Phone",value:q.phone,onChangeText:e=>pe({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,N.jsx)(z.Field,{label:"Email",value:q.email,onChangeText:e=>pe({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),we&&Te.marketingOptIn?(0,N.jsx)(z.Toggle,{label:Te.marketingWords,value:le,onChange:ae,testID:"edit-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,N.jsx)(z.T,{size:16,center:!0,children:"Booked by"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>pe({source:e.id})},e.id))}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(q.tags??[]).includes(e);return(0,N.jsx)(z.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>pe({tags:t?(q.tags??[]).filter(t=>t!==e):[...q.tags??[],e].sort()})},e)})})]}),(0,N.jsxs)(Y,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,N.jsx)(G,{label:"Dogs",value:q.dogs??0,max:6,onChange:e=>pe({dogs:e}),testID:"edit-dogs"}),(0,N.jsx)(G,{label:"High chairs",value:q.highChairs??0,max:10,onChange:e=>pe({highChairs:e}),testID:"edit-high-chairs"}),(0,N.jsx)(G,{label:"Wheelchair users",value:q.wheelchair??0,max:10,onChange:e=>pe({wheelchair:e}),testID:"edit-wheelchair"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"Occasion"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:(q.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>pe({occasion:e.id})},e.id||'none'))})]}),(0,N.jsxs)(Y,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No allergies",selected:!!q.allergyNone&&!Pe.length,testID:"edit-allergy-none",onPress:()=>pe({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,N.jsx)(z.Chip,{label:e.short,selected:Pe.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>Oe(e.id)},e.id))]}),Pe.map(e=>(0,N.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,N.jsxs)(z.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,N.jsx)(z.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>pe({allergies:Pe.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,N.jsx)(z.Field,{label:"Anything else about allergies",value:q.allergyNote,onChangeText:e=>pe({allergyNote:e}),testID:"edit-allergy-note"}),Ie.includes('allergies')&&Pe.length?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,N.jsx)(G,{label:"Vegan",value:q.vegan??0,max:q.partySize,onChange:e=>pe({vegan:e}),testID:"edit-vegan"}),(0,N.jsx)(G,{label:"Vegetarian",value:q.vegetarian??0,max:q.partySize,onChange:e=>pe({vegetarian:e}),testID:"edit-vegetarian"})]}),(q.holds??[]).length||(L.holds??[]).some(e=>e.qty>0&&!e.served)?(0,N.jsxs)(Y,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,N.jsx)(z.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(q.holds??[]).map(e=>{const t=(0,h.reservablesOf)(V),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),l=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,N.jsxs)(n.default,{testID:l,style:{gap:6,width:'100%'},children:[(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,N.jsx)(z.Stepper,{testID:l,value:e.qty,min:0,max:20,onChange:t=>pe({holds:(0,c.setEditableHoldQty)(q.holds??[],e.kind,e.id,t)}),label:i})]}),(0,N.jsx)(z.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${l}-remove`,onPress:()=>pe({holds:(0,c.removeEditableHold)(q.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(q.holds??[]).length?null:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==L.status?(0,N.jsxs)(Y,{title:"Status",testID:"edit-section-status",children:[(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>pe({status:e.id})},e.id))}),(0,N.jsx)(z.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,N.jsx)(Y,{title:"Notes",testID:"edit-section-notes",children:(0,N.jsx)(z.Field,{label:"Notes",value:q.notes,onChangeText:e=>pe({notes:e}),placeholder:Te.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),te?(0,N.jsxs)(n.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[te.map(e=>(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,ie?(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:ie}):null,Z?(0,N.jsxs)(n.default,{testID:"edit-discard-warn",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:j.colours.gold,backgroundColor:j.colours.surface2},children:[(0,N.jsx)(z.T,{size:20,weight:"bold",center:!0,children:"Discard unsaved changes?"}),(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.muted,children:"Your changes have not been saved."}),(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:"secondary",label:"Keep editing",testID:"edit-discard-keep",onPress:()=>ee(!1),style:{minHeight:52,flex:1}}),(0,N.jsx)(z.Button,{kind:"danger",label:"Discard changes",testID:"edit-discard-discard",onPress:()=>{ee(!1),m()},style:{minHeight:52,flex:1}})]})]}):null,We.length?(0,N.jsx)(Y,{title:"Changes",testID:"edit-history",children:We.slice(0,12).map((e,t)=>(0,N.jsx)(z.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,N.jsx)(W.CancelBookingButton,{rid:e,b:L,name:L.name,big:!0,onDone:()=>m()}),(0,N.jsx)(W.ReinstateBookingButton,{b:L,name:L.name,today:(0,D.ymd)(new Date),onDone:()=>m()})]})}},1119,[17,1031,85,858,996,993,860,856,1120,1053,1077,845,920,876,994,1090,804,863,1103,1121,815,1122,1104,1087,1099,1100,1101,1123,841,1115,777,840,8]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedDraftFields=W,_e.changedFields=j,_e.historyText=E,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=j(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:E(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${D(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!j(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return x}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: high chair, birthday, quiet table',o='This booking is on the website too. Saving here updates the website booking. The website may email the guest about a new date, time or status.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],u=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],h=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],k=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),w=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return w(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){return l.filter(i=>M(i,e)!==M(i,t))}function j(e,t){return W(y(e),t)}const A=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,D=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function E(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${A(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=k(o.holds),i=k(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${D(s)}`}const x=e=>e.map(e=>f[e]).join(', ')},1120,[1053,1098,1090,1094]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedDraftFields=W,_e.changedFields=j,_e.historyText=E,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=j(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:E(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${D(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!j(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return x}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: high chair, birthday, quiet table',o='This booking is on the website too. Saving here updates the website booking. The website may email the guest about a new date, time or status.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],u=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],h=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],k=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),w=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return w(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){return l.filter(i=>M(i,e)!==M(i,t))}function j(e,t){return W(y(e),t)}const A=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,D=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function E(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${A(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=k(o.holds),i=k(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${D(s)}`}const x=e=>e.map(e=>f[e]).join(', ')},1112,[1053,1098,1090,1094]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FinishConfirm=I,_e.RestoreSeatedConfirm=function({prompt:e,onYes:t,onNo:n}){return(0,k.jsxs)(s.default,{testID:"restore-seated-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:"Yes, seat them",testID:"restore-seated-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"restore-seated-no",onPress:n,style:w})]})},Object.defineProperty(_e,"finishBookingNow",{enumerable:!0,get:function(){return p.finishBookingNow}}),_e.undoFinishedNow=D,_e.restoreFinishedToTable=async function(e,t,s){const o=(0,b.tableKey)(s);await n.repo.bookings.update(t.id,{...(0,f.tablePatch)(o||null),status:'seated',finishedAt:void 0,lastTable:void 0}),o&&(0,p.resetTableLive)(e,o)},_e.offerFinishUndo=F,_e.finishAndOfferUndo=v,_e.finishUnseatedAndOfferUndo=N,_e.FinishButton=function({rid:e,b:s,name:n,allowed:o=!0,hint:c,small:b,bigToast:f,testID:u,label:h="Finished",a11y:p,kind:D="secondary"}){const[F,j]=t.default.useState(!1);if(!o)return null;const x=(0,l.finishConfirmPrompt)({name:n,table:s.table,seatedAt:s.seatedAt,now:new Date,seated:'seated'===s.status});if(F)return(0,k.jsx)(I,{prompt:x,onNo:()=>j(!1),onYes:()=>{j(!1),'seated'===s.status?v(e,[s],n,{big:f,table:s.table}):N(e,s,n,{big:f})}});return(0,k.jsx)(y.Button,{small:b,kind:D,label:h,testID:u,accessibilityLabel:p??`${h}: ${n}`,accessibilityHint:c,disabled:!o,onPress:()=>j(!0),style:b?void 0:w})};var t=e(r(d[0])),s=e(r(d[1])),n=r(d[2]),o=r(d[3]),l=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),u=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]);const w={minHeight:64};function I({prompt:e,onYes:t,onNo:n,yesLabel:o="Yes, finish"}){return(0,k.jsxs)(s.default,{testID:"finish-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:o,testID:"finish-confirm-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"finish-confirm-no",onPress:n,style:w})]})}async function D(e,t,s){const c=(0,l.tableForUndo)(t,s);await n.repo.bookings.update(t.id,(0,l.finishUndoPatch)(c)),c&&(0,o.tablesOf)(c).forEach(t=>o.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function F(e){const t=e.bookings[0];if(!t)return;const s=e.bookings.length>1?`${e.bookings.length} parties finished.`:`${e.name} finished.`,n=e.table?`${(0,c.tableWords)(e.table).replace(/^t/,'T')} needs clearing.`:void 0,o=`finish-undo-${t.id}`;(0,u.notify)({id:o,title:s,body:n,timeoutMs:l.FINISH_UNDO_MS,big:e.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{for(const t of e.bookings)await D(e.rid,{...t,table:void 0,lastTable:t.table||t.lastTable});(0,u.dismissNotice)(o)})()}}]})}async function v(e,t,s,n){const o=n?.table??t.find(e=>e.table)?.table;for(const s of t)await(0,p.finishBookingNow)(e,s);F({rid:e,bookings:t,name:s,table:o,big:n?.big})}async function N(e,t,s,o){await n.repo.bookings.setStatus(t.id,'finished');const c=`finish-undo-${t.id}`;(0,u.notify)({id:c,title:`${s} finished.`,timeoutMs:l.FINISH_UNDO_MS,big:o?.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{await n.repo.bookings.setStatus(t.id,t.walkIn?'cancelled':'confirmed'),(0,u.dismissNotice)(c)})()}}]})}},1113,[17,85,858,996,1111,1114,1094,1090,916,804,777,1096,8]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return s.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return c}}),e.freeTablesNow=function(t,a,s=!1){const l=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),n=l.filter(([,t])=>t.table.maxSeats>=a),o=t=>t.map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}));return s?[...o(n),...o(l.filter(([,t])=>t.table.maxSeatsh[t]&&(l.includes(h[t].status)||'dirty'===h[t].status||'blocked'===h[t].status));if(p.length&&p.every(t=>h[t])&&!t.length)f.push({id:'seat',label:`Seat at ${b(s.table).replace(/^t/,'T')}`,a11y:`Seat ${n}, ${u(s.partySize)}, at ${b(s.table)}`,table:s.table});else if(c(s,$)){const a=p.length?t.length?`${b(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===h[t[0]].status?'waiting to be cleared':'blocked'===h[t[0]].status?'blocked':'in use'}`:`${b(s.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';f.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${n}, ${u(s.partySize)}. ${a}.`,note:a})}c(s,$)&&f.push({id:'finished',label:'Finished',a11y:`Finished, ${n}, ${s.time} booking, without seating at a table`}),o($,s)<=0&&f.push({id:'noshow',label:'No-show',a11y:`No-show, ${n}, ${s.time} booking`})}return f.push({id:'details',label:'Guest details',a11y:`Guest details, ${n}`}),f};var t=r(d[0]),a=r(d[1]),s=r(d[2]);const l=['seated','mains','dessert','bill'],n=t=>new Date(`${t.date}T${t.time}:00`),o=(t,a)=>(n(a).getTime()-t.getTime())/6e4,b=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},u=t=>`${t} ${1===t?'person':'people'}`,c=(t,a)=>o(a,t)<=45},1114,[996,863,1074]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return x}}),_e.cancelWalkInWords=I,_e.reinstateWalkInWords=$,_e.cancelWalkInNow=j,_e.reinstateWalkInNow=C,_e.CancelWalkInButton=function({rid:e,b:t,onDone:o,small:c,big:u}){const[b,f]=(0,n.useState)(!1),k=(0,l.useInStaffApp)(),x=(0,s.useSeatClearFinish)();return p(t)?k&&!x.ok?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(w.Button,{kind:"secondary",small:c,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>f(!0),style:u?{minHeight:64}:c?{minHeight:44}:h}),b?(0,y.jsx)(W,{rid:e,b:t,onClose:()=>f(!1),onDone:o}):null]}):null},_e.CancelWalkInConfirm=W,_e.ReinstateWalkInButton=function({rid:e,b:t,today:o,onDone:u,small:b}){const[f,p]=(0,n.useState)(!1),I=(0,l.useInStaffApp)(),j=(0,s.useSeatClearFinish)();if(!x(t,o))return null;if(I&&!j.ok)return null;const W=$(t);if(!f)return(0,y.jsx)(w.Button,{kind:"ghost",small:b,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>p(!0),style:b?{minHeight:44}:h});return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:()=>p(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:W,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:W})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[h,{flexGrow:1}],onPress:async()=>{await C(e,t),p(!1),u?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>p(!1),style:h})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]),o=r(d[4]),c=(e=o)&&e.__esModule?e:{default:e},u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]),w=r(d[9]),y=r(d[10]);const h={minHeight:56},p=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),x=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function I(e){const t=(0,b.tablesOf)(e.table),n=(0,f.tablesWords)(t);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${t.length?` at ${n}`:''}, arrived ${e.time}? It comes off the Covers${t.length?` and ${n} ${t.length>1?'go':'goes'} back to Free`:''}.`}function $(e){return`Put walk-in ${e.ref} back to seated? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`}async function j(e,n){await u.repo.bookings.setStatus(n.id,'cancelled'),await u.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,b.tablesOf)(n.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function C(e,t){await u.repo.bookings.setStatus(t.id,'seated'),(0,b.tablesOf)(t.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function W({rid:e,b:t,onClose:n,onDone:l}){const s=I(t);return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:s,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:s})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[h,{flexGrow:1}],onPress:async()=>{await j(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,b.tablesOf)(t.table).length?` ${(0,f.tablesWords)((0,b.tablesOf)(t.table))} free.`:''}`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:h})]})]})}},1115,[1116,17,1055,1118,85,858,996,1094,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.cancelStamp=C,_e.cancelBookingNow=w,_e.reinstateBookingNow=$,_e.CancelBookingButton=function({rid:e,b:n,name:o,onDone:s,big:l,small:c}){const[u,f]=(0,t.useState)(!1);return(0,b.canCancelBooking)(n)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(x.Button,{kind:"secondary",small:c,label:"Cancel booking",testID:`cancel-booking-${n.id}`,accessibilityLabel:`Cancel booking for ${o}, ${n.time}, ${n.partySize} Covers`,onPress:()=>f(!0),style:l?{minHeight:64}:c?{minHeight:44}:j}),u?(0,h.jsx)(D,{rid:e,b:n,name:o,onClose:()=>f(!1),onDone:s}):null]}):null},_e.CancelBookingConfirm=D,_e.ReinstateBookingButton=function({b:e,name:n,today:s,onDone:l}){const[c,u]=(0,t.useState)(!1);if(!(0,b.canReinstateBooking)(e,s))return null;const y=(0,b.reinstateBookingWords)(e,n);if(!c)return(0,h.jsx)(x.Button,{kind:"ghost",label:"Undo cancel",testID:`reinstate-booking-${e.id}`,accessibilityLabel:`Undo cancel for ${n}`,onPress:()=>u(!0),style:j});return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:()=>u(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center'},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, put back to booked",testID:"reinstate-booking-yes",accessibilityLabel:`Yes, put ${n} back to booked`,style:[j,{flexGrow:1}],onPress:async()=>{await $(e),u(!1),l?.(`${n} put back to booked.`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-booking-no",onPress:()=>u(!1),style:j})]})]})};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]),c=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]),y=r(d[8]),k=r(d[9]),p=r(d[10]),x=r(d[11]),h=r(d[12]);const j={minHeight:56},B={display:'Display',owner:'Managers app',staff:'Staff app',chef:'Kitchen app',customer:'Customer page'};function C(e){const t=y.useSession.getState().meId,n=t?k.useOwner.getState().staff.find(e=>e.id===t):void 0,o=B[p.APP_VARIANT]??'CoverCharge';return{by:n?`${n.name.replace(' (example)','')} (${o})`:o,at:(new Date).toISOString(),app:o,...e.table?{table:e.table}:{}}}async function w(e,t){const n=(0,l.tablesOf)(t.table);await s.repo.bookings.update(t.id,{status:'cancelled',cancelled:C(t),...(0,c.tablePatch)(null)}),n.forEach(t=>l.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function $(e){await s.repo.bookings.setStatus(e.id,'confirmed')}function D({rid:e,b:t,name:n,onClose:s,onDone:c}){const y=(0,b.cancelBookingWords)(t,n),k=(0,l.tablesOf)(t.table);return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:s,title:"Cancel booking?",maxWidth:560,testID:"cancel-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center',gap:8},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, cancel booking",testID:"cancel-booking-yes",accessibilityLabel:`Yes, cancel booking for ${n}`,style:[j,{flexGrow:1}],onPress:async()=>{await w(e,t),s(),c?.(`${n} cancelled.${k.length?` ${(0,u.tablesWords)(k)} free.`:''}`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep booking",testID:"cancel-booking-no",accessibilityLabel:`Keep booking for ${n}`,onPress:s,style:j})]})]})}},1116,[17,85,858,996,1090,1117,1094,804,920,876,856,777,8]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canCancelBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canReinstateBooking",{enumerable:!0,get:function(){return t}}),e.cancelBookingWords=function(n,t){const o=`${n.partySize} Cover${1===n.partySize?'':'s'}`;return`Cancel booking for ${t}, ${n.time}, ${o}? The table is freed. Website bookings will cancel it on the website and may email the guest.`},e.reinstateBookingWords=function(n,t){return`Put ${t} back to booked for ${n.time}? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`},e.cancelledOnDay=o,e.cancelledDayTally=function(n,t){const a=o(n,t),l=a.filter(n=>!!n.walkIn),c=a.filter(n=>!n.walkIn);return{count:a.length,covers:a.reduce((n,t)=>n+t.partySize,0),bookings:c.length,bookingCovers:c.reduce((n,t)=>n+t.partySize,0),walkIns:l.length,walkInCovers:l.reduce((n,t)=>n+t.partySize,0),list:a}},e.cancelledTallyWords=function(n,t="today"){if(!n.count)return`No cancellations ${t}`;const o=[],a=n.bookings??0,l=n.walkIns??0;a&&o.push(`${a} booking${1===a?'':'s'} (${n.bookingCovers??0} Cover${1===(n.bookingCovers??0)?'':'s'})`);l&&o.push(`${l} walk-in${1===l?'':'s'} (${n.walkInCovers??0} Cover${1===(n.walkInCovers??0)?'':'s'})`);if(!o.length)return`Cancelled ${t}: ${n.count} \xb7 ${n.covers} Cover${1===n.covers?'':'s'}`;return`Cancelled ${t}: ${o.join(' \xb7 ')}`};const n=n=>!n.walkIn&&('confirmed'===n.status||'pending'===n.status||'seated'===n.status),t=(n,t)=>!n.walkIn&&'cancelled'===n.status&&n.date>=t;function o(n,t){return n.filter(n=>n.date===t&&'cancelled'===n.status).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name))}},1117,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSeatClearFinish=function(){const t=(0,A.useSignedIn)(),o=(0,A.useInStaffApp)(),_='staff'===s.APP_VARIANT||'chef'===s.APP_VARIANT||o,l=(0,c.canSeatClearFinish)({device:s.IS_CAR||'display'===s.APP_VARIANT||!_&&!t,viaDisplay:(0,n.isKitchenViaDisplay)(),role:t?.role,ownerAccess:t?.ownerAccess,managerAccess:t?.managerAccess});return{ok:l,hint:l?void 0:c.SEAT_CLEAR_HINT}};var s=r(d[0]),n=r(d[1]),c=r(d[2]),A=r(d[3])},1118,[856,922,1119,1055]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEAT_CLEAR_HINT",{enumerable:!0,get:function(){return n}}),e.canSeatClearFinish=function(n){return!(!n.device&&!n.viaDisplay)||('owner'===n.role||'manager'===n.role||!(!n.ownerAccess&&!n.managerAccess))};const n='Ask a manager to seat, finish or clear a table.'},1119,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:s,who:i,role:n,inStaffApp:l,shiftManager:a,big:o,testID:d}){const[h,u]=(0,t.useState)(!1),p=(0,b.useSession)(e=>e.meId),y=(0,m.useOwner)(e=>e.staff.find(e=>e.id===p&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:l,role:n,shiftManager:a})||p&&!(0,x.canChangeBookings)(y)?null:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:d??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),h?(0,N.jsx)(V,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:n,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,l.useBookings)(e).filter(e=>!e.walkIn&&e.date>=s&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,200);return o?(0,N.jsx)(V,{rid:e,id:o,who:i,hidePrivate:a,onClose:n}):(0,N.jsxs)(z.Sheet,{visible:!0,onClose:n,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,N.jsx)(z.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${L(e.date,s)} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${L(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,N.jsx)(z.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,N.jsx)(z.Button,{kind:"ghost",label:"Close",onPress:n,style:{minHeight:44}})]})},_e.EditBookingSheet=V;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=(e=i)&&e.__esModule?e:{default:e},l=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),f=_r(_d[19]),C=_r(_d[20]),I=_r(_d[21]),k=_r(_d[22]),w=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),O=_r(_d[28]),W=_r(_d[29]),z=_r(_d[30]),B=_r(_d[31]),N=_r(_d[32]);const E=/^([01]\d|2[0-3]):[0-5]\d$/,R=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const L=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,D.ymd)(s)?'Tomorrow':F(e)};const A=e=>e?(e/100).toFixed(e%100?2:0):'',M=e=>{const t=(0,B.parseMoneyInput)(e);return null!=t&&t>=0?Math.round(100*t):NaN},F=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',H=e=>{const t=e.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);return t?`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`:''},_=e=>e.charAt(0).toUpperCase()+e.slice(1);function Y({title:e,children:t,testID:s}){return(0,N.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,N.jsx)(z.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const G=({label:e,value:t,onChange:s,max:i=20,testID:n})=>(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:e}),(0,N.jsx)(z.Stepper,{testID:n,value:t,min:0,max:i,onChange:s,label:e})]});function V({rid:e,id:i,who:b,onClose:m,hidePrivate:x=!1}){(0,$.useBlurOutside)();const B=(0,l.useBookings)(e),L=B.find(e=>e.id===i),V=(0,d.useRestaurant)(e),K=(0,a.usePlan)(e),U=(0,o.useBlocks)(e=>e.blocks),[q,X]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Q,J]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Z,ee]=(0,t.useState)(!1),[te,se]=(0,t.useState)(null),[ie,ne]=(0,t.useState)(null),[le,ae]=(0,t.useState)(!1),[oe,de]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositDue:0)),[re,ce]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositAmount:0)),[he,ue]=(0,t.useState)(F(L?(0,c.draftOf)(L).depositDate:''));if(!L||!q||!V)return null;const pe=e=>{se(null),ne(null),X({...q,...e})},ge=(0,O.depositOf)(V.settings),be=e=>{const t=e.partySize??q.partySize,s=Math.min(e.children??q.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(L)&&q.depositOn&&!q.depositPaid&&M(oe||'0')===(0,O.depositDue)(ge,q.partySize,q.children??0)){const e=(0,O.depositDue)(ge,t,s);e>0&&de(A(e))}pe({...e,children:s})},me=(0,v.bookingSlotMinutesOf)(V),xe=R(q.time),ye=E.test(xe),je=q.area?K.areas.filter(e=>e.name===q.area).map(e=>e.id):null,De=e=>!je||e.split('+').every(e=>je.includes(K.tables.find(t=>t.name===e)?.areaId??'')),ve=(0,y.tableOptions)(K,B.filter(e=>e.date===q.date),q.table).filter(e=>De(e)||e===q.table),fe=!(q.depositOn&&(Number.isNaN(M(oe||'0'))||q.depositPaid&&(Number.isNaN(M(re||'0'))||he.trim()&&!H(he)))),Ce={...q,time:xe,depositDue:M(oe||'0')||0,depositAmount:M(re||'0')||0,depositDate:H(he)},Ie=(0,c.changedDraftFields)(Q??(0,c.draftOf)(L),Ce),ke=V.settings.turnMins??90,we=!!q?.email?.trim()&&q.email.trim()!==(L?.email??'').trim(),Te=(0,u.bookingRulesOf)(V),Se=async()=>{const t=(0,c.editPatch)(L,Ce,{by:b||'Team member',app:r.APP_VARIANT});if(le&&we&&Object.assign(t,(0,u.marketingChoice)(Ce.email,!0)),Object.keys(t).length&&await l.repo.bookings.update(L.id,t),'seated'===L.status&&'table'in t&&t.table!==L.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(L.table),n=s(t.table),l=a.useFloor.getState(),o=i.map(t=>l.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!n.includes(e)).forEach(t=>l.setLive(e,t,{stage:void 0,dirty:!0})),n.forEach(t=>l.setLive(e,t,{stage:o,dirty:!1}))}ne(`Saved. Changed: ${(0,c.editedWords)(Ie)}.`),se(null),m()},$e=()=>{const t=ye?(0,o.blockAt)(U,e,q.date,xe):void 0,s=(0,c.editWarnings)(L,Ce,B,t,ke,K);!s.length||te?Se():se(s)},Pe=q.allergies??[],Oe=e=>pe({allergyNone:!1,allergies:Pe.some(t=>t.allergen===e)?Pe.filter(t=>t.allergen!==e):[...Pe,{allergen:e,severity:'allergy'}]}),We=(0,c.historyLines)(L);return(0,N.jsxs)(z.Sheet,{visible:!0,onClose:()=>{Ie.length?ee(!0):(ee(!1),m())},title:`Edit booking \xb7 ${L.name} \xb7 ${L.ref}`,maxWidth:760,testID:"edit-booking-sheet",onTypingDone:()=>{(0,C.hideKeyboard)(),Ie.length&&ye&&fe&&q.name.trim().length>=1&&$e()},typingDoneLabel:Ie.length?'Done, save changes':'Done, hide the keyboard',footer:(0,N.jsx)(z.Button,{label:te?'Save anyway':'Save changes',testID:"edit-save",disabled:!ye||!fe||q.name.trim().length<1||!Ie.length,onPress:$e,style:{minHeight:56,width:'100%'}}),children:[(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(w.DepositChip,{b:L,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(L)?(0,N.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,N.jsxs)(Y,{title:"Deposit",testID:"edit-section-deposit",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No deposit",selected:!q.depositOn,testID:"edit-deposit-none",onPress:()=>pe({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit due",selected:!!q.depositOn&&!q.depositPaid&&!q.depositWaived,testID:"edit-deposit-due",onPress:()=>pe({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit paid",selected:!!q.depositOn&&!!q.depositPaid,testID:"edit-deposit-paid",onPress:()=>{re||ce(oe),he||ue(F((0,D.ymd)(new Date))),pe({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsx)(z.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsxs)(z.T,{size:15,center:!0,colour:j.colours.goldLight,testID:"edit-deposit-waived-by",children:[L.depositWaived?.by?(0,O.waiverText)(L.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,q.depositWaived||Ie.includes('deposit')?null:(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(P.WaiveDepositButton,{b:L,who:b,onDone:e=>{const t={...q,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e};X(t),J(s=>s?{...s,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e}:t)}})}),q.depositOn?(0,N.jsx)(z.Field,{money:!0,label:"Deposit due (\xa3)",value:oe,onChangeText:e=>{de(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,q.depositOn&&q.depositPaid?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Field,{money:!0,label:"Amount paid (\xa3)",value:re,onChangeText:e=>{ce(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"How was it paid?"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,N.jsx)(z.Chip,{label:_(e),selected:q.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>pe({depositMethod:e})},e))}),(0,N.jsx)(z.Field,{label:"Date paid (DD/MM/YYYY)",value:he,onChangeText:e=>{ue((0,s.slashDate)(e,he)),pe({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),he.trim()&&!H(he)?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,fe?null:(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,N.jsx)(z.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,N.jsxs)(Y,{title:"When",testID:"edit-section-when",children:[(0,N.jsx)(k.BookingDatePicker,{r:V,today:new Date,value:q.date,onChange:e=>pe({date:e})}),(0,N.jsx)(I.TimeRoller,{testID:"edit-time",value:(0,f.snapTime)(q.time,me),onChange:e=>pe({time:e}),step:me}),ye?null:(0,N.jsx)(z.T,{size:15,colour:j.colours.amber,center:!0,children:"Choose a time on the roller."}),(0,N.jsx)(T.AdultsChildren,{value:(0,S.peopleOf)(q.partySize,q.children),onChange:e=>be(e),depositsOn:ge.on&&ge.perPersonPence>0,testID:"edit-people"}),(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:"Table time"}),(0,N.jsx)(z.Stepper,{testID:"edit-duration",value:q.duration||0,min:0,max:360,step:15,onChange:e=>pe({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,N.jsxs)(Y,{title:"Where",testID:"edit-section-where",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"Any area",selected:!q.area,testID:"edit-area-any",onPress:()=>pe({area:''})}),K.areas.map(e=>(0,N.jsx)(z.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:q.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>pe({area:e.name})},e.id))]}),(0,N.jsx)(z.T,{size:18,weight:"semibold",center:!0,children:(0,y.tableButtonLabel)(q.table)}),(0,y.splitChoices)(q.table).length?(0,N.jsxs)(n.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:"Split the joined tables"}),(0,N.jsx)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,y.splitChoices)(q.table).map(e=>(0,N.jsx)(z.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>pe({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:q.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(q.table?'':', chosen'),onPress:()=>pe({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),ve.map(e=>(0,N.jsx)(z.Button,{kind:e===q.table?'primary':'secondary',label:(0,y.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,y.tableButtonLabel)(e)}${e===q.table?', chosen':''}`,onPress:()=>pe({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,N.jsxs)(Y,{title:"Guest",testID:"edit-section-guest",children:[(0,N.jsx)(z.Field,{label:"Name",value:q.name,onChangeText:e=>pe({name:e}),testID:"edit-name"}),(0,N.jsx)(z.Field,{label:"Phone",value:q.phone,onChangeText:e=>pe({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,N.jsx)(z.Field,{label:"Email",value:q.email,onChangeText:e=>pe({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),we&&Te.marketingOptIn?(0,N.jsx)(z.Toggle,{label:Te.marketingWords,value:le,onChange:ae,testID:"edit-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,N.jsx)(z.T,{size:16,center:!0,children:"Booked by"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>pe({source:e.id})},e.id))}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(q.tags??[]).includes(e);return(0,N.jsx)(z.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>pe({tags:t?(q.tags??[]).filter(t=>t!==e):[...q.tags??[],e].sort()})},e)})})]}),(0,N.jsxs)(Y,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,N.jsx)(G,{label:"Dogs",value:q.dogs??0,max:6,onChange:e=>pe({dogs:e}),testID:"edit-dogs"}),(0,N.jsx)(G,{label:"High chairs",value:q.highChairs??0,max:10,onChange:e=>pe({highChairs:e}),testID:"edit-high-chairs"}),(0,N.jsx)(G,{label:"Wheelchair users",value:q.wheelchair??0,max:10,onChange:e=>pe({wheelchair:e}),testID:"edit-wheelchair"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"Occasion"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:(q.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>pe({occasion:e.id})},e.id||'none'))})]}),(0,N.jsxs)(Y,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No allergies",selected:!!q.allergyNone&&!Pe.length,testID:"edit-allergy-none",onPress:()=>pe({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,N.jsx)(z.Chip,{label:e.short,selected:Pe.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>Oe(e.id)},e.id))]}),Pe.map(e=>(0,N.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,N.jsxs)(z.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,N.jsx)(z.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>pe({allergies:Pe.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,N.jsx)(z.Field,{label:"Anything else about allergies",value:q.allergyNote,onChangeText:e=>pe({allergyNote:e}),testID:"edit-allergy-note"}),Ie.includes('allergies')&&Pe.length?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,N.jsx)(G,{label:"Vegan",value:q.vegan??0,max:q.partySize,onChange:e=>pe({vegan:e}),testID:"edit-vegan"}),(0,N.jsx)(G,{label:"Vegetarian",value:q.vegetarian??0,max:q.partySize,onChange:e=>pe({vegetarian:e}),testID:"edit-vegetarian"})]}),(q.holds??[]).length||(L.holds??[]).some(e=>e.qty>0&&!e.served)?(0,N.jsxs)(Y,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,N.jsx)(z.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(q.holds??[]).map(e=>{const t=(0,h.reservablesOf)(V),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),l=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,N.jsxs)(n.default,{testID:l,style:{gap:6,width:'100%'},children:[(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,N.jsx)(z.Stepper,{testID:l,value:e.qty,min:0,max:20,onChange:t=>pe({holds:(0,c.setEditableHoldQty)(q.holds??[],e.kind,e.id,t)}),label:i})]}),(0,N.jsx)(z.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${l}-remove`,onPress:()=>pe({holds:(0,c.removeEditableHold)(q.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(q.holds??[]).length?null:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==L.status?(0,N.jsxs)(Y,{title:"Status",testID:"edit-section-status",children:[(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>pe({status:e.id})},e.id))}),(0,N.jsx)(z.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,N.jsx)(Y,{title:"Notes",testID:"edit-section-notes",children:(0,N.jsx)(z.Field,{label:"Notes",value:q.notes,onChangeText:e=>pe({notes:e}),placeholder:Te.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),te?(0,N.jsxs)(n.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[te.map(e=>(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,ie?(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:ie}):null,Z?(0,N.jsxs)(n.default,{testID:"edit-discard-warn",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:j.colours.gold,backgroundColor:j.colours.surface2},children:[(0,N.jsx)(z.T,{size:20,weight:"bold",center:!0,children:"Discard unsaved changes?"}),(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.muted,children:"Your changes have not been saved."}),(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:"secondary",label:"Keep editing",testID:"edit-discard-keep",onPress:()=>ee(!1),style:{minHeight:52,flex:1}}),(0,N.jsx)(z.Button,{kind:"danger",label:"Discard changes",testID:"edit-discard-discard",onPress:()=>{ee(!1),m()},style:{minHeight:52,flex:1}})]})]}):null,We.length?(0,N.jsx)(Y,{title:"Changes",testID:"edit-history",children:We.slice(0,12).map((e,t)=>(0,N.jsx)(z.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,N.jsx)(W.CancelBookingButton,{rid:e,b:L,name:L.name,big:!0,onDone:()=>m()}),(0,N.jsx)(W.ReinstateBookingButton,{b:L,name:L.name,today:(0,D.ymd)(new Date),onDone:()=>m()})]})}},1120,[17,1031,85,858,996,993,860,856,1112,1053,1077,845,920,876,994,1090,804,863,1103,1121,815,1122,1104,1087,1099,1100,1101,1123,841,1116,777,840,8]); __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.hmToMins=n,e.minsToHm=o,e.snapTime=u,e.hourValues=function(){return Array.from({length:24},(t,n)=>n)},e.minuteValues=function(t){const n=t>0&&t<=60&&60%t==0?t:15,o=[];for(let t=0;t<60;t+=n)o.push(t);return o},e.splitHm=function(o){const i=n(t.test(o)?o:u(o,15));return Number.isFinite(i)?{hour:Math.floor(i/60),minute:i%60}:{hour:12,minute:0}},e.joinHm=function(t,n){const o=(n%60+60)%60;return`${String((t%24+24)%24).padStart(2,'0')}:${String(o).padStart(2,'0')}`},e.timeRollerHint=function(t){return`24-hour. Times are every ${t>0?t:15} minutes. Roll or swipe each wheel. No typing.`};const t=/^([01]\d|2[0-3]):[0-5]\d$/;function n(t){const n=t.trim().match(/^(\d{1,2}):(\d{2})$/);if(!n)return NaN;const o=Number(n[1]),u=Number(n[2]);return o>23||u>59?NaN:60*o+u}function o(t){const n=(Math.round(t)%1440+1440)%1440,o=Math.floor(n/60),u=n%60;return`${String(o).padStart(2,'0')}:${String(u).padStart(2,'0')}`}function u(t,u){const i=u>0&&u<=60&&60%u==0?u:15,s=n(t),c=Number.isFinite(s)?s:720;return o(Math.round(c/i)*i)}},1121,[]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TimeRoller=function({value:e,onChange:t,step:n=15,testID:u="time-roller"}){const{hour:h,minute:m}=(0,s.splitHm)(e),f=(0,s.hourValues)(),x=(0,s.minuteValues)(n),p=f.indexOf(h),y=x.reduce((e,t)=>Math.abs(t-m)t((0,s.joinHm)(f[e],y)),label:"Hours",format:e=>String(e).padStart(2,'0'),testID:`${u}-hours`}),(0,c.jsx)(b,{values:x,index:j<0?0:j,onChange:e=>t((0,s.joinHm)(h,x[e])),label:"Minutes",format:e=>String(e).padStart(2,'0'),testID:`${u}-minutes`})]})]}),(0,c.jsx)(l.T,{size:13,center:!0,colour:o.colours.muted,children:(0,s.timeRollerHint)(n)})]})};var t=r(_d[0]),n=e(r(_d[1])),i=e(r(_d[2])),o=r(_d[3]),s=r(_d[4]),l=r(_d[5]),c=r(_d[6]);const d=48,u=5,h=2;function m(e,t){return(e%t+t)%t}function b({values:e,index:s,onChange:b,label:f,format:x,testID:p}){const y=(0,t.useRef)(null),j=(0,t.useRef)(0),v=e.length,w=e[m(s,v)],R=`${x(w)} ${f.toLowerCase()}`,S=e=>b(m(s+e,v)),T=()=>{y.current=null,j.current=0};return(0,c.jsx)(i.default,{testID:p,accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:f,accessibilityValue:{min:e[0],max:e[v-1],now:w,text:R},accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{'increment'===e.nativeEvent.actionName&&S(1),'decrement'===e.nativeEvent.actionName&&S(-1)},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{y.current=e.nativeEvent.pageY,j.current=0},onResponderMove:e=>{if(null==y.current)return;const t=e.nativeEvent.pageY-y.current;for(y.current=e.nativeEvent.pageY,j.current+=t;j.current<=-24;)S(1),j.current+=d;for(;j.current>=24;)S(-1),j.current-=d},onResponderRelease:T,onResponderTerminate:T,style:{width:120,height:240,alignItems:'center'},children:Array.from({length:u},(t,i)=>{const u=i-h,b=e[m(s+u,v)],f=0===u,p=2===Math.abs(u);return(0,c.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",onPress:()=>{u&&S(u)},style:{height:d,width:'100%',alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:f?28:p?18:22,weight:f?'bold':'medium',colour:f?o.colours.goldLight:o.colours.muted,center:!0,style:{opacity:f?1:p?.35:.7},children:x(b)})},`${i}-${b}`)})})}},1122,[17,385,85,804,1121,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1123,[17,85,858,856,1120,841,1095,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1123,[17,85,858,856,1112,841,1095,804,777,8]); __d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingHistory=function({rid:e,today:t}){const[b,k]=(0,s.useState)((0,n.addDaysIso)(t,-1)),[w,v]=(0,s.useState)('day'),[p,f]=(0,s.useState)((0,n.ddmmyyyy)((0,n.addDaysIso)(t,-1))),[D,$]=(0,s.useState)(!1),[_,I]=(0,s.useState)(0),T=(0,n.historyRange)(w,b,t),C=(0,c.useKitchenHistory)(e,T.from,T.to,t,_),P=(0,d.parseHistoryInput)(p),B=!!P&&(0,d.validPastDate)(P,t),L=e=>{(0,d.validPastDate)(e,t)&&(k(e),f((0,n.ddmmyyyy)(e)))};if(!C.allowed)return(0,h.jsx)(l.Card,{children:(0,h.jsx)(l.T,{size:20,center:!0,children:"Booking history is for the Head Chef and managers. Sign in to the Head Chef app to see it."})});const z='day'===w?1:7,S=(0,n.addDaysIso)('day'===w?b:(0,n.mondayOf)(b),-z),R='day'===w?(0,n.addDaysIso)(b,1):(0,n.addDaysIso)((0,n.mondayOf)(b),7),W='day'===w?'day':'week';return(0,h.jsxs)(o.default,{style:{gap:14},testID:"booking-history",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:12,alignItems:'stretch'},children:[(0,h.jsx)(l.T,{size:18,center:!0,children:"Bookings, covers and walk-ins on past days. Read-only; nothing is changed."}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:'day'===w?'primary':'secondary',testID:"bh-mode-day",label:"One day",accessibilityLabel:"Show one day"+('day'===w?', selected':''),onPress:()=>v('day')}),(0,h.jsx)(l.Button,{kind:'week'===w?'primary':'secondary',testID:"bh-mode-week",label:"Whole week",accessibilityLabel:"Show the whole week, Monday to Sunday"+('week'===w?', selected':''),onPress:()=>v('week')})]}),(0,h.jsx)(l.Field,{label:"Past date (DD/MM/YYYY)",value:p,onChangeText:e=>f((0,i.slashDate)(e,p)),placeholder:"09/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Past date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"bh-date",style:{textAlign:'center'}}),B?null:(0,h.jsx)(l.T,{size:16,center:!0,testID:"bh-date-hint",children:"Enter a past date as DD/MM/YYYY, for example 09/11/2026."}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:"secondary",label:"Pick a date",testID:"bh-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${u(b)}`,onPress:()=>$(!0)}),(0,h.jsx)(l.Button,{label:"Show",testID:"bh-show",accessibilityLabel:`Show booking history for ${B&&P?u(P):'a valid past date'}`,disabled:!B,onPress:()=>{P&&L(P),I(_+1)}})]}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:"secondary",testID:"bh-prev",label:`Previous ${W}`,accessibilityLabel:`Previous ${W}, ${u(S)}`,onPress:()=>L(S)}),(0,h.jsx)(l.Button,{kind:"secondary",testID:"bh-next",label:`Next ${W}`,accessibilityLabel:(0,d.validPastDate)(R,t)?`Next ${W}, ${u(R)}`:`Next ${W}, not available. Booking history is for past days only`,disabled:!(0,d.validPastDate)(R,t),onPress:()=>L(R)})]}),'day'===w?(0,h.jsx)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:(0,h.jsx)(l.Button,{small:!0,kind:"secondary",testID:"bh-prev-week",label:"Same day last week",accessibilityLabel:`Same day last week, ${u((0,n.addDaysIso)(b,-7))}`,onPress:()=>L((0,n.addDaysIso)(b,-7))})}):null]})}),(0,h.jsx)(y.LookBackCalendar,{visible:D,today:t,selected:b,purpose:"Booking history",idPrefix:"bh",onClose:()=>$(!1),onPick:e=>{L(e),$(!1)}}),C.data?'day'===w?C.data.days[0]?(0,h.jsx)(x,{d:C.data.days[0]}):null:(0,h.jsx)(j,{days:C.data.days,onDay:e=>{L(e),v('day')}}):(0,h.jsx)(l.Card,{children:(0,h.jsx)(o.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(l.T,{size:20,center:!0,testID:"bh-status",children:C.error||'Loading booking history\u2026'})})})]})};var e,s=r(_d[0]),t=r(_d[1]),o=(e=t)&&e.__esModule?e:{default:e},l=r(_d[2]),i=r(_d[3]),d=r(_d[4]),n=r(_d[5]),c=r(_d[6]),y=r(_d[7]),b=r(_d[8]),h=r(_d[9]);const u=e=>`${(0,n.dayName)(e)} ${(0,n.ddmmyyyy)(e)}`,k=({label:e,value:s,id:t})=>(0,h.jsxs)(o.default,{testID:`bh-stat-${t}`,accessible:!0,accessibilityLabel:`${e}: ${s}`,style:{alignItems:'center',minWidth:96,padding:8,borderRadius:12,borderWidth:1,borderColor:b.colours.border},children:[(0,h.jsx)(l.T,{size:28,weight:"bold",colour:b.colours.gold,center:!0,children:String(s)}),(0,h.jsx)(l.T,{size:16,center:!0,children:e})]});function x({d:e}){return(0,h.jsxs)(o.default,{style:{gap:12},testID:"bh-day",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:10,alignItems:'center'},accessible:!0,accessibilityLabel:(0,n.dayText)(e)+`. Done: ${e.done_covers+e.walk_in_covers} covers.`,children:[(0,h.jsx)(l.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:u(e.date)}),(0,h.jsx)(o.default,{testID:"bh-stats",style:{alignSelf:'stretch'},children:(0,h.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(k,{id:"bookings",label:"Bookings",value:e.bookings}),(0,h.jsx)(k,{id:"booked",label:"Booked covers",value:e.booked_covers}),(0,h.jsx)(k,{id:"walkins",label:"Walk-ins",value:e.walk_ins}),(0,h.jsx)(k,{id:"walkin-covers",label:"Walk-in covers",value:e.walk_in_covers}),(0,h.jsx)(k,{id:"done",label:"Done",value:e.done_covers+e.walk_in_covers}),(0,h.jsx)(k,{id:"total",label:"Total",value:e.total_covers})]})}),e.not_counted?(0,h.jsxs)(l.T,{size:16,center:!0,children:[e.not_counted," cancelled or no-show ",1===e.not_counted?'booking is':'bookings are'," listed but not counted."]}):null,e.old_records?(0,h.jsx)(l.T,{size:16,center:!0,colour:b.colours.muted,children:"Includes records from the previous booking system, which may be incomplete."}):null]})}),(e.lines??[]).length||e.walk_ins?null:(0,h.jsx)(l.Card,{children:(0,h.jsx)(l.T,{size:18,center:!0,children:"No bookings or walk-ins recorded for this day."})}),(e.lines??[]).map((e,s)=>(0,h.jsx)(o.default,{testID:"bh-line",accessible:!0,accessibilityLabel:(0,n.lineText)(e),style:{padding:10,borderRadius:12,borderWidth:1,borderColor:b.colours.border,alignItems:'center',opacity:e.counted?1:.7},children:(0,h.jsxs)(l.Row,{wrap:!0,gap:14,style:{justifyContent:'center'},children:[(0,h.jsx)(l.T,{size:20,weight:"bold",colour:b.colours.gold,children:e.time??'No time'}),(0,h.jsx)(l.T,{size:18,children:null==e.covers?'Covers not recorded':`${e.covers} ${1===e.covers?'cover':'covers'}`}),(0,h.jsx)(l.T,{size:18,children:e.table?`Table ${e.table}`:'No table'}),(0,h.jsx)(l.T,{size:18,children:(0,n.statusWord)(e.status)})]})},s))]})}function j({days:e,onDay:s}){const t=(0,n.sumDays)(e);return(0,h.jsxs)(o.default,{style:{gap:12},testID:"bh-week",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:10,alignItems:'center'},accessible:!0,accessibilityLabel:`Week ${(0,n.ddmmyyyy)(e[0].date)} to ${(0,n.ddmmyyyy)(e[e.length-1].date)}: ${t.bookings} bookings, ${t.booked_covers} booked covers, ${t.walk_ins} walk-ins with ${t.walk_in_covers} covers, ${t.total_covers} covers in total`,children:[(0,h.jsxs)(l.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:["Week ",(0,n.ddmmyyyy)(e[0].date)," to ",(0,n.ddmmyyyy)(e[e.length-1].date)]}),(0,h.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(k,{id:"week-bookings",label:"Bookings",value:t.bookings}),(0,h.jsx)(k,{id:"week-walkins",label:"Walk-ins",value:t.walk_ins}),(0,h.jsx)(k,{id:"week-total",label:"Total",value:t.total_covers})]})]})}),e.map(e=>(0,h.jsx)(l.Button,{kind:"secondary",testID:`bh-week-day-${e.date}`,label:`${(0,n.day3)(e.date)} ${(0,n.ddmmyyyy)(e.date)} \xb7 ${e.bookings} booked (${e.booked_covers}) \xb7 ${e.walk_ins} walk-in (${e.walk_in_covers}) \xb7 Total ${e.total_covers}`,accessibilityLabel:`${(0,n.dayText)(e)}. Double tap to see this day's bookings.`,onPress:()=>s(e.date)},e.date))]})}},1124,[17,85,777,1031,1062,1125,1061,1048,804,8]); __d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"addDaysIso",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ddmmyyyy",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"day3",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"dayName",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"mondayOf",{enumerable:!0,get:function(){return l}}),e.historyRange=function(o,t,s){if('day'===o)return{from:t,to:t};const a=l(t),c=n(a,6),d=n(s,-1);return{from:a,to:c({bookings:o.bookings+t.bookings,booked_covers:o.booked_covers+t.booked_covers,walk_ins:o.walk_ins+t.walk_ins,walk_in_covers:o.walk_in_covers+t.walk_in_covers,total_covers:o.total_covers+t.total_covers}),{bookings:0,booked_covers:0,walk_ins:0,walk_in_covers:0,total_covers:0})};const o=o=>o.toISOString().slice(0,10),t=o=>new Date(o+'T12:00:00Z'),n=(n,s)=>{const a=t(n);return a.setUTCDate(a.getUTCDate()+s),o(a)},s=o=>`${o.slice(8,10)}/${o.slice(5,7)}/${o.slice(0,4)}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],c=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=o=>a[t(o).getUTCDay()],u=o=>c[t(o).getUTCDay()],l=o=>n(o,-(t(o).getUTCDay()+6)%7);function b(o){switch((o??'').toLowerCase()){case'finished':case'seated':return'Done';case'confirmed':case'booked':case'amended':return'Booked';case'cancelled':return'Cancelled';case'noshow':return'No-show';default:return o||'Not recorded'}}const y=(o,t,n)=>`${o} ${1===o?t:n}`},1125,[]); __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TempUnitsSetup=function(){const e=(0,f.useSync)(e=>e.mode),s='live'===e||'offline'===e||'connecting'===e,o=(0,c.useSafety)(e=>e.points),b=(0,d.useOwner)(e=>e.site),[k,j]=(0,t.useState)(()=>(0,u.draftsFrom)(c.useSafety.getState().points)),[$,S]=(0,t.useState)(null),[I,w]=(0,t.useState)(!1),[T,D]=(0,t.useState)(''),[C,L]=(0,t.useState)(1),B=(0,t.useMemo)(()=>(0,u.changesOf)(k,o),[k,o]),z=e=>(0,h.chefCanSee)(b,e),A=Object.fromEntries(k.map(e=>[e.key,(0,u.problemOf)(e,k,z)])),P=Object.values(A).some(Boolean),R=e=>{j(t=>t.map(t=>t.key===e.key?e:t)),D(''),w(!1)},_=k.filter(e=>!e.archived),O=k.filter(e=>e.archived&&e.id),F=_.filter(e=>'fridge'===e.kind).length,H=_.length-F,M=e=>{const t=`new${C}`;L(C+1),D(''),w(!1),j(s=>[...s,{key:t,name:'',kind:e,location:'',max:String(u.DEFAULT_MAX[e]),due:'09:00, 16:00',archived:!1}])},W=P?'Fix the unit marked in red first.':B.length?`${B.length} change${1===B.length?'':'s'} not saved yet.`:'No changes yet.';return(0,x.jsxs)(n.default,{testID:"tu-setup",style:{gap:12,alignSelf:'center',width:'100%',maxWidth:560,alignItems:'stretch'},children:[(0,x.jsx)(l.T,{weight:"semibold",size:18,center:!0,accessibilityRole:"header",children:"Temperature units"}),(0,x.jsx)(l.T,{testID:"tu-count",size:15,center:!0,children:`${F} fridge${1===F?'':'s'} and ${H} freezer${1===H?'':'s'} checked`}),(0,x.jsx)(p.TempSaveBanner,{testID:"tu-save-banner"}),(0,x.jsx)(l.Banner,{kind:"info",title:s?'Shared with every device':'Not connected yet',children:s?'These units and their readings are on the shared food safety log, so every phone, tablet and screen at the venue shows the same units.':'These units are saved on this device until it connects. Then they are shared with every device at the venue.'}),_.map(e=>(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsx)(v,{d:e,problem:A[e.key],onChange:R,onArchive:()=>e.id?S(e.key):j(t=>t.filter(t=>t.key!==e.key))}),$===e.key?(0,x.jsxs)(n.default,{testID:"tu-archive-ask",style:{gap:8,padding:12,borderRadius:12,backgroundColor:y.colours.amberBg,alignItems:'center'},children:[(0,x.jsx)(l.T,{size:15,center:!0,children:`Archive ${e.name.trim()||'this unit'}? It will no longer be checked. Its past readings stay in History and the EHO report. Nothing is deleted.`}),(0,x.jsxs)(l.Row,{gap:8,children:[(0,x.jsx)(l.Button,{small:!0,testID:"tu-archive-confirm",label:"Archive",accessibilityLabel:`Yes, archive ${e.name}`,onPress:()=>{R({...e,archived:!0}),S(null)}}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-archive-cancel",label:"Keep it",accessibilityLabel:`No, keep ${e.name}`,onPress:()=>S(null)})]})]}):null]},e.key)),(0,x.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-add-fridge",label:"Add a fridge",onPress:()=>M('fridge')}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-add-freezer",label:"Add a freezer",onPress:()=>M('freezer')})]}),O.length?(0,x.jsxs)(n.default,{testID:"tu-archived",style:{gap:6,alignItems:'center'},children:[(0,x.jsx)(l.T,{weight:"medium",center:!0,children:"Archived (not checked, history kept)"}),O.map(e=>(0,x.jsxs)(l.Row,{gap:8,style:{justifyContent:'center'},children:[(0,x.jsx)(l.T,{size:14,center:!0,children:e.name}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:`tu-restore-${e.key}`,label:"Bring back",accessibilityLabel:`Bring back ${e.name}`,onPress:()=>R({...e,archived:!1,due:e.due||'09:00, 16:00'})})]},e.key))]}):null,I?(0,x.jsxs)(n.default,{testID:"tu-save-ask",style:{gap:8,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold,alignItems:'center'},children:[(0,x.jsx)(l.T,{weight:"medium",center:!0,children:`Save ${B.length} change${1===B.length?'':'s'}?`}),B.map(e=>(0,x.jsx)(l.T,{size:14,center:!0,children:e.text},e.key)),(0,x.jsxs)(l.Row,{gap:8,children:[(0,x.jsx)(l.Button,{small:!0,testID:"tu-save-confirm",label:"Save",accessibilityLabel:"Yes, save the changes",onPress:()=>{const e=c.useSafety.getState(),t=new Set(e.points.map(e=>e.id));for(const t of B)t.add?e.addPoint(t.add):t.id&&t.patch&&e.setPoint(t.id,t.patch);j((0,u.draftsFrom)(c.useSafety.getState().points)),w(!1);const n=[...B.filter(e=>e.id).map(e=>e.id),...c.useSafety.getState().points.filter(e=>!t.has(e.id)).map(e=>e.id)],l=`Saved ${B.length} change${1===B.length?'':'s'}.`;D(s?`${l} Sending to every device\u2026`:`${l} (on this device until it connects).`),s&&(0,p.reportTempSave)('temp_units',n,l,D)}}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-save-cancel",label:"Back",accessibilityLabel:"Go back without saving",onPress:()=>w(!1)})]})]}):null,(0,x.jsx)(l.Button,{testID:"tu-save",label:"Save changes",disabled:!B.length||P,accessibilityHint:W,onPress:()=>w(!0),style:{alignSelf:'center',minWidth:200}}),T?(0,x.jsx)(l.T,{testID:"tu-saved",size:15,colour:y.colours.ok,center:!0,accessibilityRole:"text",children:T}):(0,x.jsx)(l.Muted,{style:{textAlign:'center'},children:W})]})};var e,t=r(_d[0]),s=r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),h=r(_d[6]),u=r(_d[7]),y=r(_d[8]),p=r(_d[9]),f=r(_d[10]),x=r(_d[11]);const b=['Downstairs','Upstairs'],k={fridge:'Fridge',freezer:'Freezer'};function v({d:e,problem:t,onChange:s,onArchive:c}){const d=e.name.trim()||'new unit';return(0,x.jsxs)(n.default,{testID:`tu-unit-${e.key}`,style:{gap:8,padding:12,borderRadius:12,borderWidth:1,borderColor:t?y.colours.red:y.colours.border,alignSelf:'stretch'},children:[(0,x.jsx)(o.TextInput,{testID:`tu-name-${e.key}`,accessibilityLabel:`Name of ${d}`,value:e.name,onChangeText:t=>s({...e,name:t}),placeholder:"e.g. Upstairs fridge 5",placeholderTextColor:"#7D776C",style:[l.styles.input,{alignSelf:'stretch',width:'100%'}]}),(0,x.jsxs)(l.Row,{wrap:!0,gap:6,children:[['fridge','freezer'].map(t=>(0,x.jsx)(l.Chip,{testID:`tu-kind-${e.key}-${t}`,label:k[t],selected:e.kind===t,accessibilityLabel:`${d}: ${k[t]}${e.kind===t?', selected':''}`,onPress:()=>s((0,u.withKind)(e,t))},t)),b.map(t=>(0,x.jsx)(l.Chip,{testID:`tu-loc-${e.key}-${t.toLowerCase()}`,label:t,selected:e.location.trim().toLowerCase()===t.toLowerCase(),accessibilityLabel:`${d}: location ${t}`,onPress:()=>s({...e,location:t})},t))]}),(0,x.jsxs)(l.Row,{wrap:!0,gap:8,children:[(0,x.jsx)(o.TextInput,{testID:`tu-loc-${e.key}`,accessibilityLabel:`Location of ${d}`,value:e.location,onChangeText:t=>s({...e,location:t}),placeholder:"Location",placeholderTextColor:"#7D776C",style:[l.styles.input,{flexGrow:1,flexBasis:120,minWidth:0,width:40}]}),(0,x.jsxs)(l.Row,{gap:6,style:{flexWrap:'nowrap'},children:[(0,x.jsx)(o.TextInput,{testID:`tu-max-${e.key}`,accessibilityLabel:`Safe limit for ${d}, degrees or colder`,value:e.max,onChangeText:t=>s({...e,max:t}),placeholder:String(u.DEFAULT_MAX[e.kind]),placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[l.styles.input,{width:72,textAlign:'center'}]}),(0,x.jsx)(l.T,{size:14,children:"\xb0C or colder"})]})]}),(0,x.jsx)(o.TextInput,{testID:`tu-due-${e.key}`,accessibilityLabel:`Check times for ${d}, 24 hour, comma separated`,value:e.due,onChangeText:t=>s({...e,due:t}),placeholder:"Check times, e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[l.styles.input,{alignSelf:'stretch',width:'100%'}]}),t?(0,x.jsx)(l.T,{testID:`tu-problem-${e.key}`,size:14,colour:y.colours.red,center:!0,accessibilityRole:"text",children:t}):null,(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:`tu-archive-${e.key}`,label:"Archive",accessibilityLabel:`Archive ${d}`,accessibilityHint:"Stops the checks. Its past readings stay in History and the EHO report",onPress:c,style:{alignSelf:'center'}})]})}},1126,[17,85,777,812,1001,876,820,1127,804,1128,899,8]); @@ -1306,7 +1306,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e __d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:l,declared:s}){return(0,c.jsxs)(a.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,c.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(d.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,n.isLiveVenue)()?null:(0,c.jsx)(d.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,c.jsx)(a.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:t.ALLERGENS.map(e=>{const n=l[e.id],u=s.find(l=>l.allergen===e.id),f='contains'===n?o.colours.redBg:'may'===n?o.colours.amberBg:o.colours.surface2,h='contains'===n?'#FFD9D4':'may'===n?'#FFE2A8':o.colours.muted;return(0,c.jsxs)(a.default,{style:{width:'48%',flexGrow:1,backgroundColor:f,borderRadius:8,padding:8,borderWidth:u?2:1,borderColor:u?o.colours.red:o.colours.border},children:[(0,c.jsx)(d.T,{size:14,weight:"medium",colour:n?h:o.colours.text,children:e.label}),(0,c.jsxs)(d.T,{size:13,colour:h,children:['contains'===n?'Contains':'may'===n?'May contain':'Not listed',u?` \xb7 YOUR ALLERGY (${(0,t.severityLabel)(u.severity)})`:'']})]},e.id)})}),e.allergenNotes?(0,c.jsxs)(d.Muted,{children:["Notes: ",e.allergenNotes]}):null,(0,c.jsx)(a.default,{testID:"allergen-signoff",children:(0,c.jsx)(d.Muted,{children:e.signOff?`From the dish's recipe card. Signed off by ${e.signOff.by} on ${u(e.signOff.at)}.`:"Awaiting the head chef's allergen sign-off: not available to order online."})}),(0,c.jsx)(d.Muted,{children:"Always tell staff about allergies when you order or arrive."})]})},_e.AllergenChips=function({map:l,declared:n,signedOff:s}){const a=Object.entries(l);return a.length?(0,c.jsx)(d.Row,{wrap:!0,gap:5,children:a.sort((e,l)=>e[1]===l[1]?0:'contains'===e[1]?-1:1).map(([e,l])=>{const s=n.some(l=>l.allergen===e);return(0,c.jsx)(d.Badge,{label:`${s?'\u26a0 ':''}${(0,t.allergenLabel)(e)}${'may'===l?' (may)':''}`,kind:s?'contains'===l?'red':'amber':'neutral'},e)})}):(0,c.jsx)(d.Muted,{children:(0,e.noAllergenWords)(s)})};var e=r(_d[0]);r(_d[1]);var l,n=r(_d[2]),s=r(_d[3]),a=(l=s)&&l.__esModule?l:{default:l},t=r(_d[4]),o=r(_d[5]),d=r(_d[6]),c=r(_d[7]);const u=e=>{const l=new Date(`${e.slice(0,10)}T12:00:00`);return isNaN(+l)?e:l.toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric'})}},1223,[901,17,1224,85,845,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1224,[880,899]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/chef-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1225,[]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},1226,[843,1026,17,219,385,85,780,858,804,777,1227,1102,1228,8]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by email",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},1226,[843,1026,17,219,385,85,780,858,804,777,1227,1102,1228,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,"BANNER_MS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return I}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:b}){const g=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!h||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=p,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,I),x=e.length-y.length,R=(0,f.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:h?'fixed':'absolute',left:10,right:n?10:76,top:8+g.top,zIndex:2147483001,gap:8,alignItems:'center',...h?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,f.jsx)(C,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>b(e)},e.id+':'+e.at)),x>0?(0,f.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:u.SLIDER.bg,borderWidth:1,borderColor:u.SLIDER.border},children:(0,f.jsxs)(c.T,{size:13,colour:u.SLIDER.quiet,children:[x," more new ",1===x?'booking':'bookings']})}):null]});if(h)try{const e=r(_d[13],"react-dom");if(e?.createPortal)return e.createPortal(R,document.body)}catch{}return R};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]),f=r(_d[12]);const h='undefined'!=typeof document,p="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",y=e=>h?{dataSet:{ccbn:e}}:{},x=7e3,I=3;function C({a:e,big:a,managers:p,me:I,onOpen:C,onClose:R}){const j='pending'===e.kind,[k,D]=(0,o.useState)(null),L=j&&p&&!k;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(R,k?1800:x);return()=>clearTimeout(e)},[L,k]);const S=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&R()}})).current,E=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',z=[e.when,E,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),v=j?'Booking request':'New booking',w=[e.when,E,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),T=`${v}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${C?' Tap to open bookings.':''}`,$=n=>{e.refId&&!e.test&&g.repo.bookings.decide(e.refId,n,I??'Manager'),D('confirmed'===n?'Confirmed.':'Declined.')};return(0,f.jsxs)(s.default,{...S.panHandlers,...y('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:u.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':u.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:j?d.colours.amber:d.colours.gold,...h?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,f.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:T,disabled:!C,onPress:()=>{R(),C?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,f.jsx)(c.T,{size:a?14:12,weight:"bold",colour:j?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:k??v.toUpperCase()}),(0,f.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:u.SLIDER.text,numberOfLines:1,children:e.name}),z?(0,f.jsx)(c.T,{size:a?18:15,colour:u.SLIDER.quiet,numberOfLines:1,children:z}):null,e.allergy?(0,f.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,f.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,f.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>$('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:u.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(c.T,{size:15,weight:"bold",colour:u.SLIDER.ink,children:"Confirm"})}),(0,f.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>$('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,f.jsx)(b.ToastClose,{testID:"booking-banner-close",label:`Close ${v.toLowerCase()} for ${e.name}`,onPress:R,size:a?'lg':'md',colour:u.SLIDER.quiet,style:{minWidth:56,minHeight:56,marginRight:4}})]})}},1227,[843,17,363,219,385,85,19,804,777,779,1102,858,8,260]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},1228,[1229,1230,1232,1231,1233,1016,1234]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1229,[]); @@ -1416,7 +1416,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1333,[812,843,17,85,777,845,851,1151,1334,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})},1334,[928,899,1151]); __d(function(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]})}},1335,[13,17,856,1336,1408,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 Je}}),_e2.DisplayBoard=function(e={}){const t=(0,ie.useOwner)(e=>e.site);return(0,te.useRestaurant)(t)?(0,qe.jsx)(at,{...e}):(0,qe.jsx)(U.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Y.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]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=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=_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]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]);const Ye='#221C12',Qe='#2E2618',Je=12e4,Xe={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},Ze={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},et={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},tt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),lt=e=>e.slotTime?(0,ee.hm)(new Date(e.slotTime)):'ASAP';function it({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,qe.jsxs)(U.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)(U.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)(U.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)(Y.T,{size:s?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,qe.jsx)(Y.T,{size:s?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,qe.jsx)(F.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)(U.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)(Y.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,qe.jsxs)(U.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,qe.jsx)(U.default,{style:{width:`${l.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,qe.jsx)(U.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,qe.jsxs)(F.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)(U.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,qe.jsx)(Y.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Y.T,{size:12,colour:se.colours.muted,children:s}):null]})}function ot({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ve.statusBlock)(e,t,(0,Ve.linkedBooking)(e,l));return e.length?(0,qe.jsx)(U.default,{style:{gap:8},children:e.map(e=>(0,qe.jsxs)(U.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:s?16:18,weight:"bold",children:[lt(e)," \xb7 ",tt(e.customerName)]}),(0,qe.jsx)(Y.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)(Y.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)(Y.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,Z.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Fe.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Y.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Y.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>te.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Y.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Y.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Ce.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Y.Muted,{children:"No takeaway orders right now."})}function at({embedded:e=!1,boardW:b,headerExtra:Z,subHeader:Fe,noVoice:Ve=!1}={}){const lt=(0,K.default)(),at=b??lt.width,dt=lt.height,ct=at<700,ut=at>=dt,ht=!ct&&ut&&at>=600,gt=ht,bt=Math.round(Math.min(520,Math.max(at>=1e3?448:280,.3*at))),yt=P.default.useRef(null),pt=P.default.useRef(0),[ft,xt]=(0,H.useState)({w:0,h:0}),mt=(0,ie.useOwner)(e=>e.site),jt=(0,te.useRestaurant)(mt);(0,Re.useAlertWatcher)(mt,{enabled:!e});const wt=(0,te.useOrders)(mt),kt=(0,te.useBookings)(mt),It=(0,te.useEvents)(mt),Dt=(0,te.useStore)(e=>e.skipMinutes),vt=(0,te.useStore)(e=>e.clock.mode),St=(0,te.useNow)(5e3),Ct=(0,ie.useOwner)(e=>e.staff),Tt=(0,ie.useOwner)(e=>e.attendance),Rt=(0,ie.useOwner)(e=>e.shifts),$t=(0,ie.useOwner)(e=>e.leave),Bt=P.default.useMemo(()=>(0,Oe.workingShifts)(Rt,$t),[Rt,$t]);P.default.useEffect(()=>{(0,oe.ensureAttendance)((0,ee.ymd)(St),St)},[(0,ee.ymd)(St)]);const Wt=(0,R.useSession)(e=>e.meId),Lt=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:tt(Ct.find(e=>e.id===Wt)?.name)}),zt=I.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Ht=(0,ee.ymd)(St),Pt=(0,A.useTravelDay)('display',Ht),Mt=(0,ne.useFrontDoor)(Ht,ut),At=(0,ae.useDisplaySettings)(mt),Et=At.privacy,Ot=(0,pe.useSaverSync)(),Nt=(0,ae.usePlan)(mt),_t=(0,ae.useFloor)(e=>e.live[mt]),Gt=(0,$e.useBlocks)(e=>e.blocks),[Ft,Vt]=(0,H.useState)('plan'),[Ut,Kt]=(0,H.useState)(!1),[qt,Yt]=(0,H.useState)('all'),[Qt,Jt]=(0,H.useState)(null),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(!1),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(null),[rs,ds]=(0,H.useState)(!1),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(null),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[ks,Is]=(0,H.useState)(!1),Ds=P.default.useRef(0),vs=e=>{Ds.current=Date.now(),ws(e)};P.default.useEffect(()=>{if(!js)return;const e=setInterval(()=>{Date.now()-Ds.current>=ze.DAY_IDLE_MS&&ws(null)},5e3);return()=>clearInterval(e)},[js]);const Ss=(0,te.useWaitlist)(mt),Cs=(0,te.useStore)(e=>e.walkIns[mt]??0),[Ts,Rs]=(0,H.useState)(!1),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1);(0,J.useReviewAlerts)(mt);const[Ps,Ms]=(0,H.useState)({view:0,content:0}),[As,Es]=(0,H.useState)(null);P.default.useEffect(()=>{As&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:As,timeoutMs:4500,big:!0,testID:'floor-toast'}),Es(null))},[As]),P.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Os,Ns]=(0,H.useState)(null),_s=P.default.useRef(0),[Gs,Fs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Os)return;_s.current=Date.now();const e=setInterval(()=>{const e=Date.now()-_s.current;if(e>=Je)return Ns(null),void Es('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Fs(e>=105e3?Math.ceil((Je-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Os]);const Vs=e=>e.date!==Ht?ts({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Ht)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Ht?(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Ht)}, ${e.time}`,disabled:!wi.ok,accessibilityHint:wi.hint,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}):null,(0,ve.bookingDetails)(e)]})}):ts({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(rt,{rid:mt,id:e.id,turnBase:jt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(we.CancelWalkInButton,{rid:mt,b:e,big:!0,onDone:e=>{ts(null),Es(e)}}):null,e.walkIn?(0,qe.jsx)(we.ReinstateWalkInButton,{rid:mt,b:e,today:Ht,onDone:e=>{ts(null),Es(e)}}):null,(0,ve.bookingDetails)(e)]})}),Us=kt.filter(e=>e.date===Ht).sort((e,t)=>e.time.localeCompare(t.time)),Ks=Us.filter(e=>!['cancelled','noshow'].includes(e.status)),qs=wt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,H.useMemo)(()=>(0,c.forecastToday)(jt,kt,wt,It,St),[jt,kt,wt,It,St.getTime()/6e4|0]),Qs=(0,$e.closedAreasAt)(Gt,mt,Ht,(0,ee.hm)(St)),Js=[...Qs].join(','),Xs=(0,H.useMemo)(()=>(0,re.floorView)(Nt,kt,wt,_t??{},St,jt.settings.turnMins,Qs),[Nt,kt,wt,_t,St.getTime(),Js]),Zs=(0,De.hoursFor)(jt,St),el=Zs?.open??new Date(`${Ht}T12:00:00`),tl=Zs?.close??new Date(`${Ht}T21:00:00`),sl=(0,ee.addMins)(el,-el.getMinutes()),ll=(0,ee.addMins)(tl,30),il=e=>new Date(`${Ht}T${e}:00`),nl=(0,$e.blocksOn)(Gt,mt,Ht).map(e=>({from:il(e.from),to:il(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(jt,St,Ht)),ol=Object.keys(Xs).filter(e=>'blocked'===Xs[e]?.status),al=js&&js!==Ht?js:Ht,rl=al!==Ht,dl=(0,ze.dayWord)(al,Ht),cl=/^(Today|Yesterday|Tomorrow)$/.test(dl),ul=rl?(0,ze.bookingsForDay)(kt,al,Ht).sort((e,t)=>e.time.localeCompare(t.time)):Us,hl=(0,ee.parseYmd)(al);hl.setHours(12);const gl=rl?(0,De.hoursFor)(jt,hl):Zs,bl=gl?.open??new Date(`${al}T12:00:00`),yl=gl?.close??new Date(`${al}T21:00:00`),pl=e=>new Date(`${al}T${e}:00`),fl=[...rl?(0,$e.blocksOn)(Gt,mt,al).map(e=>({from:pl(e.from),to:pl(e.to),label:e.reason??'Paused'})):nl,...rl?(0,n.queuedServicePauses)(jt,hl,al):[]],xl=(0,n.queuedServiceSessions)(jt,hl),ml=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),jl=(0,qe.jsxs)(U.default,{testID:"queued-hours-gate",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Y.Muted,{children:i.queuedVenues[mt]?.hours.note})]}),wl=rl?gl||ul.length?alrl?(0,re.dayFloorView)(Nt,ul,al):Xs,[rl,Nt,ul,al,Xs]),[Il,Dl]=(0,H.useState)(null),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(!1),[Rl,$l]=(0,H.useState)(null),Bl=rl?ul.filter(e=>!['cancelled','noshow'].includes(e.status)):Ks,Wl=Bl.reduce((e,t)=>e+t.partySize,0),Ll=(0,u.coversSplit)(Bl,al),zl=(0,Pe.cancelledDayTally)(kt,al),Hl=(0,Me.cancellationsFor)(kt,al,e=>e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)','')),Pl=(0,Pe.cancelledTallyWords)(zl,cl?dl.toLowerCase():rl?`on ${dl}`:'today'),Ml=Gt.filter(e=>e.rid===mt&&e.date===al&&!e.removedAt),Al=60*bl.getHours()+bl.getMinutes(),El=60*yl.getHours()+yl.getMinutes(),Ol=(0,Le.chartBands)(Ml,Al,El),Nl=(0,Le.seasonClosedAreaIds)(Ml,Al,El),_l=Nl.size?{...Nt,areas:Nt.areas.filter(e=>!Nl.has(e.id)),tables:Nt.tables.filter(e=>!Nl.has(e.areaId))}:Nt,Gl=rl?[]:ol.filter(e=>!Nl.has(Nt.tables.find(t=>t.name===e)?.areaId??'')),Fl=new Set((0,Le.blockedHours)(Ol)),Vl=St.getHours()+(St.getMinutes()>=30?1:0),Ul=Ys.hours.filter(e=>e.hour>=Vl&&!Fl.has(e.hour)),Kl=Ul.reduce((e,t)=>e+t.coversHigh,0),ql=Ul.reduce((e,t)=>e+t.coversLow,0),Yl=Math.round((ql+Kl)/2),Ql=!Ys.example&&Ys.open&&Ys.enough&&Kl>0?`Usually ${(0,c.coversRange)(Yl,Yl)} more`:void 0,Jl=async(e,t)=>{const s=Xs[e]?.booking;if(!s||e===t)return;const l=Xs[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 ${re.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,ke.guardBookingChange)(Es,{b:s,tables:[t]}))return;await te.repo.bookings.update(s.id,{table:t});const i=_t?.[e]?.stage;ae.useFloor.getState().setLive(mt,t,{stage:i??'seated',dirty:!1}),ae.useFloor.getState().setLive(mt,e,{stage:void 0,dirty:!0}),Es(`Saving: ${(0,fe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,ke.reportBookingSave)(s.id,`${(0,fe.privName)(s,Et)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}`,Es)},Xl=e=>{if(xs)return Sl(null),void ms(t=>t?{...t,tables:(0,Ie.toggleTable)(t.tables,e)}:t);rl?Dl(e):Xt?(e!==Xt&&Jl(Xt,e),Zt(null)):Jt(e)},Zl=xs?kt.find(e=>e.id===xs.id):void 0,ei=xs&&Zl?(()=>{const e=Zl.walkIn?(0,fe.privName)(Zl,Et):tt(Zl.name),t=(0,Ie.seatsOf)(Nt,xs.tables).total,s=(0,Ie.seatLine)(t,Zl.partySize),l=(0,Ie.pickClashes)(Zl,xs.tables,kt.filter(e=>e.date===Zl.date),jt.settings.turnMins),i=(0,Ie.tableKey)(xs.tables)!==(0,Ie.tableKey)((0,ae.tablesOf)(Zl.table));return(0,qe.jsxs)(U.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,qe.jsxs)(U.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Zl.date,Ht)} ${Zl.time}. Tap tables on the plan to add or take them off. ${(0,Ie.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Zl.date,Ht)," ",Zl.time]}),(0,qe.jsxs)(Y.T,{size:16,colour:se.colours.text,children:[(0,Ie.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),vl?(0,qe.jsx)(U.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:vl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,qe.jsx)(Y.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:vl})}):null,Cl&&Zl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Tl(!1),(async()=>{if(!(0,ke.guardBookingChange)(Es,{b:Zl,tables:xs.tables}))return Sl(null),void ms(null);const s=xs.tables;ms(null),await(0,ke.saveTablesReported)(mt,Zl,s,e,t,Es)})()},onNo:()=>Tl(!1)}):null,(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:vl?'plan-pick-overcap-yes':'plan-pick-save',label:vl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${vl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,Ie.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Zl)return void ms(null);if(!(0,ke.guardBookingChange)(Es,{b:Zl,tables:xs.tables}))return Sl(null),void ms(null);const s=(0,Ie.overCapacityAsk)(xs.tables,t,Zl.partySize);if(s&&!vl)return void Sl(s);if('finished'===Zl.status&&xs.tables.length&&!Cl)return void Tl(!0);Sl(null),Tl(!1);const l=xs.tables;ms(null),await(0,ke.saveTablesReported)(mt,Zl,l,e,t,Es)}}),(0,qe.jsx)(Y.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Sl(null),ms(null)}})]})]})})():null,ti=_l.areas.filter(e=>_l.tables.some(t=>t.areaId===e.id)),si=e=>{const t=Nt.tables.filter(t=>t.areaId===e);return rl?`${t.filter(e=>!kl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Xs[e.name]?.status??'free')).length}/${t.length} free`},li='all'===qt||ti.some(e=>e.id===qt)?qt:'all',ii=e=>(0,qe.jsx)(de.FloorCanvas,{plan:_l,areaId:e,mode:"live",fit:"contain",crop:!0,fill:ht,big:!0,view:kl,privacy:Et,turnBase:jt.settings.turnMins,highlight:xs?xs.tables:Xt?[Xt]:void 0,onTap:e=>Xl(e.name),onDrop:(e,t)=>xs||rl?void 0:Jl(e.name,t.name)}),ni=ct?1:ut||ti.length>2?2:1,oi=e=>{const t=Nt.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},ai=[];for(let e=0;e{const t=(0,de.areaBounds)(Nt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,de.minReadableScale)(Nt,e.id)}}),ft.w,ft.h):null,di=e=>(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',height:ce.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:si(e.id)})]}),ci=(0,qe.jsx)(U.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-ft.w)>1||Math.abs(s-ft.h)>1)&&xt({w:t,h:s})},children:ri?(0,qe.jsx)(V.default,{style:{flex:1},scrollEnabled:ri.scroll,showsVerticalScrollIndicator:ri.scroll,contentContainerStyle:{gap:ce.GRID_GAP},children:ri.rows.map((e,t)=>(0,qe.jsx)(U.default,{style:{height:ri.rowHeights[t],flexDirection:'row',gap:ce.GRID_GAP},children:e.map(e=>{const t=ti.find(t=>t.id===e);return(0,qe.jsxs)(U.default,{testID:`area-cell-${e}`,style:{width:ri.cellW,gap:2},children:[di(t),(0,qe.jsx)(U.default,{style:{flex:1},children:ii(e)})]},e)})},t))}):null}),ui=(0,qe.jsxs)(U.default,{testID:"venue-plan",style:{flex:ct?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:Nt}),Nt.tables.length?null:(0,qe.jsxs)(U.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,qe.jsx)(Y.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Y.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)(Y.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,qe.jsx)(nt,{chipId:"all",compact:!ct,label:"Whole venue",selected:'all'===li,onPress:()=>Yt('all')},"__all"),...ti.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ct,label:`${e.name}${(0,ue.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ct?Qs.has(e.id)?'closed':li===e.id?si(e.id):void 0:void 0,selected:li===e.id,onPress:()=>Yt(e.id)},e.id))];return ct?(0,qe.jsx)(U.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,qe.jsx)(V.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:Ps.view>0&&Ps.content>0&&Ps.content<=Ps.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ps.view>0&&Ps.content<=Ps.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),ei,Xt?(0,qe.jsxs)(Y.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Y.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Xt),": tap the new table."]}),(0,qe.jsx)(Y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Zt(null)})]}):null,'all'===li&&ht?ci:'all'===li?(0,qe.jsx)(U.default,{style:{flex:ct?void 0:1,gap:12,minHeight:gt?void 0:360},children:ai.map((e,t)=>(0,qe.jsxs)(U.default,{style:{flex:ct?void 0:Math.max(.3,...e.map(e=>oi(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(U.default,{style:{flex:1,gap:2},children:[ct?(0,qe.jsxs)(U.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Y.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{center:!0,children:si(e.id)})]}):(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{children:si(e.id)})]}),(0,qe.jsx)(U.default,{style:ct?{height:Math.max(280,Math.round((at-40)*oi(e.id)))}:{flex:1},children:ii(e.id)})]},e.id)),e.length{if(rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},al)}),gi='timeline'===Ft,bi=Ut?(0,qe.jsx)(_.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Kt(!1),supportedOrientations:['landscape','portrait'],children:(0,qe.jsxs)(U.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,qe.jsx)(F.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Kt(!1),style:{minHeight:64,minWidth:at<600?120:180,paddingHorizontal:at<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,qe.jsx)(U.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,qe.jsx)(Y.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${rl?(0,ze.dayLong)(al):'Today'}`})}),at<600?null:(0,qe.jsx)(U.default,{style:{minWidth:180}})]}),ml?jl:(0,qe.jsx)(U.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(be.Timeline,{hideNow:!0,fit:!0,plan:_l,bookings:rl?ul:Us,now:rl?bl:St,privacy:Et,turnBase:jt.settings.turnMins,t0:rl?(0,ee.addMins)(bl,-bl.getMinutes()):sl,t1:rl?(0,ee.addMins)(yl,30):ll,pauses:rl?fl:nl,blockedTables:Gl,onOpen:e=>{if(Kt(!1),rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},`full-${al}`)})]})}):null,yi=rl?(0,qe.jsxs)(U.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:cl?`Showing ${dl} \xb7 ${(0,ee.niceDate)((0,ee.parseYmd)(al))}`:`Showing ${(0,ze.dayWord)(al,Ht)}`}),(0,qe.jsx)(U.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Pl}. Showing ${(0,ze.dayLong)(al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Y.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ms(null),vs(null)},style:{minHeight:44}})]}):null,pi=(0,qe.jsx)(U.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:ct?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(gi||Ut);return(0,qe.jsx)(F.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?(Vt('plan'),Kt(!0)):(Kt(!1),Vt('plan'))},style:{flex:ct?1:void 0,minHeight:ct?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',...Ne.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)(Y.T,{size:ct?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),fi='display'===I.APP_VARIANT&&!e,xi='display'===I.APP_VARIANT&&!e,mi=!e&&!I.IS_CAR&&!ct,ji=fi?(0,qe.jsxs)(U.default,{testID:"display-view-row",style:{flexDirection:ct?'column':'row',flexWrap:ct||mi?'nowrap':'wrap',gap:6,alignItems:ct||mi?'stretch':'center'},children:[pi,(0,qe.jsx)(k.DisplayRotaKitchenButtons,{phone:ct,fill:mi,shifts:Rt,staff:Ct,today:Ht,leave:$t})]}):pi,wi=(0,h.useBookingWrite)(),ki=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Walk-in",onPress:Mt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"New booking",onPress:Mt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint})]});(0,Ke.useDisplayNotices)(mt,!e);const Ii=!e&&!I.IS_CAR&&!ct,Di=ct?180:202,[vi,Si]=(0,H.useState)(ct?180:168),Ci=P.default.useRef(ct?180:168),Ti=P.default.useRef(null),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(!1),[Wi,Li]=(0,H.useState)(!1),zi=!ct&&dt<=800,Hi=We.DAY_GRAPH_CHROME+(zi?24:8),Pi=P.default.useRef(0),[Mi,Ai]=(0,H.useState)(Hi),[Ei,Oi]=(0,H.useState)(!0),[Ni,Gi]=(0,H.useState)(!1);P.default.useEffect(()=>{Gi(!1)},[at,dt]);const Fi=P.default.useRef(()=>{}),Vi=P.default.useCallback(e=>{Math.abs(e-Pi.current)>=2&&(Pi.current=e,setTimeout(()=>Fi.current(),0))},[]),Ui=()=>{const e=Ti.current,t=Ri.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=t>Ci.current?Math.ceil(t-Ci.current):0,o=Ii?Math.max(Hi,Pi.current):Math.max(Hi,n);Ii&&o!==Mi&&Ai(o);const a=!ct&&dt>=700?140:70,r=Math.floor(s-4-e)-o-l,d=i>0&&r-i>=a;Ii&&d!==Ei&&Oi(d),Ii&&!Ni&&r<48&&Gi(!0);const c=r-(d?i:0),u=Math.min(Di,c>=a?Math.max(a,c):Math.max(0,c));Math.abs(Ci.current-u)>=2&&(Ci.current=u,Si(u))},l=44+(dt<820?4:8),i=46+(dt<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=$i.current;Ii&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=dt<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Bi.current?44+d:0)}):s(n,a,t,Ii?i:l)})})};Fi.current=Ui,P.default.useEffect(()=>{const e=setTimeout(()=>Fi.current(),60),t=setTimeout(()=>Fi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[at,dt,al]);const Ki=(0,qe.jsxs)(U.default,{ref:Ri,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ui()},style:{flexDirection:'row',flexWrap:at>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ct?12:zi?2:6,justifyContent:ct?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ue.DisplayClockButton,{}),(0,qe.jsx)(ge.HoldToEdit,{quiet:!0,onUnlock:()=>{Fs(null),Ns({at:Date.now()})},onHint:()=>Es('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(Be.BlockBookingsButton,{rid:mt,r:jt,now:St,by:Lt,quiet:!0,display:!0,day:al}),Nt.areas.some(e=>e.outdoor)?(0,qe.jsx)(Be.CloseGardenButton,{rid:mt,r:jt,now:St,by:Lt,quiet:!0,short:!0}):null,(0,qe.jsx)(F.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Hs(!0),style:({pressed:e})=>({...Ne.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,qe.jsx)(f.GiftQrButton,{rid:mt,venue:jt.name})]}),qi=qs.length?(0,qe.jsxs)(U.default,{testID:"takeaway-panel",style:[Ne.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Y.T,{size:12,colour:se.colours.muted,children:[qs.length," live"]})]}),(0,qe.jsx)(U.default,{style:{padding:10},children:(0,qe.jsx)(ot,{list:qs,me:Lt,compact:!0,bookings:kt})})]}):null,Yi=(Ee.DueToday,jt.settings.turnMins||90),Qi=rl?ul:(0,v.todaysGuestList)(Us,St,Yi),Ji=rl?[]:(0,v.todaysFinishedList)(Us,St,Yi),Xi=rl?cl?`${dl}\u2019s guests`:`Guests ${dl}`:'Today\u2019s guests',Zi=(0,qe.jsxs)(qe.Fragment,{children:[0===Qi.length?(0,qe.jsx)(Y.Muted,{children:rl?al{const t=(0,v.isLeftEarly)(e,St,Yi),s=(0,le.isSeatedHighlight)(e.status,{otherDay:rl})&&!t,l=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=se.colours.text,n=s?se.colours.goldLight:se.colours.muted,o=se.colours.gold,a=l.depositWarn?se.colours.amber:se.colours.goldLight;return(0,qe.jsxs)(F.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:rl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,le.seatedHighlightStyle)({backgroundColor:e?Qe:Ye,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,qe.jsx)(Y.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)(U.default,{style:{paddingTop:2},children:(0,qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,qe.jsxs)(Y.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Y.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}),(0,qe.jsx)(Y.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,qe.jsx)(Y.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(U.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(me.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,qe.jsx)(Y.T,{size:15,colour:se.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),Ji.length?(0,qe.jsxs)(U.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(F.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ji.length}${bs?', expanded':', collapsed'}`,accessibilityState:{expanded:bs},onPress:()=>ys(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Y.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ji.length,")"]}),(0,qe.jsx)(Y.T,{size:16,colour:se.colours.muted,children:bs?'\u25be':'\u25b8'})]}),bs?Ji.map(e=>{const t=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,qe.jsxs)(F.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Y.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Y.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,qe.jsx)(U.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,qe.jsx)(S.BookingUndo,{b:e,rid:mt,today:Ht,who:t.name,allowed:wi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ae.CancellationsSection,{items:Hl,dayWord:rl?cl?dl.toLowerCase():`on ${dl}`:'today'})]}),en=(0,qe.jsx)(V.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Zi}),tn=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&gs(!1)}}),sn=(0,qe.jsxs)(F.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Xi}, ${Qi.length}`,accessibilityState:{expanded:hs},'aria-expanded':hs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>gs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:hs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:hs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Y.T,{size:16,weight:"bold",colour:se.colours.gold,children:Qi.length}),(0,qe.jsx)(U.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(U.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,qe.jsxs)(Y.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Xi," ",hs?'\u2039':'\u203a']})})})]}),ln=hs?(0,qe.jsxs)(U.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,qe.jsxs)(U.default,{testID:"guests-drawer",...tn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*at)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,...Ne.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,qe.jsxs)(U.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Xi.toUpperCase()," (",Qi.length,")"]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Xi}`,onPress:()=>gs(!1),style:{marginRight:-6}})]}),zl.count?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Pl}):null,(0,qe.jsx)(U.default,{testID:"guests-tools",style:{flexDirection:'row',gap:8,marginTop:6,justifyContent:'center'},children:(0,qe.jsx)(F.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:cs},'aria-expanded':cs,onPress:()=>us(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:14,borderRadius:12,borderWidth:1,borderColor:cs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',backgroundColor:e?se.colours.tilePressed:cs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:se.colours.goldLight,children:["Guest key ",cs?'\u25b4':'\u25be']})})}),cs?(0,qe.jsx)(U.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: warning sign allergy, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:6},children:[['\u26a0','allergy'],['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(Y.T,{size:16,children:e}),(0,qe.jsx)(Y.T,{size:14,children:t})]},t))}):null]}),en]}),(0,qe.jsx)(F.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Xi}`,accessibilityRole:"button",onPress:()=>gs(!1),style:{flex:1}})]}):null,nn=ml?jl:l.IS_KIRKTON&&!Object.values(jt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(U.default,{testID:"kirkton-hours-to-confirm",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Y.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(jt,kt,St).busy,todays:ul,open:bl,close:yl,now:St,turnBase:jt.settings.turnMins,blocks:Ml,pauses:fl,compact:ct,dense:!ct,fit:ht,tight:ht&&dt<=600,height:ht?vi:Di,forecastNote:rl?void 0:Ql,emptyText:wl,past:al{Ds.current=Date.now(),Is(!0)},shortDay:!ct&&at<1100}),rn=(0,qe.jsx)(He.DisplayCalendar,{visible:ks,today:Ht,day:al,bookings:kt,restaurant:jt,now:St,onDay:vs,onClose:()=>Is(!1)}),dn=()=>{rl?gs(!0):Kt(!0)},cn=(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',padding:zi?4:dt<820?8:12,paddingTop:zi?Ii?2:4:dt<820?Ii?4:6:Ii?8:10,gap:zi?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:yi,Pt?(0,qe.jsx)(V.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"})}):gi?hi:ui,bi,ln]}),(0,qe.jsxs)(U.default,{testID:"display-side",style:{width:bt,gap:dt<820?4:8,minHeight:0},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ki(!1)}),(0,qe.jsx)(U.default,{style:{flexShrink:0},children:ji}),Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",onLayout:Ui,style:Ii&&!Ni?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:dt<820,snug:dt<820,tight:dt<800,fill:Ii&&!Ni,sound:(0,E.flapSoundOn)(),onPress:dn})}),Pt?null:(0,qe.jsx)(U.default,{ref:Ti,testID:"day-graph-slot",onLayout:Ui,style:{flexGrow:0,flexShrink:Ii?0:1,flexBasis:(ct?Di:vi)+(Ii?Mi:Hi),height:(ct?Di:vi)+(Ii?Mi:Hi),minHeight:dt<=600?90:Math.min((ct?Di:vi)+We.DAY_GRAPH_CHROME,!ct&&dt>=768?140+We.DAY_GRAPH_CHROME:120),overflow:'visible'},children:on}),Ii&&!Pt?(0,qe.jsx)(U.default,{ref:$i,testID:"display-side-split",onLayout:Ui,style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})}):null,(0,qe.jsxs)(V.default,{testID:"display-side-scroll",style:Ii?{flexGrow:0,flexShrink:1,minHeight:Wi&&Ei?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Bi.current&&(Bi.current=s,Li(s),setTimeout(Ui,0))},children:[Ii||xi?null:(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),qi,(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt})]})]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Ds.current=Date.now()},onMouseDown:()=>{Ds.current=Date.now()},children:[ct?(0,qe.jsx)(U.default,{style:{flex:1},children:(0,qe.jsxs)(V.default,{ref:yt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,qe.jsxs)(U.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,qe.jsx)(U.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,qe.jsx)(j.ExitButton,{})}),(0,qe.jsx)(X.RestaurantLogo,{rid:mt,size:64}),(0,qe.jsx)(Y.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:jt.name}),(0,qe.jsx)(X.PoweredBy,{}),(0,qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(U.default,{accessible:!0,accessibilityLabel:`Current time ${(0,ee.hm)(St)}`,children:(0,qe.jsx)(Y.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,ee.hm)(St)})}),(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:"m"}),(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",size:"m"}),Z]}),Fe,I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(ke.BookingSaveBanner,{rid:mt}),an,(0,qe.jsx)(U.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(it,{phone:!0,split:Ll,items:[{label:`Tables \xb7 ${dl}`,value:Bl.length,testID:'badge-tables'},{label:`Covers \xb7 ${dl}`,value:Wl,testID:'badge-covers'},{label:'Takeaway',value:qs.length,alert:qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ls(!0)}]})}),(0,qe.jsx)(U.default,{testID:"primary-actions",style:{gap:8},children:ki(!0)}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt}),ji,(0,qe.jsxs)(U.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[gi?hi:ui,bi]}),(0,qe.jsxs)(U.default,{onLayout:e=>{pt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ne.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Y.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Xi," (",Qi.length,")"]}),(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{gap:4},children:Zi})]}),qi,on,(0,qe.jsx)(U.default,{testID:"covers-dock",children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>yt.current?.scrollTo({y:pt.current,animated:!0})})}),(0,qe.jsxs)(U.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,qe.jsx)(Y.T,{center:!0,size:14,colour:Et?se.colours.muted:se.colours.amber,children:Et?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Y.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Rs(!0),style:{minHeight:48,alignSelf:'stretch'}}),xi?null:(0,qe.jsx)(Y.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ki]})}):(0,qe.jsxs)(qe.Fragment,{children:[Ii?(0,qe.jsx)(U.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:se.colours.hairline},children:(0,qe.jsx)(U.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)(U.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,paddingVertical:zi?2:dt<820?4:8,gap:8,minHeight:zi&&Ii?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ne.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(U.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:Ii?16:8,minWidth:0,overflow:'hidden',...Ii?{justifyContent:'flex-start'}:null},children:[(0,qe.jsx)(U.default,{testID:"display-header-brand",style:Ii?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(X.RestaurantBrand,{rid:jt.id,size:at<900?32:40,beside:!0,noLogo:Ii})}),(0,qe.jsxs)(U.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Y.T,{size:at<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,ee.hm)(St)}),at>=900?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:(0,ee.niceDate)(St)}):null]})]}),Pt?(0,qe.jsx)(U.default,{style:{width:220}}):(0,qe.jsx)(U.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:an}),(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,qe.jsxs)(U.default,{testID:"display-header-chips",style:{flexDirection:at>=1400||Ii?'row':'column',alignItems:at>=1400||Ii?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:at<1240?'xs':at<1280||dt<700?'s':'m'}),Pt?null:(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",slot:Ii,size:at<1340?'xs':at<1400||dt<700?'s':'m'})]}),'simulated'===vt?(0,qe.jsx)(F.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>Dt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,Z,e?null:(0,qe.jsx)(U.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(j.ExitButton,{size:44})})]})]}),Fe,I.IS_CAR||!Pt||Ii?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(ke.BookingSaveBanner,{rid:mt,margin:{marginHorizontal:12,marginTop:6}}),Pt||Ii?null:(0,qe.jsx)(U.default,{testID:"display-day-stats",style:Xe,children:(0,qe.jsxs)(U.default,{style:Ze,children:[I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(U.default,{style:et,children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})})]})}),ht?cn:(un=(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{testID:"front-door-bar",style:{gap:10},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ki(!1)}),ji]}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt}),Pt?(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"}):(0,qe.jsx)(qe.Fragment,{children:(0,qe.jsxs)(U.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[yi,gi?hi:ui,bi,ln]})]})}),qi,Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,sound:(0,E.flapSoundOn)(),onPress:dn})}),Pt?null:(0,qe.jsx)(U.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Di+We.DAY_GRAPH_CHROME},children:on})]}),(0,qe.jsx)(V.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:un})),Ki]}),(0,qe.jsx)($.SoldOutStrip,{rid:mt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:zs,onClose:()=>Hs(!1),rid:mt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:mt}),Mt.elements,is?(0,qe.jsx)(y.EditBookingPicker,{rid:mt,today:Ht,who:Lt,onClose:()=>ns(!1)}):null,os?(0,qe.jsx)(y.EditBookingSheet,{rid:mt,id:os,who:Lt,onClose:()=>as(null)}):null,Qt?(0,qe.jsx)(ve.TableSheet,{rid:mt,name:Qt,view:Xs,plan:Nt,todays:Us,now:St,privacy:Et,turnBase:jt.settings.turnMins,onClose:()=>Jt(null),onWalkIn:e=>Mt.openWalkInAt(e),onMove:e=>Zt(e),onDetails:Vs}):null,Il?(()=>{const e=kl[Il],t=e?.dayBookings??[];return(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>{$l(null),Dl(null)},title:`${(0,d.tableNumbersA11y)(Il)} \xb7 ${cl?dl:(0,ze.dayLong)(al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Y.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${cl?dl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${cl?dl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Et):tt(e.name);return(0,qe.jsx)(Y.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,Ie.tablesWords)((0,ae.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Dl(null),fs(e.id)},style:{minHeight:56}},e.id)}),al>=Ht?(()=>{const t=e?.table.maxSeats??0,s=kt.filter(e=>e.date===al&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,ae.tablesOf)(e.table).includes(Il)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,qe.jsxs)(U.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(Il)]}),Rl?(0,qe.jsxs)(U.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Rl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Rl.ask}),(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!wi.ok,accessibilityHint:wi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=kt.find(e=>e.id===Rl.id);if($l(null),!e)return;const s=tt(e.name);Dl(null),await(0,ke.saveTablesReported)(mt,e,[Il],s,t,Es)}}),(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>$l(null)})]})]}):null,Rl?null:s.slice(0,12).map(e=>{const s=tt(e.name),l=e.partySize>t;return(0,qe.jsx)(Y.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:!wi.ok,accessibilityHint:wi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(Il)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,ke.guardBookingChange)(Es,{b:e,tables:[Il]}))return;const l=(0,Ie.overCapacityAsk)([Il],t,e.partySize);l?$l({id:e.id,ask:l}):(Dl(null),await(0,ke.saveTablesReported)(mt,e,[Il],s,t,Es))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Y.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{$l(null),Dl(null)},style:{minHeight:56}})]})})():null,ps?(()=>{const e=kt.find(e=>e.id===ps);return e?(0,qe.jsx)(je.GuestActionsSheet,{rid:mt,b:e,name:e.walkIn?(0,fe.privName)(e,Et):tt(e.name),view:Xs,now:St,otherDay:e.date!==Ht,turnBase:jt.settings.turnMins,onClose:()=>fs(null),onDetails:Vs,onDone:Es,onEdit:e=>{fs(null),as(e.id)},onPickOnPlan:(e,t)=>{gs(!1),Vt('plan'),Yt('all'),ms({id:e.id,tables:t})}}):null})():null,es?(0,qe.jsx)(ve.DetailsPanel,{title:es.title,onClose:()=>ts(null),children:es.body}):null,rn,rs?(0,qe.jsx)(ve.ServiceSummary,{r:jt,todays:Us,orders:wt,waitlistAll:Ss,walkInCount:Cs,onClose:()=>ds(!1)}):null,Ts?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Rs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsx)(Y.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Rs(!1)})]}):null,Ws?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ls(!1),Bs(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,$s?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(Q.ReviewsSection,{rid:mt,mode:"read",venueName:jt.name}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,ss?(0,qe.jsxs)(ve.DetailsPanel,{title:"Takeaway",onClose:()=>ls(!1),children:[(0,qe.jsx)(Y.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(ot,{list:qs,me:Lt,bookings:kt})]}):null,Os?(0,qe.jsx)(U.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,qe.jsx)(he.PlanDesigner,{initial:Nt,venue:jt.name,mode:"display",startStep:"arrange",onActivity:()=>{_s.current=Date.now(),null!==Gs&&Fs(null)},notice:null!==Gs?`Locking again in ${Gs} s \xb7 touch to keep editing`:null,onSave:e=>{ae.useFloor.getState().setPlan(mt,e),Ns(null),Es('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{ae.useFloor.getState().setPlan(mt,e),Es('Live seating plan updated on every screen.')},onCancel:()=>{Ns(null),Es('No changes kept. Editing is locked again.')}},Os.at)}):null,e?null:(0,qe.jsx)(ye.Screensaver,{rid:mt,idleMins:At.idleMins,pinOn:At.pinOn,wake:At,tonightCards:At.tonightCards,cfg:Ot}),e?null:(0,qe.jsx)(Ce.PrintHost,{rid:mt}),e?null:(0,qe.jsx)(Se.AlertHost,{variant:"display",rid:mt,skipTakeaway:!0}),e?null:(0,qe.jsx)(O.SeatAllergenReminder,{rid:mt}),e?null:(0,qe.jsx)(Te.TakeawayTakeover,{rid:mt,me:Lt})]});var un}function rt({rid:e,id:t,turnBase:s}){const l=(0,te.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1336,[1051,779,805,806,1337,813,1338,1092,843,1138,1339,1340,1341,1089,1119,1342,1343,1348,1349,1206,1350,856,1355,1356,1357,1112,1111,920,1358,1150,891,1102,1359,17,1070,1182,1016,1085,1360,378,363,385,278,85,409,19,777,1237,1241,857,845,863,858,804,1088,876,1096,1055,996,1074,1107,1361,1106,1362,1369,1371,1374,1379,1373,1380,1383,1384,1114,1093,1094,862,1389,1226,1390,1236,1228,993,1395,1400,1401,1052,1050,1116,1403,1404,1405,1069,1169,1406,1168,1159,853,1351,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 Je}}),_e2.DisplayBoard=function(e={}){const t=(0,ie.useOwner)(e=>e.site);return(0,te.useRestaurant)(t)?(0,qe.jsx)(at,{...e}):(0,qe.jsx)(U.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Y.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]),S=_r(_d[23]),v=_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=_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]),Se=_r(_d[76]),ve=_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]);const Ye='#221C12',Qe='#2E2618',Je=12e4,Xe={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},Ze={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},et={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},tt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),lt=e=>e.slotTime?(0,ee.hm)(new Date(e.slotTime)):'ASAP';function it({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,qe.jsxs)(U.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)(U.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)(U.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)(Y.T,{size:s?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,qe.jsx)(Y.T,{size:s?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,qe.jsx)(F.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)(U.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)(Y.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,qe.jsxs)(U.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,qe.jsx)(U.default,{style:{width:`${l.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,qe.jsx)(U.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,qe.jsxs)(F.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)(U.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,qe.jsx)(Y.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Y.T,{size:12,colour:se.colours.muted,children:s}):null]})}function ot({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ve.statusBlock)(e,t,(0,Ve.linkedBooking)(e,l));return e.length?(0,qe.jsx)(U.default,{style:{gap:8},children:e.map(e=>(0,qe.jsxs)(U.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:s?16:18,weight:"bold",children:[lt(e)," \xb7 ",tt(e.customerName)]}),(0,qe.jsx)(Y.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)(Y.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)(Y.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,Z.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Fe.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Y.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Y.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>te.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Y.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Y.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Ce.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Y.Muted,{children:"No takeaway orders right now."})}function at({embedded:e=!1,boardW:b,headerExtra:Z,subHeader:Fe,noVoice:Ve=!1}={}){const lt=(0,K.default)(),at=b??lt.width,dt=lt.height,ct=at<700,ut=at>=dt,ht=!ct&&ut&&at>=600,gt=ht,bt=Math.round(Math.min(520,Math.max(at>=1e3?448:280,.3*at))),yt=P.default.useRef(null),pt=P.default.useRef(0),[ft,xt]=(0,H.useState)({w:0,h:0}),mt=(0,ie.useOwner)(e=>e.site),jt=(0,te.useRestaurant)(mt);(0,Re.useAlertWatcher)(mt,{enabled:!e});const wt=(0,te.useOrders)(mt),It=(0,te.useBookings)(mt),kt=(0,te.useEvents)(mt),Dt=(0,te.useStore)(e=>e.skipMinutes),St=(0,te.useStore)(e=>e.clock.mode),vt=(0,te.useNow)(5e3),Ct=(0,ie.useOwner)(e=>e.staff),Tt=(0,ie.useOwner)(e=>e.attendance),Rt=(0,ie.useOwner)(e=>e.shifts),$t=(0,ie.useOwner)(e=>e.leave),Bt=P.default.useMemo(()=>(0,Ee.workingShifts)(Rt,$t),[Rt,$t]);P.default.useEffect(()=>{(0,oe.ensureAttendance)((0,ee.ymd)(vt),vt)},[(0,ee.ymd)(vt)]);const Wt=(0,R.useSession)(e=>e.meId),Lt=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:tt(Ct.find(e=>e.id===Wt)?.name)}),zt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Ht=(0,ee.ymd)(vt),Pt=(0,A.useTravelDay)('display',Ht),Mt=(0,ne.useFrontDoor)(Ht,ut),At=(0,ae.useDisplaySettings)(mt),Ot=At.privacy,Et=(0,pe.useSaverSync)(),Nt=(0,ae.usePlan)(mt),_t=(0,ae.useFloor)(e=>e.live[mt]),Gt=(0,$e.useBlocks)(e=>e.blocks),[Ft,Vt]=(0,H.useState)('plan'),[Ut,Kt]=(0,H.useState)(!1),[qt,Yt]=(0,H.useState)('all'),[Qt,Jt]=(0,H.useState)(null),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(!1),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(null),[rs,ds]=(0,H.useState)(!1),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(null),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(!1),Ds=P.default.useRef(0),Ss=e=>{Ds.current=Date.now(),ws(e)};P.default.useEffect(()=>{if(!js)return;const e=setInterval(()=>{Date.now()-Ds.current>=ze.DAY_IDLE_MS&&ws(null)},5e3);return()=>clearInterval(e)},[js]);const vs=(0,te.useWaitlist)(mt),Cs=(0,te.useStore)(e=>e.walkIns[mt]??0),[Ts,Rs]=(0,H.useState)(!1),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1);(0,J.useReviewAlerts)(mt);const[Ps,Ms]=(0,H.useState)({view:0,content:0}),[As,Os]=(0,H.useState)(null);P.default.useEffect(()=>{As&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:As,timeoutMs:4500,big:!0,testID:'floor-toast'}),Os(null))},[As]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[Es,Ns]=(0,H.useState)(null),_s=P.default.useRef(0),[Gs,Fs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Es)return;_s.current=Date.now();const e=setInterval(()=>{const e=Date.now()-_s.current;if(e>=Je)return Ns(null),void Os('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Fs(e>=105e3?Math.ceil((Je-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Es]);const Vs=e=>e.date!==Ht?ts({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Ht)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Ht?(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Ht)}, ${e.time}`,disabled:!wi.ok,accessibilityHint:wi.hint,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ts({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(rt,{rid:mt,id:e.id,turnBase:jt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(we.CancelWalkInButton,{rid:mt,b:e,big:!0,onDone:e=>{ts(null),Os(e)}}):null,e.walkIn?(0,qe.jsx)(we.ReinstateWalkInButton,{rid:mt,b:e,today:Ht,onDone:e=>{ts(null),Os(e)}}):null,(0,Se.bookingDetails)(e)]})}),Us=It.filter(e=>e.date===Ht).sort((e,t)=>e.time.localeCompare(t.time)),Ks=Us.filter(e=>!['cancelled','noshow'].includes(e.status)),qs=wt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,H.useMemo)(()=>(0,c.forecastToday)(jt,It,wt,kt,vt),[jt,It,wt,kt,vt.getTime()/6e4|0]),Qs=(0,$e.closedAreasAt)(Gt,mt,Ht,(0,ee.hm)(vt)),Js=[...Qs].join(','),Xs=(0,H.useMemo)(()=>(0,re.floorView)(Nt,It,wt,_t??{},vt,jt.settings.turnMins,Qs),[Nt,It,wt,_t,vt.getTime(),Js]),Zs=(0,De.hoursFor)(jt,vt),el=Zs?.open??new Date(`${Ht}T12:00:00`),tl=Zs?.close??new Date(`${Ht}T21:00:00`),sl=(0,ee.addMins)(el,-el.getMinutes()),ll=(0,ee.addMins)(tl,30),il=e=>new Date(`${Ht}T${e}:00`),nl=(0,$e.blocksOn)(Gt,mt,Ht).map(e=>({from:il(e.from),to:il(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(jt,vt,Ht)),ol=Object.keys(Xs).filter(e=>'blocked'===Xs[e]?.status),al=js&&js!==Ht?js:Ht,rl=al!==Ht,dl=(0,ze.dayWord)(al,Ht),cl=/^(Today|Yesterday|Tomorrow)$/.test(dl),ul=rl?(0,ze.bookingsForDay)(It,al,Ht).sort((e,t)=>e.time.localeCompare(t.time)):Us,hl=(0,ee.parseYmd)(al);hl.setHours(12);const gl=rl?(0,De.hoursFor)(jt,hl):Zs,bl=gl?.open??new Date(`${al}T12:00:00`),yl=gl?.close??new Date(`${al}T21:00:00`),pl=e=>new Date(`${al}T${e}:00`),fl=[...rl?(0,$e.blocksOn)(Gt,mt,al).map(e=>({from:pl(e.from),to:pl(e.to),label:e.reason??'Paused'})):nl,...rl?(0,n.queuedServicePauses)(jt,hl,al):[]],xl=(0,n.queuedServiceSessions)(jt,hl),ml=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),jl=(0,qe.jsxs)(U.default,{testID:"queued-hours-gate",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Y.Muted,{children:i.queuedVenues[mt]?.hours.note})]}),wl=rl?gl||ul.length?alrl?(0,re.dayFloorView)(Nt,ul,al):Xs,[rl,Nt,ul,al,Xs]),[kl,Dl]=(0,H.useState)(null),[Sl,vl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(!1),[Rl,$l]=(0,H.useState)(null),Bl=rl?ul.filter(e=>!['cancelled','noshow'].includes(e.status)):Ks,Wl=Bl.reduce((e,t)=>e+t.partySize,0),Ll=(0,u.coversSplit)(Bl,al),zl=(0,Pe.cancelledDayTally)(It,al),Hl=(0,Me.cancellationsFor)(It,al,e=>e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)','')),Pl=(0,Pe.cancelledTallyWords)(zl,cl?dl.toLowerCase():rl?`on ${dl}`:'today'),Ml=Gt.filter(e=>e.rid===mt&&e.date===al&&!e.removedAt),Al=60*bl.getHours()+bl.getMinutes(),Ol=60*yl.getHours()+yl.getMinutes(),El=(0,Le.chartBands)(Ml,Al,Ol),Nl=(0,Le.seasonClosedAreaIds)(Ml,Al,Ol),_l=Nl.size?{...Nt,areas:Nt.areas.filter(e=>!Nl.has(e.id)),tables:Nt.tables.filter(e=>!Nl.has(e.areaId))}:Nt,Gl=rl?[]:ol.filter(e=>!Nl.has(Nt.tables.find(t=>t.name===e)?.areaId??'')),Fl=new Set((0,Le.blockedHours)(El)),Vl=vt.getHours()+(vt.getMinutes()>=30?1:0),Ul=Ys.hours.filter(e=>e.hour>=Vl&&!Fl.has(e.hour)),Kl=Ul.reduce((e,t)=>e+t.coversHigh,0),ql=Ul.reduce((e,t)=>e+t.coversLow,0),Yl=Math.round((ql+Kl)/2),Ql=!Ys.example&&Ys.open&&Ys.enough&&Kl>0?`Usually ${(0,c.coversRange)(Yl,Yl)} more`:void 0,Jl=async(e,t)=>{const s=Xs[e]?.booking;if(!s||e===t)return;const l=Xs[t]?.status;if(l&&!['free','soon'].includes(l))return void Os('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${re.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(Os,{b:s,tables:[t]}))return;await te.repo.bookings.update(s.id,{table:t});const i=_t?.[e]?.stage;ae.useFloor.getState().setLive(mt,t,{stage:i??'seated',dirty:!1}),ae.useFloor.getState().setLive(mt,e,{stage:void 0,dirty:!0}),Os(`Saving: ${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(s.id,`${(0,fe.privName)(s,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}`,Os)},Xl=e=>{if(xs)return vl(null),void ms(t=>t?{...t,tables:(0,ke.toggleTable)(t.tables,e)}:t);rl?Dl(e):Xt?(e!==Xt&&Jl(Xt,e),Zt(null)):Jt(e)},Zl=xs?It.find(e=>e.id===xs.id):void 0,ei=xs&&Zl?(()=>{const e=Zl.walkIn?(0,fe.privName)(Zl,Ot):tt(Zl.name),t=(0,ke.seatsOf)(Nt,xs.tables).total,s=(0,ke.seatLine)(t,Zl.partySize),l=(0,ke.pickClashes)(Zl,xs.tables,It.filter(e=>e.date===Zl.date),jt.settings.turnMins),i=(0,ke.tableKey)(xs.tables)!==(0,ke.tableKey)((0,ae.tablesOf)(Zl.table));return(0,qe.jsxs)(U.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,qe.jsxs)(U.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Zl.date,Ht)} ${Zl.time}. Tap tables on the plan to add or take them off. ${(0,ke.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Zl.date,Ht)," ",Zl.time]}),(0,qe.jsxs)(Y.T,{size:16,colour:se.colours.text,children:[(0,ke.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Sl?(0,qe.jsx)(U.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Sl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,qe.jsx)(Y.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Sl})}):null,Cl&&Zl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Tl(!1),(async()=>{if(!(0,Ie.guardBookingChange)(Os,{b:Zl,tables:xs.tables}))return vl(null),void ms(null);const s=xs.tables;ms(null),await(0,Ie.saveTablesReported)(mt,Zl,s,e,t,Os)})()},onNo:()=>Tl(!1)}):null,(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.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,ke.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Zl)return void ms(null);if(!(0,Ie.guardBookingChange)(Os,{b:Zl,tables:xs.tables}))return vl(null),void ms(null);const s=(0,ke.overCapacityAsk)(xs.tables,t,Zl.partySize);if(s&&!Sl)return void vl(s);if('finished'===Zl.status&&xs.tables.length&&!Cl)return void Tl(!0);vl(null),Tl(!1);const l=xs.tables;ms(null),await(0,Ie.saveTablesReported)(mt,Zl,l,e,t,Os)}}),(0,qe.jsx)(Y.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{vl(null),ms(null)}})]})]})})():null,ti=_l.areas.filter(e=>_l.tables.some(t=>t.areaId===e.id)),si=e=>{const t=Nt.tables.filter(t=>t.areaId===e);return rl?`${t.filter(e=>!Il[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Xs[e.name]?.status??'free')).length}/${t.length} free`},li='all'===qt||ti.some(e=>e.id===qt)?qt:'all',ii=e=>(0,qe.jsx)(de.FloorCanvas,{plan:_l,areaId:e,mode:"live",fit:"contain",crop:!0,fill:ht,big:!0,view:Il,privacy:Ot,turnBase:jt.settings.turnMins,highlight:xs?xs.tables:Xt?[Xt]:void 0,onTap:e=>Xl(e.name),onDrop:(e,t)=>xs||rl?void 0:Jl(e.name,t.name)}),ni=ct?1:ut||ti.length>2?2:1,oi=e=>{const t=Nt.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},ai=[];for(let e=0;e{const t=(0,de.areaBounds)(Nt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,de.minReadableScale)(Nt,e.id)}}),ft.w,ft.h):null,di=e=>(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',height:ce.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:si(e.id)})]}),ci=(0,qe.jsx)(U.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-ft.w)>1||Math.abs(s-ft.h)>1)&&xt({w:t,h:s})},children:ri?(0,qe.jsx)(V.default,{style:{flex:1},scrollEnabled:ri.scroll,showsVerticalScrollIndicator:ri.scroll,contentContainerStyle:{gap:ce.GRID_GAP},children:ri.rows.map((e,t)=>(0,qe.jsx)(U.default,{style:{height:ri.rowHeights[t],flexDirection:'row',gap:ce.GRID_GAP},children:e.map(e=>{const t=ti.find(t=>t.id===e);return(0,qe.jsxs)(U.default,{testID:`area-cell-${e}`,style:{width:ri.cellW,gap:2},children:[di(t),(0,qe.jsx)(U.default,{style:{flex:1},children:ii(e)})]},e)})},t))}):null}),ui=(0,qe.jsxs)(U.default,{testID:"venue-plan",style:{flex:ct?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:Nt}),Nt.tables.length?null:(0,qe.jsxs)(U.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,qe.jsx)(Y.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Y.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)(Y.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,qe.jsx)(nt,{chipId:"all",compact:!ct,label:"Whole venue",selected:'all'===li,onPress:()=>Yt('all')},"__all"),...ti.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ct,label:`${e.name}${(0,ue.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ct?Qs.has(e.id)?'closed':li===e.id?si(e.id):void 0:void 0,selected:li===e.id,onPress:()=>Yt(e.id)},e.id))];return ct?(0,qe.jsx)(U.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,qe.jsx)(V.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:Ps.view>0&&Ps.content>0&&Ps.content<=Ps.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ps.view>0&&Ps.content<=Ps.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),ei,Xt?(0,qe.jsxs)(Y.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Y.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Xt),": tap the new table."]}),(0,qe.jsx)(Y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Zt(null)})]}):null,'all'===li&&ht?ci:'all'===li?(0,qe.jsx)(U.default,{style:{flex:ct?void 0:1,gap:12,minHeight:gt?void 0:360},children:ai.map((e,t)=>(0,qe.jsxs)(U.default,{style:{flex:ct?void 0:Math.max(.3,...e.map(e=>oi(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(U.default,{style:{flex:1,gap:2},children:[ct?(0,qe.jsxs)(U.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Y.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{center:!0,children:si(e.id)})]}):(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{children:si(e.id)})]}),(0,qe.jsx)(U.default,{style:ct?{height:Math.max(280,Math.round((at-40)*oi(e.id)))}:{flex:1},children:ii(e.id)})]},e.id)),e.length{if(rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},al)}),gi='timeline'===Ft,bi=Ut?(0,qe.jsx)(_.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Kt(!1),supportedOrientations:['landscape','portrait'],children:(0,qe.jsxs)(U.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,qe.jsx)(F.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Kt(!1),style:{minHeight:64,minWidth:at<600?120:180,paddingHorizontal:at<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,qe.jsx)(U.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,qe.jsx)(Y.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${rl?(0,ze.dayLong)(al):'Today'}`})}),at<600?null:(0,qe.jsx)(U.default,{style:{minWidth:180}})]}),ml?jl:(0,qe.jsx)(U.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(be.Timeline,{hideNow:!0,fit:!0,plan:_l,bookings:rl?ul:Us,now:rl?bl:vt,privacy:Ot,turnBase:jt.settings.turnMins,t0:rl?(0,ee.addMins)(bl,-bl.getMinutes()):sl,t1:rl?(0,ee.addMins)(yl,30):ll,pauses:rl?fl:nl,blockedTables:Gl,onOpen:e=>{if(Kt(!1),rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},`full-${al}`)})]})}):null,yi=rl?(0,qe.jsxs)(U.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:cl?`Showing ${dl} \xb7 ${(0,ee.niceDate)((0,ee.parseYmd)(al))}`:`Showing ${(0,ze.dayWord)(al,Ht)}`}),(0,qe.jsx)(U.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Pl}. Showing ${(0,ze.dayLong)(al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Y.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ms(null),Ss(null)},style:{minHeight:44}})]}):null,pi=(0,qe.jsx)(U.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:ct?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(gi||Ut);return(0,qe.jsx)(F.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?(Vt('plan'),Kt(!0)):(Kt(!1),Vt('plan'))},style:{flex:ct?1:void 0,minHeight:ct?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',...Ne.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)(Y.T,{size:ct?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),fi='display'===k.APP_VARIANT&&!e,xi='display'===k.APP_VARIANT&&!e,mi=!e&&!k.IS_CAR&&!ct,ji=fi?(0,qe.jsxs)(U.default,{testID:"display-view-row",style:{flexDirection:ct?'column':'row',flexWrap:ct||mi?'nowrap':'wrap',gap:6,alignItems:ct||mi?'stretch':'center'},children:[pi,(0,qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ct,fill:mi,shifts:Rt,staff:Ct,today:Ht,leave:$t})]}):pi,wi=(0,h.useBookingWrite)(),Ii=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Walk-in",onPress:Mt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"New booking",onPress:Mt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint})]});(0,Ke.useDisplayNotices)(mt,!e);const ki=!e&&!k.IS_CAR&&!ct,Di=ct?180:202,[Si,vi]=(0,H.useState)(ct?180:168),Ci=P.default.useRef(ct?180:168),Ti=P.default.useRef(null),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(!1),[Wi,Li]=(0,H.useState)(!1),zi=!ct&&dt<=800,Hi=We.DAY_GRAPH_CHROME+(zi?24:8),Pi=P.default.useRef(0),[Mi,Ai]=(0,H.useState)(Hi),[Oi,Ei]=(0,H.useState)(!0),[Ni,Gi]=(0,H.useState)(!1);P.default.useEffect(()=>{Gi(!1)},[at,dt]);const Fi=P.default.useRef(()=>{}),Vi=P.default.useCallback(e=>{Math.abs(e-Pi.current)>=2&&(Pi.current=e,setTimeout(()=>Fi.current(),0))},[]),Ui=()=>{const e=Ti.current,t=Ri.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=t>Ci.current?Math.ceil(t-Ci.current):0,o=ki?Math.max(Hi,Pi.current):Math.max(Hi,n);ki&&o!==Mi&&Ai(o);const a=!ct&&dt>=700?140:70,r=Math.floor(s-4-e)-o-l,d=i>0&&r-i>=a;ki&&d!==Oi&&Ei(d),ki&&!Ni&&r<48&&Gi(!0);const c=r-(d?i:0),u=Math.min(Di,c>=a?Math.max(a,c):Math.max(0,c));Math.abs(Ci.current-u)>=2&&(Ci.current=u,vi(u))},l=44+(dt<820?4:8),i=46+(dt<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=$i.current;ki&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=dt<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Bi.current?44+d:0)}):s(n,a,t,ki?i:l)})})};Fi.current=Ui,P.default.useEffect(()=>{const e=setTimeout(()=>Fi.current(),60),t=setTimeout(()=>Fi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[at,dt,al]);const Ki=(0,qe.jsxs)(U.default,{ref:Ri,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ui()},style:{flexDirection:'row',flexWrap:at>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ct?12:zi?2:6,justifyContent:ct?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ue.DisplayClockButton,{}),(0,qe.jsx)(ge.HoldToEdit,{quiet:!0,onUnlock:()=>{Fs(null),Ns({at:Date.now()})},onHint:()=>Os('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(Be.BlockBookingsButton,{rid:mt,r:jt,now:vt,by:Lt,quiet:!0,display:!0,day:al}),Nt.areas.some(e=>e.outdoor)?(0,qe.jsx)(Be.CloseGardenButton,{rid:mt,r:jt,now:vt,by:Lt,quiet:!0,short:!0}):null,(0,qe.jsx)(F.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Hs(!0),style:({pressed:e})=>({...Ne.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,qe.jsx)(f.GiftQrButton,{rid:mt,venue:jt.name})]}),qi=qs.length?(0,qe.jsxs)(U.default,{testID:"takeaway-panel",style:[Ne.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Y.T,{size:12,colour:se.colours.muted,children:[qs.length," live"]})]}),(0,qe.jsx)(U.default,{style:{padding:10},children:(0,qe.jsx)(ot,{list:qs,me:Lt,compact:!0,bookings:It})})]}):null,Yi=(Oe.DueToday,jt.settings.turnMins||90),Qi=rl?ul:(0,S.todaysGuestList)(Us,vt,Yi),Ji=rl?[]:(0,S.todaysFinishedList)(Us,vt,Yi),Xi=rl?cl?`${dl}\u2019s guests`:`Guests ${dl}`:'Today\u2019s guests',Zi=(0,qe.jsxs)(qe.Fragment,{children:[0===Qi.length?(0,qe.jsx)(Y.Muted,{children:rl?al{const t=(0,S.isLeftEarly)(e,vt,Yi),s=(0,le.isSeatedHighlight)(e.status,{otherDay:rl})&&!t,l=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=se.colours.text,n=s?se.colours.goldLight:se.colours.muted,o=se.colours.gold,a=l.depositWarn?se.colours.amber:se.colours.goldLight;return(0,qe.jsxs)(F.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:rl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,le.seatedHighlightStyle)({backgroundColor:e?Qe:Ye,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,qe.jsx)(Y.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)(U.default,{style:{paddingTop:2},children:(0,qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,qe.jsx)(Y.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,qe.jsx)(Y.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&re.OCCASION_ICON[l.occasion]?(0,qe.jsx)(Y.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:re.OCCASION_ICON[l.occasion]}):null]}),(0,qe.jsxs)(Y.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Y.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}),(0,qe.jsx)(Y.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,qe.jsx)(Y.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(U.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(me.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,qe.jsx)(Y.T,{size:15,colour:se.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),Ji.length?(0,qe.jsxs)(U.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(F.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ji.length}${bs?', expanded':', collapsed'}`,accessibilityState:{expanded:bs},onPress:()=>ys(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Y.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ji.length,")"]}),(0,qe.jsx)(Y.T,{size:16,colour:se.colours.muted,children:bs?'\u25be':'\u25b8'})]}),bs?Ji.map(e=>{const t=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,qe.jsxs)(F.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Y.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Y.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,qe.jsx)(U.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,qe.jsx)(v.BookingUndo,{b:e,rid:mt,today:Ht,who:t.name,allowed:wi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ae.CancellationsSection,{items:Hl,dayWord:rl?cl?dl.toLowerCase():`on ${dl}`:'today'})]}),en=(0,qe.jsx)(V.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Zi}),tn=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&gs(!1)}}),sn=(0,qe.jsxs)(F.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Xi}, ${Qi.length}`,accessibilityState:{expanded:hs},'aria-expanded':hs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>gs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:hs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:hs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Y.T,{size:16,weight:"bold",colour:se.colours.gold,children:Qi.length}),(0,qe.jsx)(U.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(U.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,qe.jsxs)(Y.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Xi," ",hs?'\u2039':'\u203a']})})})]}),ln=Math.min(560,Math.max(320,.44*at))<400,nn=hs?(0,qe.jsxs)(U.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,qe.jsxs)(U.default,{testID:"guests-drawer",...tn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*at)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,...Ne.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,qe.jsxs)(U.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,qe.jsxs)(U.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsxs)(U.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,qe.jsxs)(Y.T,{testID:"guests-heading",size:ln?14:17,weight:"semibold",colour:se.colours.gold,style:{flexShrink:1,minWidth:0},children:[Xi.toUpperCase()," (",Qi.length,")"]}),(0,qe.jsx)(F.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:cs},'aria-expanded':cs,onPress:()=>us(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:ln?8:12,borderRadius:12,borderWidth:1,borderColor:cs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?se.colours.tilePressed:cs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:se.colours.goldLight,children:[ln?'Key':'Guest key'," ",cs?'\u25b4':'\u25be']})})]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Xi}`,onPress:()=>gs(!1),style:{marginRight:-6,flexShrink:0}})]}),zl.count?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Pl}):null,cs?(0,qe.jsxs)(U.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:se.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,qe.jsxs)(U.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:se.colours.amber,ink:se.colours.bg}),(0,qe.jsx)(Y.T,{size:14,children:"allergy"})]}),(0,qe.jsxs)(U.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(me.DogIcon,{size:18}),(0,qe.jsx)(Y.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,qe.jsxs)(U.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(Y.T,{size:16,children:e}),(0,qe.jsx)(Y.T,{size:14,children:t})]},t))]}):null]}),en]}),(0,qe.jsx)(F.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Xi}`,accessibilityRole:"button",onPress:()=>gs(!1),style:{flex:1}})]}):null,on=ml?jl:l.IS_KIRKTON&&!Object.values(jt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(U.default,{testID:"kirkton-hours-to-confirm",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Y.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(jt,It,vt).busy,todays:ul,open:bl,close:yl,now:vt,turnBase:jt.settings.turnMins,blocks:Ml,pauses:fl,compact:ct,dense:!ct,fit:ht,tight:ht&&dt<=600,height:ht?Si:Di,forecastNote:rl?void 0:Ql,emptyText:wl,past:al{Ds.current=Date.now(),ks(!0)},shortDay:!ct&&at<1100}),dn=(0,qe.jsx)(He.DisplayCalendar,{visible:Is,today:Ht,day:al,bookings:It,restaurant:jt,now:vt,onDay:Ss,onClose:()=>ks(!1)}),cn=()=>{rl?gs(!0):Kt(!0)},un=(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',padding:zi?4:dt<820?8:12,paddingTop:zi?ki?2:4:dt<820?ki?4:6:ki?8:10,gap:zi?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:yi,Pt?(0,qe.jsx)(V.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"})}):gi?hi:ui,bi,nn]}),(0,qe.jsxs)(U.default,{testID:"display-side",style:{width:bt,gap:dt<820?4:8,minHeight:0},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Ii(!1)}),(0,qe.jsx)(U.default,{style:{flexShrink:0},children:ji}),Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",onLayout:Ui,style:ki&&!Ni?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:dt<820,snug:dt<820,tight:dt<800,fill:ki&&!Ni,sound:(0,O.flapSoundOn)(),onPress:cn})}),Pt?null:(0,qe.jsx)(U.default,{ref:Ti,testID:"day-graph-slot",onLayout:Ui,style:{flexGrow:0,flexShrink:ki?0:1,flexBasis:(ct?Di:Si)+(ki?Mi:Hi),height:(ct?Di:Si)+(ki?Mi:Hi),minHeight:dt<=600?90:Math.min((ct?Di:Si)+We.DAY_GRAPH_CHROME,!ct&&dt>=768?140+We.DAY_GRAPH_CHROME:120),overflow:'visible'},children:an}),ki&&!Pt?(0,qe.jsx)(U.default,{ref:$i,testID:"display-side-split",onLayout:Ui,style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})}):null,(0,qe.jsxs)(V.default,{testID:"display-side-scroll",style:ki?{flexGrow:0,flexShrink:1,minHeight:Wi&&Oi?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Bi.current&&(Bi.current=s,Li(s),setTimeout(Ui,0))},children:[ki||xi?null:(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),qi,(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt})]})]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Ds.current=Date.now()},onMouseDown:()=>{Ds.current=Date.now()},children:[ct?(0,qe.jsx)(U.default,{style:{flex:1},children:(0,qe.jsxs)(V.default,{ref:yt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,qe.jsxs)(U.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,qe.jsx)(U.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,qe.jsx)(j.ExitButton,{})}),(0,qe.jsx)(X.RestaurantLogo,{rid:mt,size:64}),(0,qe.jsx)(Y.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:jt.name}),(0,qe.jsx)(X.PoweredBy,{}),(0,qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(U.default,{accessible:!0,accessibilityLabel:`Current time ${(0,ee.hm)(vt)}`,children:(0,qe.jsx)(Y.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,ee.hm)(vt)})}),(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:"m"}),(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",size:"m"}),Z]}),Fe,k.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:mt}),rn,(0,qe.jsx)(U.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(it,{phone:!0,split:Ll,items:[{label:`Tables \xb7 ${dl}`,value:Bl.length,testID:'badge-tables'},{label:`Covers \xb7 ${dl}`,value:Wl,testID:'badge-covers'},{label:'Takeaway',value:qs.length,alert:qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ls(!0)}]})}),(0,qe.jsx)(U.default,{testID:"primary-actions",style:{gap:8},children:Ii(!0)}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt}),ji,(0,qe.jsxs)(U.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[gi?hi:ui,bi]}),(0,qe.jsxs)(U.default,{onLayout:e=>{pt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ne.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Y.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Xi," (",Qi.length,")"]}),(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{gap:4},children:Zi})]}),qi,an,(0,qe.jsx)(U.default,{testID:"covers-dock",children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>yt.current?.scrollTo({y:pt.current,animated:!0})})}),(0,qe.jsxs)(U.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,qe.jsx)(Y.T,{center:!0,size:14,colour:Ot?se.colours.muted:se.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Y.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Rs(!0),style:{minHeight:48,alignSelf:'stretch'}}),xi?null:(0,qe.jsx)(Y.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ki]})}):(0,qe.jsxs)(qe.Fragment,{children:[ki?(0,qe.jsx)(U.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:se.colours.hairline},children:(0,qe.jsx)(U.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)(U.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,paddingVertical:zi?2:dt<820?4:8,gap:8,minHeight:zi&&ki?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ne.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(U.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:ki?16:8,minWidth:0,overflow:'hidden',...ki?{justifyContent:'flex-start'}:null},children:[(0,qe.jsx)(U.default,{testID:"display-header-brand",style:ki?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(X.RestaurantBrand,{rid:jt.id,size:at<900?32:40,beside:!0,noLogo:ki})}),(0,qe.jsxs)(U.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Y.T,{size:at<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,ee.hm)(vt)}),at>=900?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:(0,ee.niceDate)(vt)}):null]})]}),Pt?(0,qe.jsx)(U.default,{style:{width:220}}):(0,qe.jsx)(U.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:rn}),(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,qe.jsxs)(U.default,{testID:"display-header-chips",style:{flexDirection:at>=1400||ki?'row':'column',alignItems:at>=1400||ki?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:at<1240?'xs':at<1280||dt<700?'s':'m'}),Pt?null:(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",slot:ki,size:at<1340?'xs':at<1400||dt<700?'s':'m'})]}),'simulated'===St?(0,qe.jsx)(F.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>Dt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,Z,e?null:(0,qe.jsx)(U.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(j.ExitButton,{size:44})})]})]}),Fe,k.IS_CAR||!Pt||ki?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:mt,margin:{marginHorizontal:12,marginTop:6}}),Pt||ki?null:(0,qe.jsx)(U.default,{testID:"display-day-stats",style:Xe,children:(0,qe.jsxs)(U.default,{style:Ze,children:[k.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(U.default,{style:et,children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})})]})}),ht?un:(hn=(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{testID:"front-door-bar",style:{gap:10},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Ii(!1)}),ji]}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt}),Pt?(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"}):(0,qe.jsx)(qe.Fragment,{children:(0,qe.jsxs)(U.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[yi,gi?hi:ui,bi,nn]})]})}),qi,Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,sound:(0,O.flapSoundOn)(),onPress:cn})}),Pt?null:(0,qe.jsx)(U.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Di+We.DAY_GRAPH_CHROME},children:an})]}),(0,qe.jsx)(V.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:hn})),Ki]}),(0,qe.jsx)($.SoldOutStrip,{rid:mt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:zs,onClose:()=>Hs(!1),rid:mt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:mt}),Mt.elements,is?(0,qe.jsx)(y.EditBookingPicker,{rid:mt,today:Ht,who:Lt,onClose:()=>ns(!1)}):null,os?(0,qe.jsx)(y.EditBookingSheet,{rid:mt,id:os,who:Lt,onClose:()=>as(null)}):null,Qt?(0,qe.jsx)(Se.TableSheet,{rid:mt,name:Qt,view:Xs,plan:Nt,todays:Us,now:vt,privacy:Ot,turnBase:jt.settings.turnMins,onClose:()=>Jt(null),onWalkIn:e=>Mt.openWalkInAt(e),onMove:e=>Zt(e),onDetails:Vs}):null,kl?(()=>{const e=Il[kl],t=e?.dayBookings??[];return(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>{$l(null),Dl(null)},title:`${(0,d.tableNumbersA11y)(kl)} \xb7 ${cl?dl:(0,ze.dayLong)(al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Y.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${cl?dl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${cl?dl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Ot):tt(e.name);return(0,qe.jsx)(Y.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,ke.tablesWords)((0,ae.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Dl(null),fs(e.id)},style:{minHeight:56}},e.id)}),al>=Ht?(()=>{const t=e?.table.maxSeats??0,s=It.filter(e=>e.date===al&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,ae.tablesOf)(e.table).includes(kl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,qe.jsxs)(U.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(kl)]}),Rl?(0,qe.jsxs)(U.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Rl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Rl.ask}),(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!wi.ok,accessibilityHint:wi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Rl.id);if($l(null),!e)return;const s=tt(e.name);Dl(null),await(0,Ie.saveTablesReported)(mt,e,[kl],s,t,Os)}}),(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>$l(null)})]})]}):null,Rl?null:s.slice(0,12).map(e=>{const s=tt(e.name),l=e.partySize>t;return(0,qe.jsx)(Y.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:!wi.ok,accessibilityHint:wi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(kl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(Os,{b:e,tables:[kl]}))return;const l=(0,ke.overCapacityAsk)([kl],t,e.partySize);l?$l({id:e.id,ask:l}):(Dl(null),await(0,Ie.saveTablesReported)(mt,e,[kl],s,t,Os))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Y.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{$l(null),Dl(null)},style:{minHeight:56}})]})})():null,ps?(()=>{const e=It.find(e=>e.id===ps);return e?(0,qe.jsx)(je.GuestActionsSheet,{rid:mt,b:e,name:e.walkIn?(0,fe.privName)(e,Ot):tt(e.name),view:Xs,now:vt,otherDay:e.date!==Ht,turnBase:jt.settings.turnMins,onClose:()=>fs(null),onDetails:Vs,onDone:Os,onEdit:e=>{fs(null),as(e.id)},onPickOnPlan:(e,t)=>{gs(!1),Vt('plan'),Yt('all'),ms({id:e.id,tables:t})}}):null})():null,es?(0,qe.jsx)(Se.DetailsPanel,{title:es.title,onClose:()=>ts(null),children:es.body}):null,dn,rs?(0,qe.jsx)(Se.ServiceSummary,{r:jt,todays:Us,orders:wt,waitlistAll:vs,walkInCount:Cs,onClose:()=>ds(!1)}):null,Ts?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Rs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsxs)(U.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:se.colours.amber,ink:se.colours.bg}),(0,qe.jsx)(Y.T,{size:14,children:"allergy"})]}),(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(me.DogIcon,{size:18}),(0,qe.jsx)(Y.T,{size:14,children:"dog"})]}),(0,qe.jsx)(Y.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Rs(!1)})]}):null,Ws?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ls(!1),Bs(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,$s?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(Q.ReviewsSection,{rid:mt,mode:"read",venueName:jt.name}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,ss?(0,qe.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>ls(!1),children:[(0,qe.jsx)(Y.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(ot,{list:qs,me:Lt,bookings:It})]}):null,Es?(0,qe.jsx)(U.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,qe.jsx)(he.PlanDesigner,{initial:Nt,venue:jt.name,mode:"display",startStep:"arrange",onActivity:()=>{_s.current=Date.now(),null!==Gs&&Fs(null)},notice:null!==Gs?`Locking again in ${Gs} s \xb7 touch to keep editing`:null,onSave:e=>{ae.useFloor.getState().setPlan(mt,e),Ns(null),Os('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{ae.useFloor.getState().setPlan(mt,e),Os('Live seating plan updated on every screen.')},onCancel:()=>{Ns(null),Os('No changes kept. Editing is locked again.')}},Es.at)}):null,e?null:(0,qe.jsx)(ye.Screensaver,{rid:mt,idleMins:At.idleMins,pinOn:At.pinOn,wake:At,tonightCards:At.tonightCards,cfg:Et}),e?null:(0,qe.jsx)(Ce.PrintHost,{rid:mt}),e?null:(0,qe.jsx)(ve.AlertHost,{variant:"display",rid:mt,skipTakeaway:!0}),e?null:(0,qe.jsx)(E.SeatAllergenReminder,{rid:mt}),e?null:(0,qe.jsx)(Te.TakeawayTakeover,{rid:mt,me:Lt})]});var hn}function rt({rid:e,id:t,turnBase:s}){const l=(0,te.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1336,[1051,779,805,806,1337,813,1338,1092,843,1138,1339,1340,1341,1089,1120,1342,1343,1348,1349,1206,1350,856,1355,1356,1357,1113,1111,920,1358,1150,891,1102,1359,17,1070,1182,1016,1085,1360,378,363,385,278,85,409,19,777,1237,1241,857,845,863,858,804,1088,876,1096,1055,996,1074,1107,1361,1106,1362,1369,1371,1374,1379,1373,1380,1383,1384,1115,1093,1094,862,1389,1226,1390,1236,1228,993,1395,1400,1401,1052,1050,1117,1403,1404,1405,1069,1169,1406,1168,1159,853,1351,1407,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},1339,[]); @@ -1437,7 +1437,7 @@ __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(t,c){return}},1354,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.displayActionBy=function(t){if(t.isCar)return'Car';if(t.isDisplayApp)return'Display';return(t.personName??'').trim()||'Duty Manager'}},1355,[]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"finishClearPatch",{enumerable:!0,get:function(){return s.finishClearPatch}}),Object.defineProperty(e,"DEFAULT_TURN_MINS",{enumerable:!0,get:function(){return a}}),e.bookingEndAt=u,e.isLeftEarly=o,e.todaysGuestList=function(t,n,s=a){return t.filter(t=>'confirmed'===t.status||'seated'===t.status||o(t,n,s)).sort((t,n)=>t.time.localeCompare(n.time))},e.todaysFinishedList=function(t,n,s=a){return t.filter(t=>'finished'===t.status&&!o(t,n,s)).sort((t,n)=>t.time.localeCompare(n.time))};var t=r(d[0]),n=r(d[1]),s=r(d[2]);const a=90;function u(s,u=a){if(!s.date||!s.time)return null;const o=(0,n.atTime)((0,n.parseYmd)(s.date),s.time),f=u>0?u:a,c=s.durationMins&&s.durationMins>=15?s.durationMins:(0,t.turnFor)(s.partySize??2,f);return new Date(o.getTime()+6e4*c)}function o(t,s,o=a){if('finished'!==t.status||!t.date||!t.time||!t.finishedAt)return!1;const f=(0,n.atTime)((0,n.parseYmd)(t.date),t.time);if(new Date(t.finishedAt).getTime()>=f.getTime())return!1;const c=u(t,o);return!!c&&(s??new Date).getTime()1?'are':'is'} free again`:'',"."]}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${$}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>I(t,e,{stage:void 0,dirty:!1})),j(!1)}}),(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${$} seated`,onPress:()=>j(!1)})]})]}):(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${$}: ${e.walkIn?'removes the walk-in':'back to booked'}${v?`, frees ${v}`:''}`,onPress:()=>j(!0)});const L='undo-finished'===x?'seated':'confirmed';return(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===x?`Undo finished: ${$} back to seated${v?` at ${v}`:''}`:`Undo no-show: ${$} back to booked`,onPress:async()=>{'undo-finished'!==x?await n.repo.bookings.setStatus(e.id,L):await(0,b.undoFinishedNow)(t,e)}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),h=r(d[7]),f=r(d[8]);function k(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1357,[17,85,858,996,777,804,1112,1111,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=k,_e.BookingUndo=function({b:e,rid:t,today:w,who:$,allowed:y=!0}){const[p,j]=(0,s.useState)(!1),x=k(e,w);if(!x||!y)return null;const U=(0,h.tableForUndo)(e),v=(0,l.tableCardLabel)(U),I=l.useFloor.getState().setLive;if('unseat'===x)return p?(0,f.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,f.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",$,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',v?` and ${v} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${$}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>I(t,e,{stage:void 0,dirty:!1})),j(!1)}}),(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${$} seated`,onPress:()=>j(!1)})]})]}):(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${$}: ${e.walkIn?'removes the walk-in':'back to booked'}${v?`, frees ${v}`:''}`,onPress:()=>j(!0)});const L='undo-finished'===x?'seated':'confirmed';return(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===x?`Undo finished: ${$} back to seated${v?` at ${v}`:''}`:`Undo no-show: ${$} back to booked`,onPress:async()=>{'undo-finished'!==x?await n.repo.bookings.setStatus(e.id,L):await(0,b.undoFinishedNow)(t,e)}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),h=r(d[7]),f=r(d[8]);function k(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1357,[17,85,858,996,777,804,1113,1111,8]); __d(function(g,r,i,a,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},1358,[813,812,17,219,385,278,85,777,1150,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])},1359,[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])},1360,[17,85,780,804,8]); @@ -1460,16 +1460,16 @@ __d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?global __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||'')}},1377,[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},1379,[17,831,928,899,1378]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=$,e.guestRowText=function(n,p){const l=n.partySize,b=Math.max(0,Math.min(l-1,Math.round(Number(n.children)||0))),f=`${l} ${1===l?'person':'people'}${b?` (${b} ${1===b?'child':'children'})`:''}`,h=(0,o.tablesOf)(n.table??void 0),c=h.length?`${p.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',w=p.leftEarly?"Left early"+(c?` \xb7 ${c}`:''):p.finished?"Finished"+(c?` \xb7 ${c}`:''):p.seated?"Seated"+(c?` \xb7 ${c}`:''):c||'No table yet',x=$(n),y=h.length?`table${h.length>1?'s':''} ${u(h.map(t.plainTableNumber))}`:p.finished?'finished':'no table yet',D=!!n.dog,m=(0,s.allergyLine)(n),k=(0,d.guestChangeLine)(n),v=[n.time,p.name,m?`allergy noted: ${m}`:'',f,p.leftEarly?'left early':p.finished?'finished':p.seated?'seated':'',x?.spoken??'',y,D?'dog':''].filter(Boolean).join(', ')+'.'+(k?` ${k}`:'');return{time:n.time,name:p.name,people:f,deposit:x?.text??null,depositWarn:!!x?.warn,table:w,dog:D,allergy:m,guestChange:k,a11y:v}};var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),s=r(_d[3]),d=r(_d[4]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,l=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 o=(0,n.depositBadge)(t,p);if(!o)return null;const s=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||d>0&&u>d&&!o.label.startsWith('Deposit paid')){const t=d||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${l(t).replace(' pounds','')} of ${l(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(o.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const $=o.label.match(/\xa3[\d.,]+/);if(o.label.startsWith('Deposit paid')){const t=/about/.test(o.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(o.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(o.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}}},1380,[843,841,996,1381,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}}},1380,[843,841,996,1381,1382]); __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])},1381,[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}},1382,[]); __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])},1383,[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'},1384,[1385,843,1093,996,17,85,777,1096,858,1113,1380,1094,863,1091,1114,1115,1116,804,1340,1387,1388,1112,1357,1111,8]); +__d(function(_g,r,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'},1384,[1385,843,1093,996,17,85,777,1096,858,1114,1380,1094,863,1091,1115,1116,1117,804,1340,1387,1388,1113,1357,1111,8]); __d(function(g,r,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])},1385,[17,362,385,85,858,920,876,994,1386,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')}`}},1386,[]); __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},1389,[1169,1385,813,1093,812,843,1138,1089,1114,863,17,1076,219,385,278,85,777,1096,1373,858,996,845,1087,1074,1318,804,1340,1387,1388,1112,1111,8]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"Card",{enumerable:!0,get:function(){return M}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const l=e.filter(e=>'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},1389,[1169,1385,813,1093,812,843,1138,1089,1115,863,17,1076,219,385,278,85,777,1096,1373,858,996,845,1087,1074,1318,804,1340,1387,1388,1113,1111,8]); __d(function(g,_r,_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.']}]},1390,[812,17,219,385,85,777,858,996,1391,804,1392,1394,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))},1391,[]); __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)}},1392,[831,858,996,1391,1393,1394]); @@ -1511,7 +1511,7 @@ __d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModu __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1428,[]); __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}},1429,[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]},1430,[17,85,777,804,914,1020,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])},1431,[805,1428,1093,1266,1432,812,822,1114,1115,1089,1119,1433,1120,1116,1403,1404,1055,1340,994,1117,1087,841,1382,1123,1435,1237,1436,1395,1076,1053,1088,17,85,777,1360,858,845,851,863,1318,804,1181,1096,1112,996,1357,1060,1159,1437,1228,899,1183,1400,862,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1431,[805,1428,1093,1266,1432,812,822,1115,1116,1089,1120,1433,1112,1117,1403,1404,1055,1340,994,1118,1087,841,1382,1123,1435,1237,1436,1395,1076,1053,1088,17,85,777,1360,858,845,851,863,1318,804,1181,1096,1113,996,1357,1060,1159,1437,1228,899,1183,1400,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])},1432,[806,17,85,777,899,1270,8]); __d(function(g,r,_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])},1433,[17,385,85,1434,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},1434,[]); @@ -1534,7 +1534,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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])},1451,[17,278,85,777,857,804,1452,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(' ')},1452,[]); __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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]})}},1453,[888,813,17,1067,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])},1454,[1182,1070,1114,1087,17,385,85,777,876,863,804,1088,1168,1165,1055,1117,1179,1442,1159,860,1183,853,1181,884,1357,996,843,1112,1196,1203,1069,8]); +__d(function(g,_r,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])},1454,[1182,1070,1115,1087,17,385,85,777,876,863,804,1088,1168,1165,1055,1118,1179,1442,1159,860,1183,853,1181,884,1357,996,843,1113,1196,1203,1069,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]})}},1455,[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(()=>{})},1456,[1457,899,778,1409,1459,993,13,1486,479,17,368,319,219,24,85,805,857,1063,856,1488,19,858,996,876,804,1449,920,986,1491,1492,1026,1102,880,1006,914,1493,1379,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.'}},1457,[880,812,17,219,366,85,777,1458,899,804,1185,920,876,909,8]); diff --git a/chef-app/admin.html b/chef-app/admin.html index 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 b3cc9a10db24b099ffe25aad14f59a02422bad1b..95bbb173b98e3adfd3c5f38f9fba0c4f18849dda 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 7e7a1c3441956e3684df0e3d0c65616e18275357..df0287a6c125008d1e16e98570362b9a96ad9454 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-8ec0de41c5"; +const V = "cc-chef-aec0a5953d"; 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=8ec0de41c5709f26ac2cfb06c24113f79f35c73b941f2dce6cb89866efaf503f"]; +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=aec0a5953dc23da42c4491bd8794fa9236303862299ea1231d446914f2161923"]; // 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 824f4382eedd8667da0d905f8ba21b1dc2f78a98..d4c41ed01651100e1d66d77cb62dfde435147315 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 64482fd9e5498e9f1e9ffd478310e3137ce05061..3fe419a6292aebcd98736f3ce16e4e530bef26b7 100644 --- a/customer-app/_expo/static/js/web/bundle.js +++ b/customer-app/_expo/static/js/web/bundle.js @@ -1058,7 +1058,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.205'},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.206'},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 c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},979,[980,981,928,972,976]); __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]); @@ -1166,17 +1166,17 @@ __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,"useChatOpen",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)()(t=>({request:n=>t({ch:n})}))},1083,[831]); __d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},1084,[912,17,1010,876,816,913,927,1066,916,1065]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:u}){const h=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const f=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==u||'seated'!==s.status||s.date!==(0,c.venueYmd)(new Date)||!(0,l.hasAllergens)(s)||h.current.has(s.id))continue;const n=f.get(s.id);n&&'seated'!==n&&(h.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} Covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[u]),null},e.useKitchenTodoChime=function(t,c,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=c&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,u.soundAllowed)()&&(0,u.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} Covers \xb7 ${t.date===c?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6])},1085,[843,17,916,858,1053,863,1016]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:s,today:o,by:S,app:j}){const $=(0,n.useBookings)(s).filter(e=>e.date===o&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),w=$.reduce((e,t)=>e+(t.diet?.vegan??0),0),T=$.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,x.jsxs)(a.default,{style:{gap:12},testID:"todays-bookings",children:[(0,x.jsx)(p.CoversToday,{rid:s}),(0,x.jsx)(b.PlattersBooked,{rid:s,date:o,label:"Platters booked today"}),w||T?(0,x.jsxs)(l.T,{colour:h.colours.ok,children:["\u24cb ",w?`${w} vegan`:'',w&&T?' \xb7 ':'',T?`${T} vegetarian`:''," today"]}):null,(0,x.jsx)(b.KitchenSignoffs,{rid:s,today:o,by:S,app:j,showAll:!0}),$.length?$.map(o=>(0,x.jsxs)(a.default,{testID:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?`kitchen-seated-${o.id}`:`kitchen-booking-${o.id}`,style:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?{gap:6,padding:14,borderRadius:16,...(0,c.seatedHighlightStyle)()}:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface,opacity:'finished'===o.status?.55:1},children:[(0,x.jsxs)(l.T,{weight:"semibold",colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,accessibilityLabel:`${o.time}, ${o.walkIn?`Walk-in ${o.ref}`:o.name}, ${o.partySize} Covers${o.table?`, ${(0,e.tableNumbersA11y)(o.table)}`:''}`,children:[o.time," \xb7 ",o.walkIn?`Walk-in ${o.ref}`:o.name," \xb7 ",o.partySize," Covers",o.table?` \xb7 ${(0,e.tableNumbers)(o.table)}`:'']}),(0,x.jsx)(t.DepositChip,{b:o,money:!0,testID:`kitchen-deposit-${o.id}`}),(0,x.jsx)(k.BookingTableButton,{rid:s,booking:o,readOnly:'chef'===j}),'chef'!==j&&o.walkIn?(0,x.jsx)(y.CancelWalkInButton,{rid:s,b:o,small:!0}):null,o.notes?(0,x.jsxs)(l.T,{size:16,colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,testID:`kitchen-notes-${o.id}`,children:["Notes: ",o.notes]}):null,(0,x.jsx)(f.BookingEditButton,{rid:s,booking:o,who:S,inStaffApp:'staff'===j}),(0,x.jsx)(b.BookingNeeds,{b:o}),'seated'===(0,u.shownStatus)(o)?(0,x.jsx)(l.T,{weight:"semibold",colour:c.SEATED_FG,children:"Seated"}):'finished'===o.status?(0,x.jsx)(l.Muted,{children:"Finished"}):null]},o.id)):(0,x.jsx)(l.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var s,o=r(d[3]),a=(s=o)&&s.__esModule?s:{default:s},l=r(d[4]),n=r(d[5]),u=r(d[6]),h=r(d[7]),c=r(d[8]),b=r(d[9]),k=r(d[10]),y=r(d[11]),f=r(d[12]),p=r(d[13]),x=r(d[14])},1086,[843,1087,17,85,777,858,1053,804,1088,1076,1089,1114,1119,1070,8]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:s,today:o,by:S,app:j}){const $=(0,n.useBookings)(s).filter(e=>e.date===o&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),w=$.reduce((e,t)=>e+(t.diet?.vegan??0),0),T=$.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,x.jsxs)(a.default,{style:{gap:12},testID:"todays-bookings",children:[(0,x.jsx)(p.CoversToday,{rid:s}),(0,x.jsx)(b.PlattersBooked,{rid:s,date:o,label:"Platters booked today"}),w||T?(0,x.jsxs)(l.T,{colour:h.colours.ok,children:["\u24cb ",w?`${w} vegan`:'',w&&T?' \xb7 ':'',T?`${T} vegetarian`:''," today"]}):null,(0,x.jsx)(b.KitchenSignoffs,{rid:s,today:o,by:S,app:j,showAll:!0}),$.length?$.map(o=>(0,x.jsxs)(a.default,{testID:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?`kitchen-seated-${o.id}`:`kitchen-booking-${o.id}`,style:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?{gap:6,padding:14,borderRadius:16,...(0,c.seatedHighlightStyle)()}:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface,opacity:'finished'===o.status?.55:1},children:[(0,x.jsxs)(l.T,{weight:"semibold",colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,accessibilityLabel:`${o.time}, ${o.walkIn?`Walk-in ${o.ref}`:o.name}, ${o.partySize} Covers${o.table?`, ${(0,e.tableNumbersA11y)(o.table)}`:''}`,children:[o.time," \xb7 ",o.walkIn?`Walk-in ${o.ref}`:o.name," \xb7 ",o.partySize," Covers",o.table?` \xb7 ${(0,e.tableNumbers)(o.table)}`:'']}),(0,x.jsx)(t.DepositChip,{b:o,money:!0,testID:`kitchen-deposit-${o.id}`}),(0,x.jsx)(k.BookingTableButton,{rid:s,booking:o,readOnly:'chef'===j}),'chef'!==j&&o.walkIn?(0,x.jsx)(y.CancelWalkInButton,{rid:s,b:o,small:!0}):null,o.notes?(0,x.jsxs)(l.T,{size:16,colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,testID:`kitchen-notes-${o.id}`,children:["Notes: ",o.notes]}):null,(0,x.jsx)(f.BookingEditButton,{rid:s,booking:o,who:S,inStaffApp:'staff'===j}),(0,x.jsx)(b.BookingNeeds,{b:o}),'seated'===(0,u.shownStatus)(o)?(0,x.jsx)(l.T,{weight:"semibold",colour:c.SEATED_FG,children:"Seated"}):'finished'===o.status?(0,x.jsx)(l.Muted,{children:"Finished"}):null]},o.id)):(0,x.jsx)(l.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var s,o=r(d[3]),a=(s=o)&&s.__esModule?s:{default:s},l=r(d[4]),n=r(d[5]),u=r(d[6]),h=r(d[7]),c=r(d[8]),b=r(d[9]),k=r(d[10]),y=r(d[11]),f=r(d[12]),p=r(d[13]),x=r(d[14])},1086,[843,1087,17,85,777,858,1053,804,1088,1076,1089,1115,1120,1070,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DepositChip=function({b:e,money:o,big:n,testID:b}){const f=(0,s.depositView)(e,o);if(!f)return null;const h={gold:[t.colours.goldTint,t.colours.goldLight,t.colours.gold],amber:[t.colours.amberBg,'#FFE2A8',t.colours.amber],red:[t.colours.redBg,'#FFD9D4',t.colours.red],neutral:[t.colours.surface2,t.colours.muted,t.colours.border]}[f.kind];return(0,u.jsxs)(l.default,{accessible:!0,accessibilityRole:"text",accessibilityLabel:f.a11y,testID:b??'deposit-chip',style:{alignSelf:'flex-start',maxWidth:'100%'},children:[(0,u.jsx)(l.default,{style:{backgroundColor:h[0],borderColor:h[2],borderWidth:n?2:1,borderRadius:8,paddingHorizontal:n?12:8,paddingVertical:n?6:3},children:(0,u.jsx)(c.T,{size:16,weight:"semibold",colour:h[1],children:f.label})}),f.note?(0,u.jsx)(c.Muted,{size:12,children:f.note}):null]})},r(d[0]);var e,o=r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),c=r(d[4]),u=r(d[5])},1087,[17,85,841,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEATED_BG",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SEATED_FG",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEATED_MUTED",{enumerable:!0,get:function(){return u}}),e.isSeatedHighlight=function(t,o){return'seated'===t&&!o?.otherDay},e.seatedHighlightStyle=function(u){return{backgroundColor:o,borderColor:t.colours.goldLight,borderWidth:1.5,borderLeftWidth:8,borderLeftColor:n,...u}};var t=r(d[0]);const o=t.colours.gold,n=t.colours.onGold,u='#3F3218'},1088,[804]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f,canClear:h=!0}){const[j,k]=(0,t.useState)(!1),x=(0,s.tableButtonLabel)(l.table),_=f??`table-btn-${l.id}`;if(y)return(0,b.jsx)(n.default,{testID:_,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,b.jsx)(u.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:x})});return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u.Button,{kind:"secondary",label:x,testID:_,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>k(!0),style:{minHeight:44}}),j?(0,b.jsx)(c.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>k(!1),canClear:h}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6])},1089,[17,85,1090,804,1091,777,8]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const u={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(u)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(u,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}}),e.splitChoices=function(t){const n=String(t??'').split('+').map(t=>t.trim()).filter(Boolean);return n.length>1?[...new Set(n)]:[]};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1090,[843,1074]); -__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,t,s){const l=(0,p.tableKey)(s);if('finished'===t.status&&l)return void await(0,j.restoreFinishedToTable)(e,t,s);const o=(0,g.tablesOf)(t.table);await h.repo.bookings.update(t.id,(0,y.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(t=>g.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,m.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:m=90,onClose:T,onSaved:S,onPickOnPlan:L,canClear:P=!0}){const W=(0,g.usePlan)(e),z=(0,h.useBookings)(e),[D,I]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),R=(0,l.useMemo)(()=>(0,p.pickGroups)(W),[W]),B=z.filter(e=>e.date===y.date),O=(0,p.seatsOf)(W,D),N=(0,p.seatLine)(O.total,y.partySize),F=(0,p.pickClashes)(y,D,B,m),M=e=>(0,p.pickClashes)(y,[e],B,m)[0]?.with,Y=(0,p.tableKey)(D)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,C.useBlocks)(e=>e.blocks),A=(0,C.blockAt)(_,e,y.date,y.time),[G,K]=(0,l.useState)(null),E=e=>{K(null),I(t=>(0,p.toggleTable)(t,e))},[H]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{H&&(0,c.announce)(`Tables can't be saved: ${H}.`)},[H]);const[U,V]=(0,l.useState)(!1),[q,J]=(0,l.useState)(!1),Q=async t=>{(0,o.guardBookingChange)(S,{b:y,tables:t})?(V(!0),T(),await(0,o.saveTablesReported)(e,y,t,f,(0,p.seatsOf)(W,t).total,e=>S?.(e))):T()},X=(0,w.jsxs)(u.default,{style:{gap:8},children:[(0,w.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(D)} picked. ${N.text}.`,children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(D)}),(0,w.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:N.text})]}),A?(0,w.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,w.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,F.length?(0,w.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(F)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,w.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(F)," You can still save."]})}):null,q?(0,w.jsx)(j.RestoreSeatedConfirm,{prompt:(0,v.restoreSeatedPrompt)(f,(0,p.tableKey)(D)),onYes:()=>{J(!1),Q(D)},onNo:()=>J(!1)}):null,G?(0,w.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:G,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,w.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:G}),(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(D)} for ${f}, ${y.partySize} people`,disabled:U,onPress:()=>{Q(D)},style:[$,{flexGrow:1}]}),(0,w.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>K(null),style:$})]})]}):null,(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[G?null:(0,w.jsx)(x.Button,{testID:"table-pick-save",label:U?'Saving\u2026':F.length?'Save anyway':'Save tables',disabled:!Y||!D.length||U,accessibilityLabel:`${F.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(D)} for ${f}. ${N.text}.${F.length?` ${(0,p.clashWords)(F)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(S,{b:y,tables:D}))return void T();const e=(0,p.overCapacityAsk)(D,O.total,y.partySize);!e||G?'finished'!==y.status||!D.length||q?Q(D):J(!0):K(e)},style:[$,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&P?(0,w.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:U,onPress:()=>Q([]),style:$}):null,(0,w.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:T,style:$})]})]});return(0,w.jsxs)(x.Sheet,{visible:!0,onClose:T,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:X,children:[(0,w.jsx)(t.TableNumberWarning,{plan:W}),H?(0,w.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${H}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,w.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${H}.`})}):null,(0,w.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),L?(0,w.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>L(D),style:$}):null,R.map(e=>(0,w.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,w.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,w.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=D.includes(e.name),l=M(e.name);return(0,w.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,t,l),onPress:()=>E(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",colour:t?k.colours.onGold:k.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,w.jsxs)(x.T,{size:14,colour:t?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),R.length?null:(0,w.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),m=r(d[15]),j=r(d[16]),v=r(d[17]),C=r(d[18]),w=r(d[19]);const $={minHeight:56}},1091,[1092,843,17,1093,899,1095,385,85,858,996,1090,1094,804,863,777,1096,1112,1111,993,8]); +__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,t,s){const l=(0,p.tableKey)(s);if('finished'===t.status&&l)return void await(0,j.restoreFinishedToTable)(e,t,s);const o=(0,g.tablesOf)(t.table);await h.repo.bookings.update(t.id,(0,y.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(t=>g.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,m.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:m=90,onClose:T,onSaved:S,onPickOnPlan:L,canClear:P=!0}){const W=(0,g.usePlan)(e),z=(0,h.useBookings)(e),[D,I]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),R=(0,l.useMemo)(()=>(0,p.pickGroups)(W),[W]),B=z.filter(e=>e.date===y.date),O=(0,p.seatsOf)(W,D),N=(0,p.seatLine)(O.total,y.partySize),F=(0,p.pickClashes)(y,D,B,m),M=e=>(0,p.pickClashes)(y,[e],B,m)[0]?.with,Y=(0,p.tableKey)(D)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,C.useBlocks)(e=>e.blocks),A=(0,C.blockAt)(_,e,y.date,y.time),[G,K]=(0,l.useState)(null),E=e=>{K(null),I(t=>(0,p.toggleTable)(t,e))},[H]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{H&&(0,c.announce)(`Tables can't be saved: ${H}.`)},[H]);const[U,V]=(0,l.useState)(!1),[q,J]=(0,l.useState)(!1),Q=async t=>{(0,o.guardBookingChange)(S,{b:y,tables:t})?(V(!0),T(),await(0,o.saveTablesReported)(e,y,t,f,(0,p.seatsOf)(W,t).total,e=>S?.(e))):T()},X=(0,w.jsxs)(u.default,{style:{gap:8},children:[(0,w.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(D)} picked. ${N.text}.`,children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(D)}),(0,w.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:N.text})]}),A?(0,w.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,w.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,F.length?(0,w.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(F)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,w.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(F)," You can still save."]})}):null,q?(0,w.jsx)(j.RestoreSeatedConfirm,{prompt:(0,v.restoreSeatedPrompt)(f,(0,p.tableKey)(D)),onYes:()=>{J(!1),Q(D)},onNo:()=>J(!1)}):null,G?(0,w.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:G,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,w.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:G}),(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(D)} for ${f}, ${y.partySize} people`,disabled:U,onPress:()=>{Q(D)},style:[$,{flexGrow:1}]}),(0,w.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>K(null),style:$})]})]}):null,(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[G?null:(0,w.jsx)(x.Button,{testID:"table-pick-save",label:U?'Saving\u2026':F.length?'Save anyway':'Save tables',disabled:!Y||!D.length||U,accessibilityLabel:`${F.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(D)} for ${f}. ${N.text}.${F.length?` ${(0,p.clashWords)(F)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(S,{b:y,tables:D}))return void T();const e=(0,p.overCapacityAsk)(D,O.total,y.partySize);!e||G?'finished'!==y.status||!D.length||q?Q(D):J(!0):K(e)},style:[$,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&P?(0,w.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:U,onPress:()=>Q([]),style:$}):null,(0,w.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:T,style:$})]})]});return(0,w.jsxs)(x.Sheet,{visible:!0,onClose:T,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:X,children:[(0,w.jsx)(t.TableNumberWarning,{plan:W}),H?(0,w.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${H}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,w.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${H}.`})}):null,(0,w.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),L?(0,w.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>L(D),style:$}):null,R.map(e=>(0,w.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,w.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,w.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=D.includes(e.name),l=M(e.name);return(0,w.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,t,l),onPress:()=>E(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",colour:t?k.colours.onGold:k.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,w.jsxs)(x.T,{size:14,colour:t?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),R.length?null:(0,w.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),m=r(d[15]),j=r(d[16]),v=r(d[17]),C=r(d[18]),w=r(d[19]);const $={minHeight:56}},1091,[1092,843,17,1093,899,1095,385,85,858,996,1090,1094,804,863,777,1096,1113,1111,993,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},1092,[17,842,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.guardBookingChange=w,_e.saveTablesReported=async function(e,t,n,o,s,u){if(!w(u,{b:t,tables:n}))return!1;const v=n.length?(0,h.notSavedWhat)({...t,name:o,table:n.join('+')}):`Taking the table off ${o}`;u(`Saving ${v}\u2026`);try{await(0,b.saveBookingTables)(e,t,n)}catch(e){const t=`${v} did not save: ${String(e?.message??e).slice(0,120)}`;return u(t),(0,l.announce)(t),!1}const y=await(0,c.waitForBookingSave)(t.id);if('saved'===y.state||'local'===y.state){const e=(0,r.savedWords)(o,t.partySize,n,s);return u(e),(0,l.announce)(e),!0}const k='waiting'===y.state?`${v}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${v} did not save. ${f("why"in y?y.why:"the shared system did not take it")}. Tap the red banner to try again.`;return u(k),(0,l.announce)(k),!1},_e.reportBookingSave=async function(e,t,n,o){const s=await(0,c.waitForBookingSave)(e);if('saved'===s.state||'local'===s.state)return o(t),(0,l.announce)(t),!0;const r='waiting'===s.state?`${n}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${n} did not save. ${f('why'in s?s.why:'the shared system did not take it')}. Tap the red banner to try again.`;return o(r),(0,l.announce)(r),!1},_e.BookingSaveBanner=function({rid:e,testID:r="booking-save-banner",margin:c}){const b=(0,h.useBookingSaves)(e=>e.notSaved),w=(0,s.useBookings)(e).filter(e=>b[e.id]).map(e=>void 0!==b[e.id].want?{...e,table:b[e.id].want||void 0}:e),{msg:S,retry:$}=k(),m=(0,t.useRef)(''),p=w.map(e=>(0,h.notSavedLine)(e)),B=w.map(e=>e.id).sort().join(',');if((0,t.useEffect)(()=>{B&&B!==m.current&&(0,l.announce)(1===w.length?p[0]:`${w.length} booking changes did not save. Tap the red banner to try again.`),m.current=B},[B]),!w.length)return null;const j=1===w.length?p[0]:`${w.length} booking changes did not save. Tap to try again.`;return(0,y.jsx)(n.default,{testID:r,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${j}${w.length>1?` ${w.map(e=>(0,h.notSavedWhat)(e)).join('. ')}.`:''} ${f(b[w[0].id].why)}.`,onPress:$,style:{...c??{},alignSelf:'stretch',gap:4,padding:12,borderRadius:12,borderWidth:2,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:(0,y.jsxs)(o.default,{accessibilityRole:"alert",style:{alignItems:'center',gap:4},children:[(0,y.jsx)(v.T,{testID:`${r}-title`,size:17,weight:"semibold",center:!0,colour:"#FFD2CC",children:j}),w.length>1?w.slice(0,6).map(e=>(0,y.jsx)(v.T,{testID:`${r}-line`,size:15,center:!0,colour:"#FFD2CC",children:(0,h.notSavedWhat)(e)},e.id)):null,(0,y.jsx)(v.T,{testID:`${r}-why`,size:14,center:!0,colour:"#FFB3AA",children:w.length>1?`${f(b[w[0].id].why)}${w.length>6?` \xb7 and ${w.length-6} more`:''}`:f(b[w[0].id].why)}),S?(0,y.jsx)(v.T,{testID:`${r}-msg`,size:14,center:!0,colour:u.colours.goldLight,children:S}):null]})})},_e.BookingNotSavedLine=function({b:e}){const t=(0,h.useBookingSaves)(t=>t.notSaved[e.id]),{msg:o,retry:s}=k();if(!t)return null;void 0!==t.want&&(e={...e,table:t.want||void 0});return(0,y.jsxs)(n.default,{testID:`booking-not-saved-${e.id}`,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${(0,h.notSavedLine)(e)} ${f(t.why)}.`,onPress:s,style:{alignSelf:'stretch',padding:8,borderRadius:10,borderWidth:1.5,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:[(0,y.jsx)(v.T,{size:15,weight:"semibold",center:!0,colour:"#FFD2CC",children:(0,h.notSavedLine)(e)}),o?(0,y.jsx)(v.T,{size:13,center:!0,colour:u.colours.goldLight,children:o}):null]})};var t=_r(d[0]),n=e(_r(d[1])),o=e(_r(d[2])),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),b=_r(d[9]),v=_r(d[10]),y=_r(d[11]);const f=e=>e.charAt(0).toUpperCase()+e.slice(1);function w(e,t){const n=(0,c.bookingSaveBlocker)();if(!n)return!0;t&&h.useBookingSaves.getState().mark({id:t.b.id,table:t.b.walkIn?'walk_ins':'bookings',why:n,...t.tables?{want:t.tables.join('+')}:{}});const o=`${t?(0,h.notSavedWhat)({...t.b,...t.tables?{table:t.tables.join('+')||void 0}:{}}):'This change'} did not save: ${n}.`;return e?.(o),(0,l.announce)(o),!1}function k(){const[e,n]=(0,t.useState)('');return{msg:e,retry:async()=>{n('Saving\u2026'),(0,l.announce)('Saving');const e=await(0,c.saveBookingsNow)(!0),t=e?`Not saved: ${e}.`:h.useBookingSaves.getState().count()?'Sent again. The banner clears when the shared system takes it.':'Nothing is left waiting. Check the plan and make the change again if it is not there.';n(t),(0,l.announce)(t)}}}},1093,[17,385,85,858,1094,1095,899,983,804,1091,777,8]); __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=u,e.requestedFreeTable=function(t,n,a,s,l=90){const o={id:n.id??'new',status:'confirmed',...n};for(const n of t)if(a.includes(n)&&!u(o,[n],s,l).length)return n;return null},e.overCapacityAsk=function(n,s,l){const u=a(o(n));if(!u.length||s>=l)return null;const c=u.map(n=>(0,t.tableNumbers)(n));return`${1===c.length?`Table ${c[0]} seats`:`Tables ${c.slice(0,-1).join(', ')} and ${c[c.length-1]} seat`} ${s} \u2013 this booking is ${l}. Use it anyway?`},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=c,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${c(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${c(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${c(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))}function c(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1094,[843,1074]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.primeAnnouncer=function(){u()},_e.announce=function(t){const e=String(t??'').trim();if(!e)return;{const t=u();if(!t)return;const n=++o;return t.textContent='',void setTimeout(()=>{n===o&&(t.textContent=e)},80)}},Object.defineProperty(_e,"lastAnnounced",{enumerable:!0,get:function(){return c}});var t,e=r(d[0]);(t=e)&&t.__esModule;r(d[1]);let n=null,o=0;function u(){if('undefined'==typeof document||!document.body)return null;if(n&&document.body.contains(n))return n;const t=document.createElement('div');return t.id='cc-announcer',t.setAttribute('aria-live','assertive'),t.setAttribute('aria-atomic','true'),t.setAttribute('role','status'),t.setAttribute('data-testid','cc-announcer'),Object.assign(t.style,{position:'absolute',width:'1px',height:'1px',margin:'-1px',padding:'0',overflow:'hidden',clip:'rect(0 0 0 0)',whiteSpace:'nowrap',border:'0'}),document.body.appendChild(t),n=t,t}const c=()=>n?.textContent??''},1095,[264,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,"TABLES",{enumerable:!0,get:function(){return A}}),_e.useTableNames=R,_e.resetTableLive=W,_e.seatBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'seated'),W(e,t.table)},_e.finishBookingNow=async function(e,t){const s=(new Date).toISOString();await k.repo.bookings.update(t.id,(0,N.finishClearPatch)(s,t.table)),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=E,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return _}}),_e.TablePicker=H,_e.WalkInSheet=q,_e.AssignTableSheet=G,_e.undoNotice=Y,_e.NewBookingSheet=V,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[n,i]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>i({b:e}),combineTables:e=>i({b:e,combine:!0}),elements:(0,L.jsxs)(L.Fragment,{children:[s?(0,L.jsx)(q,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,L.jsx)(V,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,L.jsx)(G,{booking:n.b,combine:n.combine,onClose:()=>i(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),z=_r(_d[29]),B=_r(_d[30]),M=_r(_d[31]),N=_r(_d[32]),L=_r(_d[33]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),A=Array.from({length:12},(e,t)=>String(t+1));function R(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function W(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function E(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=R(e),a=(0,v.useFloor)(t=>t.live[e])??{},n=(0,v.usePlan)(e),i=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(i,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const _=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function H({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=n?6:8,f=n?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(i??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,L.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],i=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!i,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,L.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:i?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,L.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,L.jsx)(C.T,{weight:"bold",size:22,colour:i?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,L.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,L.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,L.jsx)(C.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const U=[1,2,3,4,5,6,7,8];function q({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:r,r:d,now:u}=(0,y.useCtx)(15e3),x=E(r,u),[T,I]=(0,c.useState)(2),[P,$]=(0,c.useState)(!1),[O,z]=(0,c.useState)(i??null),B=(0,v.usePlan)(r),N=(0,k.useBookings)(r),A=(0,D.useBlocks)(e=>e.blocks),R=(0,D.closedAreasAt)(A,r,(0,w.ymd)(u),(0,w.hm)(u)),_=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(x).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(B,N.filter(e=>e.date===(0,w.ymd)(u)),e,T,u,(0,j.turnFor)(T,d.settings.turnMins),90,void 0,{closed:R})?.table??null},[B,N,x,T,R.size,u.getTime()]);(0,c.useEffect)(()=>{O&&(0,v.tablesOf)(O).some(e=>'Closed'===x[e]?.label)&&z(null)},[O,R.size]);const[q,G]=(0,c.useState)(!1),[Y,V]=(0,c.useState)(''),K=(e,t=String(e),s=()=>{$(!1),I(e)})=>{const o='9+'===t?P:!P&&T===e;return(0,L.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,L.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},Q=(0,L.jsx)(s.PartySizeInput,{value:T,onChange:I,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),X=(0,L.jsxs)(m.default,{style:{gap:8,width:n?256:void 0},children:[(0,L.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,L.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[U.map(e=>K(e)),K(9,'9+',()=>{$(!0),I(e=>e>=9?e:9)})]}),P?Q:null]}),[J,Z]=(0,c.useState)(!1),ee=async(t=O)=>{if(!J&&(0,M.guardBookingChange)(F)){Z(!0);try{const s=await k.repo.bookings.seatWalkIn(r,T,t??void 0,Y);W(r,t??void 0),a(s),e()}finally{Z(!1)}}},te=(0,L.jsxs)(m.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,L.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,L.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),O?(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>z(null)}):null]}),(0,L.jsx)(H,{use:x,value:O,onPick:e=>{x[e]&&!x[e].busy?ee(e):z(O===e?null:e)},big:n,dense:n,best:_,bestSet:(0,h.bestTables)(B)}),(0,L.jsxs)(C.Muted,{children:["Tap a free table to seat them there",_&&!O?` (suggested for ${T}: ${(0,l.tableNumbers)(_)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(u)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,L.jsx)(C.Button,{label:`Seat walk-in \xb7 ${T} ${1===T?'person':'people'}${O?` \xb7 ${(0,l.tableNumbers)(O)}`:''}`,disabled:J,onPress:()=>{ee()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,L.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[X,te]}):(0,L.jsxs)(L.Fragment,{children:[X,te]}),(0,L.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[q?(0,L.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:Y,onChangeText:V,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,L.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,L.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function G({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,y.useCtx)(15e3),i=E(o,n),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(n)),t,e.partySize,n,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,n.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),P=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,$=D.reduce((e,t)=>e+P(t),0),O=D.length>0&&${if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&W(o,l),t()},B=x?(0,L.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,L.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,L.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${$} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,L.jsx)(m.default,{testID:"combine-short",children:(0,L.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-$," more needed. Add another table."]})}):null,(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,L.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,L.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,L.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,L.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${_(e)}`,testID:"assign-table-sheet",footer:B,children:[f&&!x?(0,L.jsx)(m.default,{testID:"assign-suggested",children:(0,L.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,L.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,L.jsx)(H,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function Y(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${_(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function V({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:N}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const A=(0,w.ymd)(p),[R,W]=(0,c.useState)(ee.blocks),[H,U]=(0,c.useState)(!1),[q,G]=(0,c.useState)(''),[Y,V]=(0,c.useState)(2),[K,Q]=(0,c.useState)(0),X=Math.min(K,Math.max(0,Y-1)),[J,Z]=(0,c.useState)(null),[ee,te]=(0,c.useState)(''),[se,oe]=(0,c.useState)(''),[le,ae]=(0,c.useState)(''),[ne,ie]=(0,c.useState)(!1),[re,de]=(0,c.useState)('phone'),[ue,ce]=(0,c.useState)((0,P.emptyNeeds)()),be=(0,P.needsMissing)(ue),[ge,he]=(0,c.useState)(null),pe=(0,v.usePlan)(b),me=(0,O.dogSetUp)(pe),fe=!0===ue.dog&&me,ye=ue.dog?ue.dogs:0,ke=(0,w.parseYmd)(R),xe=(0,j.turnFor)(Y,h.settings.turnMins),je=E.filter(e=>e.date===R),we=e=>(0,j.dogTablesAt)(pe,je,Y,(0,j.slotStart)(R,e),xe,h.settings.turnMins,(0,D.closedAreasAt)(_,b,R,e)),Se=fe&&J?we(J):[];(0,c.useEffect)(()=>{he(null)},[fe,J,Y]);const Te=(0,x.bookingSlots)(h,ke,e=>E.filter(t=>t.date===R&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Y,R===(0,w.ymd)(p)?p:(0,w.addMins)(ke,0),e=>E.filter(t=>t.date===R&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),Ce=(0,T.guestPhone)(se),[ve,De]=(0,c.useState)(!1),Ie=J?Te.find(e=>e.time===J):void 0,Pe=Ie&&Ie.left=2&&!!J&&(!Oe||ve)&&(0,o.validParty)(Y)&&Ce.ok&&(0,T.emailOk)(le)&&(!ze||Be&&H)&&(!fe||Se.length>0)&&!Me,Le=ue.wheelchair>0||ue.stepFree,Fe=(0,$.bookingRulesOf)(h),Ae=(0,$.largeGroupTables)(Fe,Y),Re=(0,$.dogPartyCheck)(Fe,Y,!0===ue.dog,ue.assistDog),We=(0,$.bookingDepositSplit)((0,n.depositOf)(h.settings),Y,X,(0,P.needsPatch)(ue),(0,O.reservablesOf)(h));return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(ke)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,L.jsx)(P.FirstQuestions,{rid:b,value:ue,onChange:ce,party:Y,audience:"staff"}),ue.dog&&!me?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,L.jsx)(I.BookingDatePicker,{r:h,today:p,value:R,onChange:e=>{e!==R&&(W(e),Z(null),U(!1))}}),(0,L.jsxs)(C.Row,{gap:6,children:[(0,L.jsx)(C.Chip,{label:"Phone",selected:'phone'===re,onPress:()=>de('phone')}),(0,L.jsx)(C.Chip,{label:"In person",selected:'in-person'===re,onPress:()=>de('in-person')})]}),(0,L.jsx)(C.Field,{label:"Name",value:q,onChangeText:G,placeholder:"e.g. Reid",testID:"nb-name"}),(0,L.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:se,onChangeText:oe,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!Ce.ok&&se?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:Ce.error}):null,(0,L.jsx)(C.Field,{label:"Email (optional)",value:le,onChangeText:ae,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email",testID:"nb-email"}),(0,T.emailOk)(le)?null:(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),le.trim()&&Fe.marketingOptIn?(0,L.jsx)(C.Toggle,{label:Fe.marketingWords,value:ne,onChange:ie,testID:"nb-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,L.jsx)(i.AdultsChildren,{value:(0,r.peopleOf)(Y,X),onChange:e=>{V(e.partySize),Q(e.children),De(!1)},depositsOn:(0,n.depositOf)(h.settings).on&&(0,n.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:Te.map(e=>{const t=fe&&e.available&&!we(e.time).length||!(0,P.dogTimeOk)(h,E,R,e.time,ye);return(0,L.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(_,b,R,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:J===e.time,onPress:()=>{Z(e.time),U(!1),De(!1)}},e.time)})}),Oe?(0,L.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[Pe?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Y,Pe.left,Pe.time)}):null,$e?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)($e.time,$e.cap)}):null,(0,L.jsx)(C.Chip,{label:ve?'Booking over the limit: on':'Book anyway (over the limit)',selected:ve,onPress:()=>De(e=>!e),testID:"nb-over-ok"})]}):null,fe&&J?(0,L.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,L.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,L.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",pe.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),Se.length?pe.areas.filter(e=>Se.some(t=>t.area===e.name)).map(e=>(0,L.jsxs)(m.default,{style:{gap:6},accessibilityLabel:e.name,children:[(0,L.jsxs)(C.T,{size:13,center:!0,colour:S.colours.muted,children:[e.name,e.outdoor?' (outdoor)':'']}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:Se.filter(t=>t.area===e.name).map(e=>{const t=Se[0]?.table===e.table;return(0,L.jsx)(C.Chip,{testID:`nb-dog-table-${(0,l.tableNumbers)(e.table)}`,label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.seats} seats${t?' \xb7 best':''}${Le&&(0,O.accessibleSetUp)(pe)&&!(0,O.isAccessible)(pe,e.table)?' \xb7 not step-free':''}`,selected:(ge??Se[0].table)===e.table,onPress:()=>he(e.table)},e.table)})})]},e.id)):(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Y," at ",J,". Try another time."]})]}):null,ze?(0,L.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,L.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",ze.from,"\u2013",ze.to,ze.reason?` (${ze.reason})`:'']}),Be?(0,L.jsx)(C.Chip,{label:H?'Manager override on':'Override and book anyway',selected:H,onPress:()=>U(e=>!e)}):(0,L.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,Te.length?null:(0,L.jsx)(m.default,{testID:"nb-closed",children:(0,L.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(ke)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,L.jsx)(P.MoreQuestions,{rid:b,r:h,value:ue,onChange:ce,party:Y,date:R,time:J,today:(0,w.ymd)(p),bookings:E,audience:"staff",showTables:!1!==h.settings.tableRequests}),Le&&!(0,O.accessibleSetUp)(pe)?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,Ae&&!fe?(0,L.jsxs)(C.T,{size:14,colour:S.colours.goldLight,testID:"nb-large-group",children:["Large group: tables ",Ae.join(' + ')," joined."]}):null,Re.ok?null:(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,testID:"nb-dog-cap",children:["Online, a dog booking is for up to ",Fe.dogMaxParty," people. You can still book it here: check where they can sit."]}),(0,L.jsx)(C.Field,{label:"Notes (optional)",value:ee,onChangeText:te,placeholder:Fe.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"nb-notes"}),We.preorders?(0,L.jsxs)(C.Muted,{testID:"nb-preorder-deposit",children:["Pre-order deposit: ",(0,a.gbp)(We.preorders),We.adults?`, plus the group deposit: ${(0,a.gbp)(We.total)} in total`:'',". Staff can waive it."]}):null,(0,n.depositDue)((0,n.depositOf)(h.settings),Y,X)?(0,L.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(h.settings),Y,X))," (",(0,a.gbp)((0,n.depositOf)(h.settings).perPersonPence)," per adult for tables of ",(0,n.depositOf)(h.settings).fromParty,"+ adults",X?`; ${X} ${1===X?'child':'children'} free`:'; children free, and they do not count towards the number that needs a deposit',"). Staff can waive it. Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,L.jsx)(C.Muted,{children:"CoverCharge confirms the guest by email automatically (preview mode: shown in the Outbox, not sent)."}),Me?(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",J,". Try another time: dogs are very welcome then."]}):null,(0,L.jsx)(C.Button,{label:be.length?be[0]:'Save booking',testID:"nb-save",disabled:!Ne,onPress:()=>{if(R<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,P.needsPatch)(ue),s=ue.tableReq.find(e=>!fe||Se.some(t=>t.table===e)),o=fe?null:(0,B.requestedFreeTable)(ue.tableReq,{date:R,time:J,partySize:Y},pe.tables.map(e=>e.name),je,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:q.trim(),partySize:Y,date:R,time:J,notes:ee.trim(),security:We.total?'deposit':'none',depositPaid:0,...X?{children:X}:{},...We.total?{...(0,$.depositFields)(We),depositPolicy:(0,n.depositWords)((0,n.depositOf)(h.settings),Y,h.name,X).join(' '),depositRefundable:(0,n.depositOf)(h.settings).refundable,depositCutoffHours:(0,n.depositOf)(h.settings).cutoffHours}:{},phone:Ce.pretty,email:le.trim()||void 0,...ne?(0,$.marketingChoice)(le,!0):{},source:re,...e,...Te.find(e=>e.time===J)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...fe?{table:ge??s??Se[0]?.table}:o?{table:o}:{}}).then(e=>(0,z.postNewBookingToKitchen)(e,N)).catch(()=>{}),u?.({date:R,time:J,name:q.trim()}),t()}})]})}},1096,[812,1097,1098,843,851,841,1099,1100,1101,1102,17,842,385,85,856,1055,858,1103,1074,863,804,848,777,996,993,1104,1105,1077,1053,1076,1094,1093,1111,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return R}}),_e.useTableNames=W,_e.resetTableLive=E,_e.seatBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'seated'),E(e,t.table)},_e.finishBookingNow=async function(e,t){const s=(new Date).toISOString();await k.repo.bookings.update(t.id,(0,N.finishClearPatch)(s,t.table)),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=_,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return H}}),_e.TablePicker=U,_e.WalkInSheet=G,_e.AssignTableSheet=V,_e.undoNotice=Y,_e.NewBookingSheet=K,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[n,i]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>i({b:e}),combineTables:e=>i({b:e,combine:!0}),elements:(0,A.jsxs)(A.Fragment,{children:[s?(0,A.jsx)(G,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,A.jsx)(K,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,A.jsx)(V,{booking:n.b,combine:n.combine,onClose:()=>i(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),z=_r(_d[29]),B=_r(_d[30]),M=_r(_d[31]),N=_r(_d[32]),L=_r(_d[33]),A=_r(_d[34]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),R=Array.from({length:12},(e,t)=>String(t+1));function W(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function E(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function _(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=W(e),a=(0,v.useFloor)(t=>t.live[e])??{},n=(0,v.usePlan)(e),i=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(i,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const H=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function U({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=n?6:8,f=n?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(i??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,A.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],i=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!i,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,A.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:i?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,A.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,A.jsx)(C.T,{weight:"bold",size:22,colour:i?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,A.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,A.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,A.jsx)(C.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const q=[1,2,3,4,5,6,7,8];function G({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:r,r:d,now:u}=(0,y.useCtx)(15e3),x=_(r,u),[T,I]=(0,c.useState)(2),[P,$]=(0,c.useState)(!1),[O,z]=(0,c.useState)(i??null),B=(0,v.usePlan)(r),N=(0,k.useBookings)(r),L=(0,D.useBlocks)(e=>e.blocks),R=(0,D.closedAreasAt)(L,r,(0,w.ymd)(u),(0,w.hm)(u)),W=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(x).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(B,N.filter(e=>e.date===(0,w.ymd)(u)),e,T,u,(0,j.turnFor)(T,d.settings.turnMins),90,void 0,{closed:R})?.table??null},[B,N,x,T,R.size,u.getTime()]);(0,c.useEffect)(()=>{O&&(0,v.tablesOf)(O).some(e=>'Closed'===x[e]?.label)&&z(null)},[O,R.size]);const[H,G]=(0,c.useState)(!1),[V,Y]=(0,c.useState)(''),K=(e,t=String(e),s=()=>{$(!1),I(e)})=>{const o='9+'===t?P:!P&&T===e;return(0,A.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,A.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},Q=(0,A.jsx)(s.PartySizeInput,{value:T,onChange:I,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),X=(0,A.jsxs)(m.default,{style:{gap:8,width:n?256:void 0},children:[(0,A.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,A.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[q.map(e=>K(e)),K(9,'9+',()=>{$(!0),I(e=>e>=9?e:9)})]}),P?Q:null]}),[J,Z]=(0,c.useState)(!1),ee=async(t=O)=>{if(!J&&(0,M.guardBookingChange)(F)){Z(!0);try{const s=await k.repo.bookings.seatWalkIn(r,T,t??void 0,V);E(r,t??void 0),a(s),e()}finally{Z(!1)}}},te=(0,A.jsxs)(m.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,A.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,A.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),O?(0,A.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>z(null)}):null]}),(0,A.jsx)(U,{use:x,value:O,onPick:e=>{x[e]&&!x[e].busy?ee(e):z(O===e?null:e)},big:n,dense:n,best:W,bestSet:(0,h.bestTables)(B)}),(0,A.jsxs)(C.Muted,{children:["Tap a free table to seat them there",W&&!O?` (suggested for ${T}: ${(0,l.tableNumbers)(W)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(u)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,A.jsx)(C.Button,{label:`Seat walk-in \xb7 ${T} ${1===T?'person':'people'}${O?` \xb7 ${(0,l.tableNumbers)(O)}`:''}`,disabled:J,onPress:()=>{ee()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,A.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[X,te]}):(0,A.jsxs)(A.Fragment,{children:[X,te]}),(0,A.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[H?(0,A.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:V,onChangeText:Y,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,A.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,A.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,A.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function V({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,y.useCtx)(15e3),i=_(o,n),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(n)),t,e.partySize,n,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,n.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),P=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,$=D.reduce((e,t)=>e+P(t),0),O=D.length>0&&${if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&E(o,l),t()},B=x?(0,A.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,A.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,A.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${$} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,A.jsx)(m.default,{testID:"combine-short",children:(0,A.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-$," more needed. Add another table."]})}):null,(0,A.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,A.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,A.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,A.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,A.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,A.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${H(e)}`,testID:"assign-table-sheet",footer:B,children:[f&&!x?(0,A.jsx)(m.default,{testID:"assign-suggested",children:(0,A.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,A.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,A.jsx)(U,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function Y(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${H(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function K({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:N}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const R=(0,w.ymd)(p),[W,E]=(0,c.useState)(ee.blocks),[U,q]=(0,c.useState)(!1),[G,V]=(0,c.useState)(''),[Y,K]=(0,c.useState)(2),[Q,X]=(0,c.useState)(0),J=Math.min(Q,Math.max(0,Y-1)),[Z,ee]=(0,c.useState)(null),[te,se]=(0,c.useState)(''),[oe,le]=(0,c.useState)(''),[ae,ne]=(0,c.useState)(''),[ie,re]=(0,c.useState)(!1),[de,ue]=(0,c.useState)('phone'),[ce,be]=(0,c.useState)([]),[ge,he]=(0,c.useState)(''),[pe,me]=(0,c.useState)((0,P.emptyNeeds)()),fe=(0,P.needsMissing)(pe),[ye,ke]=(0,c.useState)(null),xe=(0,v.usePlan)(b),je=(0,O.dogSetUp)(xe),we=!0===pe.dog&&je,Se=pe.dog?pe.dogs:0,Te=(0,w.parseYmd)(W),Ce=(0,j.turnFor)(Y,h.settings.turnMins),ve=_.filter(e=>e.date===W),De=e=>(0,j.dogTablesAt)(xe,ve,Y,(0,j.slotStart)(W,e),Ce,h.settings.turnMins,(0,D.closedAreasAt)(H,b,W,e)),Ie=we&&Z?De(Z):[];(0,c.useEffect)(()=>{ke(null)},[we,Z,Y]);const Pe=(0,x.bookingSlots)(h,Te,e=>_.filter(t=>t.date===W&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Y,W===(0,w.ymd)(p)?p:(0,w.addMins)(Te,0),e=>_.filter(t=>t.date===W&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),$e=(0,T.guestPhone)(oe),[Oe,ze]=(0,c.useState)(!1),Be=Z?Pe.find(e=>e.time===Z):void 0,Me=Be&&Be.left=2&&!!Z&&(!Le||Oe)&&(0,o.validParty)(Y)&&$e.ok&&(0,T.emailOk)(ae)&&(!Ae||Fe&&U)&&(!we||Ie.length>0)&&!Re,Ee=pe.wheelchair>0||pe.stepFree,He=(0,$.bookingRulesOf)(h),Ue=(0,$.largeGroupTables)(He,Y),qe=(0,$.dogPartyCheck)(He,Y,!0===pe.dog,pe.assistDog),Ge=(0,$.bookingDepositSplit)((0,n.depositOf)(h.settings),Y,J,(0,P.needsPatch)(pe),(0,O.reservablesOf)(h));return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(Te)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,A.jsx)(P.FirstQuestions,{rid:b,value:pe,onChange:me,party:Y,audience:"staff"}),pe.dog&&!je?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,A.jsx)(I.BookingDatePicker,{r:h,today:p,value:W,onChange:e=>{e!==W&&(E(e),ee(null),q(!1))}}),(0,A.jsxs)(C.Row,{gap:6,children:[(0,A.jsx)(C.Chip,{label:"Phone",selected:'phone'===de,onPress:()=>ue('phone')}),(0,A.jsx)(C.Chip,{label:"In person",selected:'in-person'===de,onPress:()=>ue('in-person')})]}),(0,A.jsx)(C.Field,{label:"Name",value:G,onChangeText:V,placeholder:"e.g. Reid",testID:"nb-name"}),(0,A.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:oe,onChangeText:le,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!$e.ok&&oe?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:$e.error}):null,(0,A.jsx)(C.Field,{label:"Email (optional)",value:ae,onChangeText:ne,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email",testID:"nb-email"}),(0,T.emailOk)(ae)?null:(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),ae.trim()&&He.marketingOptIn?(0,A.jsx)(C.Toggle,{label:He.marketingWords,value:ie,onChange:re,testID:"nb-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,A.jsx)(i.AdultsChildren,{value:(0,r.peopleOf)(Y,J),onChange:e=>{K(e.partySize),X(e.children),ze(!1)},depositsOn:(0,n.depositOf)(h.settings).on&&(0,n.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,children:Pe.map(e=>{const t=we&&e.available&&!De(e.time).length||!(0,P.dogTimeOk)(h,_,W,e.time,Se);return(0,A.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(H,b,W,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:Z===e.time,onPress:()=>{ee(e.time),q(!1),ze(!1)}},e.time)})}),Le?(0,A.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[Me?(0,A.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Y,Me.left,Me.time)}):null,Ne?(0,A.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)(Ne.time,Ne.cap)}):null,(0,A.jsx)(C.Chip,{label:Oe?'Booking over the limit: on':'Book anyway (over the limit)',selected:Oe,onPress:()=>ze(e=>!e),testID:"nb-over-ok"})]}):null,we&&Z?(0,A.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,A.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,A.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",xe.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),Ie.length?xe.areas.filter(e=>Ie.some(t=>t.area===e.name)).map(e=>(0,A.jsxs)(m.default,{style:{gap:6},accessibilityLabel:e.name,children:[(0,A.jsxs)(C.T,{size:13,center:!0,colour:S.colours.muted,children:[e.name,e.outdoor?' (outdoor)':'']}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,children:Ie.filter(t=>t.area===e.name).map(e=>{const t=Ie[0]?.table===e.table;return(0,A.jsx)(C.Chip,{testID:`nb-dog-table-${(0,l.tableNumbers)(e.table)}`,label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.seats} seats${t?' \xb7 best':''}${Ee&&(0,O.accessibleSetUp)(xe)&&!(0,O.isAccessible)(xe,e.table)?' \xb7 not step-free':''}`,selected:(ye??Ie[0].table)===e.table,onPress:()=>ke(e.table)},e.table)})})]},e.id)):(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Y," at ",Z,". Try another time."]})]}):null,Ae?(0,A.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,A.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",Ae.from,"\u2013",Ae.to,Ae.reason?` (${Ae.reason})`:'']}),Fe?(0,A.jsx)(C.Chip,{label:U?'Manager override on':'Override and book anyway',selected:U,onPress:()=>q(e=>!e)}):(0,A.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,Pe.length?null:(0,A.jsx)(m.default,{testID:"nb-closed",children:(0,A.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(Te)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,A.jsx)(P.MoreQuestions,{rid:b,r:h,value:pe,onChange:me,party:Y,date:W,time:Z,today:(0,w.ymd)(p),bookings:_,audience:"staff",showTables:!1!==h.settings.tableRequests}),Ee&&!(0,O.accessibleSetUp)(xe)?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,Ue&&!we?(0,A.jsxs)(C.T,{size:14,colour:S.colours.goldLight,testID:"nb-large-group",children:["Large group: tables ",Ue.join(' + ')," joined."]}):null,qe.ok?null:(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,testID:"nb-dog-cap",children:["Online, a dog booking is for up to ",He.dogMaxParty," people. You can still book it here: check where they can sit."]}),(0,A.jsx)(C.T,{size:16,center:!0,children:"VIP or regular"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:L.TAGS.map(e=>{const t=ce.includes(e);return(0,A.jsx)(C.Chip,{label:e,selected:t,testID:`nb-tag-${e}`,onPress:()=>be(t?ce.filter(t=>t!==e):[...ce,e].sort())},e)})}),(0,A.jsx)(C.T,{size:16,center:!0,children:"Occasion"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:L.OCCASIONS.map(e=>(0,A.jsx)(C.Chip,{label:e.label,selected:ge===e.id,testID:`nb-occasion-${e.id||'none'}`,onPress:()=>he(e.id)},e.id||'none'))}),(0,A.jsx)(C.Field,{label:"Notes (optional)",value:te,onChangeText:se,placeholder:He.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"nb-notes"}),Ge.preorders?(0,A.jsxs)(C.Muted,{testID:"nb-preorder-deposit",children:["Pre-order deposit: ",(0,a.gbp)(Ge.preorders),Ge.adults?`, plus the group deposit: ${(0,a.gbp)(Ge.total)} in total`:'',". Staff can waive it."]}):null,(0,n.depositDue)((0,n.depositOf)(h.settings),Y,J)?(0,A.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(h.settings),Y,J))," (",(0,a.gbp)((0,n.depositOf)(h.settings).perPersonPence)," per adult for tables of ",(0,n.depositOf)(h.settings).fromParty,"+ adults",J?`; ${J} ${1===J?'child':'children'} free`:'; children free, and they do not count towards the number that needs a deposit',"). Staff can waive it. Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,A.jsx)(C.Muted,{children:"CoverCharge confirms the guest by email automatically (preview mode: shown in the Outbox, not sent)."}),Re?(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",Z,". Try another time: dogs are very welcome then."]}):null,(0,A.jsx)(C.Button,{label:fe.length?fe[0]:'Save booking',testID:"nb-save",disabled:!We,onPress:()=>{if(W<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,P.needsPatch)(pe),s=pe.tableReq.find(e=>!we||Ie.some(t=>t.table===e)),o=we?null:(0,B.requestedFreeTable)(pe.tableReq,{date:W,time:Z,partySize:Y},xe.tables.map(e=>e.name),ve,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:G.trim(),partySize:Y,date:W,time:Z,notes:te.trim(),security:Ge.total?'deposit':'none',depositPaid:0,...J?{children:J}:{},...Ge.total?{...(0,$.depositFields)(Ge),depositPolicy:(0,n.depositWords)((0,n.depositOf)(h.settings),Y,h.name,J).join(' '),depositRefundable:(0,n.depositOf)(h.settings).refundable,depositCutoffHours:(0,n.depositOf)(h.settings).cutoffHours}:{},phone:$e.pretty,email:ae.trim()||void 0,...ie?(0,$.marketingChoice)(ae,!0):{},source:de,...e,...Pe.find(e=>e.time===Z)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...ce.length?{tags:ce}:{},...ge?{occasion:ge}:{},...we?{table:ye??s??Ie[0]?.table}:o?{table:o}:{}}).then(e=>(0,z.postNewBookingToKitchen)(e,N)).catch(()=>{}),u?.({date:W,time:Z,name:G.trim()}),t()}})]})}},1096,[812,1097,1098,843,851,841,1099,1100,1101,1102,17,842,385,85,856,1055,858,1103,1074,863,804,848,777,996,993,1104,1105,1077,1053,1076,1094,1093,1111,1112,8]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,S]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{S(String(e))},[e]);const T=e=>p((0,s.clampParty)(e,b,y)),$=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>T(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:u.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(c.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:u.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?$(-10,'\u221210',"10 fewer people"):null,$(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{S(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&T((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);S(String(e)),T(e)},returnKeyType:"done",blurOnSubmit:!0,onSubmitEditing:e=>{e?.target?.blur?.()},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:u.colours.border,color:u.colours.text,backgroundColor:u.colours.surface,textAlign:'center',fontSize:20,fontFamily:u.fonts.semibold}}),$(1,'+','One more person'),y-b>=20?$(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),u=r(_d[5]),c=r(_d[6]),d=r(_d[7])},1097,[17,385,395,85,1098,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"overCapacityNote",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"overPartiesNote",{enumerable:!0,get:function(){return b}});const t=100,n=1,o=`Bookings are for ${n} to ${t} people.`,u=o=>'number'==typeof o&&Number.isInteger(o)&&o>=n&&o<=t,c=(o,u=n,c=t)=>{const s=parseInt(String(o??'').replace(/\D/g,'').slice(0,4),10);return Math.max(u,Math.min(c,Number.isFinite(s)?s:u))},s=(o,u=n,c=t)=>Math.max(u,Math.min(c,Math.round(Number(o)||u))),f=(t,n,o)=>n<=0?`${o} is already full for booked Covers. Booking ${t} more goes over the venue\u2019s limit: check tables and staffing.`:`${t} is more than the ${n} Covers left at ${o}. Booking goes over the venue\u2019s limit by ${t-n}: check tables and staffing.`,b=(t,n)=>`${t} already has the most bookings we take at one start time (${n}). Booking another goes over the venue\u2019s limit: check tables and staffing.`},1098,[]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdultsChildren=function({value:e,onChange:t,depositsOn:h,testID:x="people"}){const p=e=>t((0,s.storedPeople)(e)),b=(0,s.totalLine)(e);return(0,o.jsxs)(l.default,{testID:x,style:{gap:8,alignItems:'center',width:'100%'},children:[(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",children:"Adults"}),(0,o.jsx)(n.PartySizeInput,{value:e.adults,min:1,max:(0,s.maxAdults)(e.children),onChange:t=>p({adults:t,children:e.children}),label:"Adults",testID:`${x}-adults`}),(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",children:"Children"}),(0,o.jsx)(n.PartySizeInput,{value:e.children,min:0,max:(0,s.maxKids)(e.adults),onChange:t=>p({adults:e.adults,children:t}),label:"Children",testID:`${x}-children`}),(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",colour:c.colours.goldLight,testID:`${x}-total`,accessibilityLabel:b,children:b}),h?(0,o.jsx)(u.Muted,{center:!0,children:"Children never pay a deposit."}):null]})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4]),c=r(d[5]),o=r(d[6])},1099,[17,85,1100,1097,777,804,8]); @@ -1192,18 +1192,18 @@ __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,"ARM_MS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SELECT_HINT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SELECTED_A11Y",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"TABLE_SELECT_HINT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isArmed",{enumerable:!0,get:function(){return l}}),e.releaseOn=function(n,o,c,u){const b=l(n,o,u);return c?b?{arm:null,action:'move'}:{arm:n&&u-n.at!!n&&n.id===o&&c-n.at!e.signOff),S=k.filter(e=>e.signOff),_=j.map(o.allergenLabel).join(', '),C=e=>e.map(e=>e.name).join(', ')||'none';return(0,f.jsxs)(l.default,{testID:"menu-allergy-check",style:{gap:6,borderWidth:1,borderColor:p.length?h.colours.red:h.colours.border,borderRadius:12,padding:10,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(u.T,{weight:"semibold",children:["Allergy check against the menu (",_,")"]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.red,children:["Contains: ",p.length," dish",1===p.length?'':'es']}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.amber,children:["May contain: ",M.length]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.ok,children:["Free from ",1===j.length?'it':'them'," (signed off): ",S.length]}),w.length?(0,f.jsxs)(u.Muted,{children:[w.length," more awaiting the head chef's sign-off, so not shown as safe."]}):null,(0,f.jsx)(n.default,{testID:"menu-allergy-details",accessibilityRole:"button",onPress:()=>y(!x),hitSlop:6,children:(0,f.jsx)(u.T,{size:14,colour:h.colours.gold,children:x?'Hide dishes':'Show dishes'})}),x?(0,f.jsxs)(l.default,{style:{gap:4},children:[(0,f.jsxs)(u.Muted,{children:["Contains: ",C(p)]}),(0,f.jsxs)(u.Muted,{children:["May contain: ",C(M)]}),(0,f.jsxs)(u.Muted,{children:["Free from: ",C(S)]})]}):null,(0,f.jsx)(u.Muted,{children:'guest'===m?'From the kitchen\u2019s signed-off recipe cards. Specials on the board are checked by staff on the day.':'From the signed-off recipe cards. Specials on the board have their own allergens. Still check with the guest and the kitchen.'})]})};var s=r(d[0]),n=e(r(d[1])),l=e(r(d[2])),t=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8])},1110,[17,385,85,858,845,847,804,777,8]); __d(function(g,r,i,_a,m,_e,d){"use strict";function t(t){return String(t??'').split('+').map(t=>t.trim()).filter(Boolean)}function e(t){return t.length<=1?t[0]??'':2===t.length?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`}function n(n){const o=t(n);return o.length>1?`tables ${e(o)}`:o.length?`table ${o[0]}`:''}Object.defineProperty(_e,'__esModule',{value:!0}),_e.tableWords=n,Object.defineProperty(_e,"RECENT_SEATED_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"FINISH_UNDO_MS",{enumerable:!0,get:function(){return a}}),_e.seatedAgoMs=s,_e.seatedAgoWords=u,_e.needsRecentSeatedWarning=c,_e.finishConfirmPrompt=function(t){const e=t.name.trim()||'This party',n=t.parties&&t.parties>1?t.parties:1,o=t.seated&&c({seatedAt:t.seatedAt},t.now),a=o?u(s({seatedAt:t.seatedAt},t.now)):'',l=f(t.table);if(!t.seated)return`Mark ${e} finished without seating?`;if(n>1){return`${n} parties seated here${o?`, including ${e} seated ${a}`:''}. Mark all finished${l}?`}return o?`${e} seated ${a}. Mark finished${l}?`:`Mark ${e} finished${l}?`},_e.restoreSeatedPrompt=function(t,e){return`${t.trim()||'This party'} is finished. Seat them at ${n(e)}?`},_e.lastTableFromAudit=l,_e.tableForUndo=function(t,e){const n=String(t.table??'').trim();if(n)return n;const o=String(t.lastTable??'').trim();return o||l(e)},_e.finishClearPatch=function(t,e){const n=String(e??'').trim();return{status:'finished',finishedAt:t,table:void 0,...n?{lastTable:n}:{}}},_e.finishUndoPatch=function(t){const e=String(t??'').trim();return{status:'seated',finishedAt:void 0,lastTable:void 0,...e?{table:e}:{table:void 0}}};const o=15,a=15e3;function s(t,e){if(!t.seatedAt)return null;const n=new Date(t.seatedAt).getTime();return Number.isFinite(n)?Math.max(0,e.getTime()-n):null}function u(t){const e=Math.round(t/1e3);if(e<1)return'just now';if(e<60)return`${e} second${1===e?'':'s'} ago`;const n=Math.round(e/60);if(n<60)return`${n} minute${1===n?'':'s'} ago`;const o=Math.round(n/60);return`${o} hour${1===o?'':'s'} ago`}function c(t,e){const n=s(t,e);return null!=n&&n<9e5}function f(t){const e=t?n(t):'';return e?` and set ${e} to needs clearing`:''}function l(t){if(!t?.length)return;const e=[...t].sort((t,e)=>String(e.at??'').localeCompare(String(t.at??'')));for(const t of e){if(t.action&&'tables'!==t.action)continue;const e=String(t.from_value??'').trim(),n=String(t.to_value??'').trim();if(e&&!n)return e.replace(/\+/g,'+')}for(const t of e){if(t.action&&'tables'!==t.action)continue;const e=String(t.to_value??'').trim();if(e)return e;const n=String(t.from_value??'').trim();if(n)return n}}},1111,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FinishConfirm=I,_e.RestoreSeatedConfirm=function({prompt:e,onYes:t,onNo:n}){return(0,k.jsxs)(s.default,{testID:"restore-seated-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:"Yes, seat them",testID:"restore-seated-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"restore-seated-no",onPress:n,style:w})]})},Object.defineProperty(_e,"finishBookingNow",{enumerable:!0,get:function(){return p.finishBookingNow}}),_e.undoFinishedNow=D,_e.restoreFinishedToTable=async function(e,t,s){const o=(0,b.tableKey)(s);await n.repo.bookings.update(t.id,{...(0,f.tablePatch)(o||null),status:'seated',finishedAt:void 0,lastTable:void 0}),o&&(0,p.resetTableLive)(e,o)},_e.offerFinishUndo=F,_e.finishAndOfferUndo=v,_e.finishUnseatedAndOfferUndo=N,_e.FinishButton=function({rid:e,b:s,name:n,allowed:o=!0,hint:c,small:b,bigToast:f,testID:u,label:h="Finished",a11y:p,kind:D="secondary"}){const[F,j]=t.default.useState(!1);if(!o)return null;const x=(0,l.finishConfirmPrompt)({name:n,table:s.table,seatedAt:s.seatedAt,now:new Date,seated:'seated'===s.status});if(F)return(0,k.jsx)(I,{prompt:x,onNo:()=>j(!1),onYes:()=>{j(!1),'seated'===s.status?v(e,[s],n,{big:f,table:s.table}):N(e,s,n,{big:f})}});return(0,k.jsx)(y.Button,{small:b,kind:D,label:h,testID:u,accessibilityLabel:p??`${h}: ${n}`,accessibilityHint:c,disabled:!o,onPress:()=>j(!0),style:b?void 0:w})};var t=e(r(d[0])),s=e(r(d[1])),n=r(d[2]),o=r(d[3]),l=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),u=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]);const w={minHeight:64};function I({prompt:e,onYes:t,onNo:n,yesLabel:o="Yes, finish"}){return(0,k.jsxs)(s.default,{testID:"finish-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:o,testID:"finish-confirm-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"finish-confirm-no",onPress:n,style:w})]})}async function D(e,t,s){const c=(0,l.tableForUndo)(t,s);await n.repo.bookings.update(t.id,(0,l.finishUndoPatch)(c)),c&&(0,o.tablesOf)(c).forEach(t=>o.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function F(e){const t=e.bookings[0];if(!t)return;const s=e.bookings.length>1?`${e.bookings.length} parties finished.`:`${e.name} finished.`,n=e.table?`${(0,c.tableWords)(e.table).replace(/^t/,'T')} needs clearing.`:void 0,o=`finish-undo-${t.id}`;(0,u.notify)({id:o,title:s,body:n,timeoutMs:l.FINISH_UNDO_MS,big:e.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{for(const t of e.bookings)await D(e.rid,{...t,table:void 0,lastTable:t.table||t.lastTable});(0,u.dismissNotice)(o)})()}}]})}async function v(e,t,s,n){const o=n?.table??t.find(e=>e.table)?.table;for(const s of t)await(0,p.finishBookingNow)(e,s);F({rid:e,bookings:t,name:s,table:o,big:n?.big})}async function N(e,t,s,o){await n.repo.bookings.setStatus(t.id,'finished');const c=`finish-undo-${t.id}`;(0,u.notify)({id:c,title:`${s} finished.`,timeoutMs:l.FINISH_UNDO_MS,big:o?.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{await n.repo.bookings.setStatus(t.id,t.walkIn?'cancelled':'confirmed'),(0,u.dismissNotice)(c)})()}}]})}},1112,[17,85,858,996,1111,1113,1094,1090,916,804,777,1096,8]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return s.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return c}}),e.freeTablesNow=function(t,a,s=!1){const l=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),n=l.filter(([,t])=>t.table.maxSeats>=a),o=t=>t.map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}));return s?[...o(n),...o(l.filter(([,t])=>t.table.maxSeatsh[t]&&(l.includes(h[t].status)||'dirty'===h[t].status||'blocked'===h[t].status));if(p.length&&p.every(t=>h[t])&&!t.length)f.push({id:'seat',label:`Seat at ${b(s.table).replace(/^t/,'T')}`,a11y:`Seat ${n}, ${u(s.partySize)}, at ${b(s.table)}`,table:s.table});else if(c(s,$)){const a=p.length?t.length?`${b(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===h[t[0]].status?'waiting to be cleared':'blocked'===h[t[0]].status?'blocked':'in use'}`:`${b(s.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';f.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${n}, ${u(s.partySize)}. ${a}.`,note:a})}c(s,$)&&f.push({id:'finished',label:'Finished',a11y:`Finished, ${n}, ${s.time} booking, without seating at a table`}),o($,s)<=0&&f.push({id:'noshow',label:'No-show',a11y:`No-show, ${n}, ${s.time} booking`})}return f.push({id:'details',label:'Guest details',a11y:`Guest details, ${n}`}),f};var t=r(d[0]),a=r(d[1]),s=r(d[2]);const l=['seated','mains','dessert','bill'],n=t=>new Date(`${t.date}T${t.time}:00`),o=(t,a)=>(n(a).getTime()-t.getTime())/6e4,b=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},u=t=>`${t} ${1===t?'person':'people'}`,c=(t,a)=>o(a,t)<=45},1113,[996,863,1074]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return x}}),_e.cancelWalkInWords=I,_e.reinstateWalkInWords=$,_e.cancelWalkInNow=j,_e.reinstateWalkInNow=C,_e.CancelWalkInButton=function({rid:e,b:t,onDone:o,small:c,big:u}){const[b,f]=(0,n.useState)(!1),k=(0,l.useInStaffApp)(),x=(0,s.useSeatClearFinish)();return p(t)?k&&!x.ok?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(w.Button,{kind:"secondary",small:c,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>f(!0),style:u?{minHeight:64}:c?{minHeight:44}:h}),b?(0,y.jsx)(W,{rid:e,b:t,onClose:()=>f(!1),onDone:o}):null]}):null},_e.CancelWalkInConfirm=W,_e.ReinstateWalkInButton=function({rid:e,b:t,today:o,onDone:u,small:b}){const[f,p]=(0,n.useState)(!1),I=(0,l.useInStaffApp)(),j=(0,s.useSeatClearFinish)();if(!x(t,o))return null;if(I&&!j.ok)return null;const W=$(t);if(!f)return(0,y.jsx)(w.Button,{kind:"ghost",small:b,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>p(!0),style:b?{minHeight:44}:h});return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:()=>p(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:W,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:W})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[h,{flexGrow:1}],onPress:async()=>{await C(e,t),p(!1),u?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>p(!1),style:h})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]),o=r(d[4]),c=(e=o)&&e.__esModule?e:{default:e},u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]),w=r(d[9]),y=r(d[10]);const h={minHeight:56},p=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),x=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function I(e){const t=(0,b.tablesOf)(e.table),n=(0,f.tablesWords)(t);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${t.length?` at ${n}`:''}, arrived ${e.time}? It comes off the Covers${t.length?` and ${n} ${t.length>1?'go':'goes'} back to Free`:''}.`}function $(e){return`Put walk-in ${e.ref} back to seated? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`}async function j(e,n){await u.repo.bookings.setStatus(n.id,'cancelled'),await u.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,b.tablesOf)(n.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function C(e,t){await u.repo.bookings.setStatus(t.id,'seated'),(0,b.tablesOf)(t.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function W({rid:e,b:t,onClose:n,onDone:l}){const s=I(t);return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:s,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:s})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[h,{flexGrow:1}],onPress:async()=>{await j(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,b.tablesOf)(t.table).length?` ${(0,f.tablesWords)((0,b.tablesOf)(t.table))} free.`:''}`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:h})]})]})}},1114,[1115,17,1055,1117,85,858,996,1094,804,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.cancelStamp=C,_e.cancelBookingNow=w,_e.reinstateBookingNow=$,_e.CancelBookingButton=function({rid:e,b:n,name:o,onDone:s,big:l,small:c}){const[u,f]=(0,t.useState)(!1);return(0,b.canCancelBooking)(n)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(x.Button,{kind:"secondary",small:c,label:"Cancel booking",testID:`cancel-booking-${n.id}`,accessibilityLabel:`Cancel booking for ${o}, ${n.time}, ${n.partySize} Covers`,onPress:()=>f(!0),style:l?{minHeight:64}:c?{minHeight:44}:j}),u?(0,h.jsx)(D,{rid:e,b:n,name:o,onClose:()=>f(!1),onDone:s}):null]}):null},_e.CancelBookingConfirm=D,_e.ReinstateBookingButton=function({b:e,name:n,today:s,onDone:l}){const[c,u]=(0,t.useState)(!1);if(!(0,b.canReinstateBooking)(e,s))return null;const y=(0,b.reinstateBookingWords)(e,n);if(!c)return(0,h.jsx)(x.Button,{kind:"ghost",label:"Undo cancel",testID:`reinstate-booking-${e.id}`,accessibilityLabel:`Undo cancel for ${n}`,onPress:()=>u(!0),style:j});return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:()=>u(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center'},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, put back to booked",testID:"reinstate-booking-yes",accessibilityLabel:`Yes, put ${n} back to booked`,style:[j,{flexGrow:1}],onPress:async()=>{await $(e),u(!1),l?.(`${n} put back to booked.`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-booking-no",onPress:()=>u(!1),style:j})]})]})};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]),c=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]),y=r(d[8]),k=r(d[9]),p=r(d[10]),x=r(d[11]),h=r(d[12]);const j={minHeight:56},B={display:'Display',owner:'Managers app',staff:'Staff app',chef:'Kitchen app',customer:'Customer page'};function C(e){const t=y.useSession.getState().meId,n=t?k.useOwner.getState().staff.find(e=>e.id===t):void 0,o=B[p.APP_VARIANT]??'CoverCharge';return{by:n?`${n.name.replace(' (example)','')} (${o})`:o,at:(new Date).toISOString(),app:o,...e.table?{table:e.table}:{}}}async function w(e,t){const n=(0,l.tablesOf)(t.table);await s.repo.bookings.update(t.id,{status:'cancelled',cancelled:C(t),...(0,c.tablePatch)(null)}),n.forEach(t=>l.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function $(e){await s.repo.bookings.setStatus(e.id,'confirmed')}function D({rid:e,b:t,name:n,onClose:s,onDone:c}){const y=(0,b.cancelBookingWords)(t,n),k=(0,l.tablesOf)(t.table);return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:s,title:"Cancel booking?",maxWidth:560,testID:"cancel-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center',gap:8},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, cancel booking",testID:"cancel-booking-yes",accessibilityLabel:`Yes, cancel booking for ${n}`,style:[j,{flexGrow:1}],onPress:async()=>{await w(e,t),s(),c?.(`${n} cancelled.${k.length?` ${(0,u.tablesWords)(k)} free.`:''}`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep booking",testID:"cancel-booking-no",accessibilityLabel:`Keep booking for ${n}`,onPress:s,style:j})]})]})}},1115,[17,85,858,996,1090,1116,1094,804,920,876,856,777,8]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canCancelBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canReinstateBooking",{enumerable:!0,get:function(){return t}}),e.cancelBookingWords=function(n,t){const o=`${n.partySize} Cover${1===n.partySize?'':'s'}`;return`Cancel booking for ${t}, ${n.time}, ${o}? The table is freed. Website bookings will cancel it on the website and may email the guest.`},e.reinstateBookingWords=function(n,t){return`Put ${t} back to booked for ${n.time}? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`},e.cancelledOnDay=o,e.cancelledDayTally=function(n,t){const a=o(n,t),l=a.filter(n=>!!n.walkIn),c=a.filter(n=>!n.walkIn);return{count:a.length,covers:a.reduce((n,t)=>n+t.partySize,0),bookings:c.length,bookingCovers:c.reduce((n,t)=>n+t.partySize,0),walkIns:l.length,walkInCovers:l.reduce((n,t)=>n+t.partySize,0),list:a}},e.cancelledTallyWords=function(n,t="today"){if(!n.count)return`No cancellations ${t}`;const o=[],a=n.bookings??0,l=n.walkIns??0;a&&o.push(`${a} booking${1===a?'':'s'} (${n.bookingCovers??0} Cover${1===(n.bookingCovers??0)?'':'s'})`);l&&o.push(`${l} walk-in${1===l?'':'s'} (${n.walkInCovers??0} Cover${1===(n.walkInCovers??0)?'':'s'})`);if(!o.length)return`Cancelled ${t}: ${n.count} \xb7 ${n.covers} Cover${1===n.covers?'':'s'}`;return`Cancelled ${t}: ${o.join(' \xb7 ')}`};const n=n=>!n.walkIn&&('confirmed'===n.status||'pending'===n.status||'seated'===n.status),t=(n,t)=>!n.walkIn&&'cancelled'===n.status&&n.date>=t;function o(n,t){return n.filter(n=>n.date===t&&'cancelled'===n.status).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name))}},1116,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSeatClearFinish=function(){const t=(0,A.useSignedIn)(),o=(0,A.useInStaffApp)(),_='staff'===s.APP_VARIANT||'chef'===s.APP_VARIANT||o,l=(0,c.canSeatClearFinish)({device:s.IS_CAR||'display'===s.APP_VARIANT||!_&&!t,viaDisplay:(0,n.isKitchenViaDisplay)(),role:t?.role,ownerAccess:t?.ownerAccess,managerAccess:t?.managerAccess});return{ok:l,hint:l?void 0:c.SEAT_CLEAR_HINT}};var s=r(d[0]),n=r(d[1]),c=r(d[2]),A=r(d[3])},1117,[856,922,1118,1055]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEAT_CLEAR_HINT",{enumerable:!0,get:function(){return n}}),e.canSeatClearFinish=function(n){return!(!n.device&&!n.viaDisplay)||('owner'===n.role||'manager'===n.role||!(!n.ownerAccess&&!n.managerAccess))};const n='Ask a manager to seat, finish or clear a table.'},1118,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:s,who:i,role:n,inStaffApp:l,shiftManager:a,big:o,testID:d}){const[h,u]=(0,t.useState)(!1),p=(0,b.useSession)(e=>e.meId),y=(0,m.useOwner)(e=>e.staff.find(e=>e.id===p&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:l,role:n,shiftManager:a})||p&&!(0,x.canChangeBookings)(y)?null:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:d??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),h?(0,N.jsx)(V,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:n,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,l.useBookings)(e).filter(e=>!e.walkIn&&e.date>=s&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,200);return o?(0,N.jsx)(V,{rid:e,id:o,who:i,hidePrivate:a,onClose:n}):(0,N.jsxs)(z.Sheet,{visible:!0,onClose:n,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,N.jsx)(z.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${L(e.date,s)} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${L(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,N.jsx)(z.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,N.jsx)(z.Button,{kind:"ghost",label:"Close",onPress:n,style:{minHeight:44}})]})},_e.EditBookingSheet=V;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=(e=i)&&e.__esModule?e:{default:e},l=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),f=_r(_d[19]),C=_r(_d[20]),I=_r(_d[21]),k=_r(_d[22]),w=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),O=_r(_d[28]),W=_r(_d[29]),z=_r(_d[30]),B=_r(_d[31]),N=_r(_d[32]);const E=/^([01]\d|2[0-3]):[0-5]\d$/,R=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const L=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,D.ymd)(s)?'Tomorrow':F(e)};const A=e=>e?(e/100).toFixed(e%100?2:0):'',M=e=>{const t=(0,B.parseMoneyInput)(e);return null!=t&&t>=0?Math.round(100*t):NaN},F=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',H=e=>{const t=e.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);return t?`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`:''},_=e=>e.charAt(0).toUpperCase()+e.slice(1);function Y({title:e,children:t,testID:s}){return(0,N.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,N.jsx)(z.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const G=({label:e,value:t,onChange:s,max:i=20,testID:n})=>(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:e}),(0,N.jsx)(z.Stepper,{testID:n,value:t,min:0,max:i,onChange:s,label:e})]});function V({rid:e,id:i,who:b,onClose:m,hidePrivate:x=!1}){(0,$.useBlurOutside)();const B=(0,l.useBookings)(e),L=B.find(e=>e.id===i),V=(0,d.useRestaurant)(e),K=(0,a.usePlan)(e),U=(0,o.useBlocks)(e=>e.blocks),[q,X]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Q,J]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Z,ee]=(0,t.useState)(!1),[te,se]=(0,t.useState)(null),[ie,ne]=(0,t.useState)(null),[le,ae]=(0,t.useState)(!1),[oe,de]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositDue:0)),[re,ce]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositAmount:0)),[he,ue]=(0,t.useState)(F(L?(0,c.draftOf)(L).depositDate:''));if(!L||!q||!V)return null;const pe=e=>{se(null),ne(null),X({...q,...e})},ge=(0,O.depositOf)(V.settings),be=e=>{const t=e.partySize??q.partySize,s=Math.min(e.children??q.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(L)&&q.depositOn&&!q.depositPaid&&M(oe||'0')===(0,O.depositDue)(ge,q.partySize,q.children??0)){const e=(0,O.depositDue)(ge,t,s);e>0&&de(A(e))}pe({...e,children:s})},me=(0,v.bookingSlotMinutesOf)(V),xe=R(q.time),ye=E.test(xe),je=q.area?K.areas.filter(e=>e.name===q.area).map(e=>e.id):null,De=e=>!je||e.split('+').every(e=>je.includes(K.tables.find(t=>t.name===e)?.areaId??'')),ve=(0,y.tableOptions)(K,B.filter(e=>e.date===q.date),q.table).filter(e=>De(e)||e===q.table),fe=!(q.depositOn&&(Number.isNaN(M(oe||'0'))||q.depositPaid&&(Number.isNaN(M(re||'0'))||he.trim()&&!H(he)))),Ce={...q,time:xe,depositDue:M(oe||'0')||0,depositAmount:M(re||'0')||0,depositDate:H(he)},Ie=(0,c.changedDraftFields)(Q??(0,c.draftOf)(L),Ce),ke=V.settings.turnMins??90,we=!!q?.email?.trim()&&q.email.trim()!==(L?.email??'').trim(),Te=(0,u.bookingRulesOf)(V),Se=async()=>{const t=(0,c.editPatch)(L,Ce,{by:b||'Team member',app:r.APP_VARIANT});if(le&&we&&Object.assign(t,(0,u.marketingChoice)(Ce.email,!0)),Object.keys(t).length&&await l.repo.bookings.update(L.id,t),'seated'===L.status&&'table'in t&&t.table!==L.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(L.table),n=s(t.table),l=a.useFloor.getState(),o=i.map(t=>l.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!n.includes(e)).forEach(t=>l.setLive(e,t,{stage:void 0,dirty:!0})),n.forEach(t=>l.setLive(e,t,{stage:o,dirty:!1}))}ne(`Saved. Changed: ${(0,c.editedWords)(Ie)}.`),se(null),m()},$e=()=>{const t=ye?(0,o.blockAt)(U,e,q.date,xe):void 0,s=(0,c.editWarnings)(L,Ce,B,t,ke,K);!s.length||te?Se():se(s)},Pe=q.allergies??[],Oe=e=>pe({allergyNone:!1,allergies:Pe.some(t=>t.allergen===e)?Pe.filter(t=>t.allergen!==e):[...Pe,{allergen:e,severity:'allergy'}]}),We=(0,c.historyLines)(L);return(0,N.jsxs)(z.Sheet,{visible:!0,onClose:()=>{Ie.length?ee(!0):(ee(!1),m())},title:`Edit booking \xb7 ${L.name} \xb7 ${L.ref}`,maxWidth:760,testID:"edit-booking-sheet",onTypingDone:()=>{(0,C.hideKeyboard)(),Ie.length&&ye&&fe&&q.name.trim().length>=1&&$e()},typingDoneLabel:Ie.length?'Done, save changes':'Done, hide the keyboard',footer:(0,N.jsx)(z.Button,{label:te?'Save anyway':'Save changes',testID:"edit-save",disabled:!ye||!fe||q.name.trim().length<1||!Ie.length,onPress:$e,style:{minHeight:56,width:'100%'}}),children:[(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(w.DepositChip,{b:L,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(L)?(0,N.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,N.jsxs)(Y,{title:"Deposit",testID:"edit-section-deposit",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No deposit",selected:!q.depositOn,testID:"edit-deposit-none",onPress:()=>pe({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit due",selected:!!q.depositOn&&!q.depositPaid&&!q.depositWaived,testID:"edit-deposit-due",onPress:()=>pe({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit paid",selected:!!q.depositOn&&!!q.depositPaid,testID:"edit-deposit-paid",onPress:()=>{re||ce(oe),he||ue(F((0,D.ymd)(new Date))),pe({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsx)(z.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsxs)(z.T,{size:15,center:!0,colour:j.colours.goldLight,testID:"edit-deposit-waived-by",children:[L.depositWaived?.by?(0,O.waiverText)(L.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,q.depositWaived||Ie.includes('deposit')?null:(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(P.WaiveDepositButton,{b:L,who:b,onDone:e=>{const t={...q,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e};X(t),J(s=>s?{...s,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e}:t)}})}),q.depositOn?(0,N.jsx)(z.Field,{money:!0,label:"Deposit due (\xa3)",value:oe,onChangeText:e=>{de(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,q.depositOn&&q.depositPaid?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Field,{money:!0,label:"Amount paid (\xa3)",value:re,onChangeText:e=>{ce(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"How was it paid?"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,N.jsx)(z.Chip,{label:_(e),selected:q.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>pe({depositMethod:e})},e))}),(0,N.jsx)(z.Field,{label:"Date paid (DD/MM/YYYY)",value:he,onChangeText:e=>{ue((0,s.slashDate)(e,he)),pe({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),he.trim()&&!H(he)?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,fe?null:(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,N.jsx)(z.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,N.jsxs)(Y,{title:"When",testID:"edit-section-when",children:[(0,N.jsx)(k.BookingDatePicker,{r:V,today:new Date,value:q.date,onChange:e=>pe({date:e})}),(0,N.jsx)(I.TimeRoller,{testID:"edit-time",value:(0,f.snapTime)(q.time,me),onChange:e=>pe({time:e}),step:me}),ye?null:(0,N.jsx)(z.T,{size:15,colour:j.colours.amber,center:!0,children:"Choose a time on the roller."}),(0,N.jsx)(T.AdultsChildren,{value:(0,S.peopleOf)(q.partySize,q.children),onChange:e=>be(e),depositsOn:ge.on&&ge.perPersonPence>0,testID:"edit-people"}),(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:"Table time"}),(0,N.jsx)(z.Stepper,{testID:"edit-duration",value:q.duration||0,min:0,max:360,step:15,onChange:e=>pe({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,N.jsxs)(Y,{title:"Where",testID:"edit-section-where",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"Any area",selected:!q.area,testID:"edit-area-any",onPress:()=>pe({area:''})}),K.areas.map(e=>(0,N.jsx)(z.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:q.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>pe({area:e.name})},e.id))]}),(0,N.jsx)(z.T,{size:18,weight:"semibold",center:!0,children:(0,y.tableButtonLabel)(q.table)}),(0,y.splitChoices)(q.table).length?(0,N.jsxs)(n.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:"Split the joined tables"}),(0,N.jsx)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,y.splitChoices)(q.table).map(e=>(0,N.jsx)(z.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>pe({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:q.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(q.table?'':', chosen'),onPress:()=>pe({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),ve.map(e=>(0,N.jsx)(z.Button,{kind:e===q.table?'primary':'secondary',label:(0,y.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,y.tableButtonLabel)(e)}${e===q.table?', chosen':''}`,onPress:()=>pe({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,N.jsxs)(Y,{title:"Guest",testID:"edit-section-guest",children:[(0,N.jsx)(z.Field,{label:"Name",value:q.name,onChangeText:e=>pe({name:e}),testID:"edit-name"}),(0,N.jsx)(z.Field,{label:"Phone",value:q.phone,onChangeText:e=>pe({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,N.jsx)(z.Field,{label:"Email",value:q.email,onChangeText:e=>pe({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),we&&Te.marketingOptIn?(0,N.jsx)(z.Toggle,{label:Te.marketingWords,value:le,onChange:ae,testID:"edit-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,N.jsx)(z.T,{size:16,center:!0,children:"Booked by"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>pe({source:e.id})},e.id))}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(q.tags??[]).includes(e);return(0,N.jsx)(z.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>pe({tags:t?(q.tags??[]).filter(t=>t!==e):[...q.tags??[],e].sort()})},e)})})]}),(0,N.jsxs)(Y,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,N.jsx)(G,{label:"Dogs",value:q.dogs??0,max:6,onChange:e=>pe({dogs:e}),testID:"edit-dogs"}),(0,N.jsx)(G,{label:"High chairs",value:q.highChairs??0,max:10,onChange:e=>pe({highChairs:e}),testID:"edit-high-chairs"}),(0,N.jsx)(G,{label:"Wheelchair users",value:q.wheelchair??0,max:10,onChange:e=>pe({wheelchair:e}),testID:"edit-wheelchair"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"Occasion"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:(q.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>pe({occasion:e.id})},e.id||'none'))})]}),(0,N.jsxs)(Y,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No allergies",selected:!!q.allergyNone&&!Pe.length,testID:"edit-allergy-none",onPress:()=>pe({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,N.jsx)(z.Chip,{label:e.short,selected:Pe.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>Oe(e.id)},e.id))]}),Pe.map(e=>(0,N.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,N.jsxs)(z.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,N.jsx)(z.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>pe({allergies:Pe.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,N.jsx)(z.Field,{label:"Anything else about allergies",value:q.allergyNote,onChangeText:e=>pe({allergyNote:e}),testID:"edit-allergy-note"}),Ie.includes('allergies')&&Pe.length?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,N.jsx)(G,{label:"Vegan",value:q.vegan??0,max:q.partySize,onChange:e=>pe({vegan:e}),testID:"edit-vegan"}),(0,N.jsx)(G,{label:"Vegetarian",value:q.vegetarian??0,max:q.partySize,onChange:e=>pe({vegetarian:e}),testID:"edit-vegetarian"})]}),(q.holds??[]).length||(L.holds??[]).some(e=>e.qty>0&&!e.served)?(0,N.jsxs)(Y,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,N.jsx)(z.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(q.holds??[]).map(e=>{const t=(0,h.reservablesOf)(V),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),l=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,N.jsxs)(n.default,{testID:l,style:{gap:6,width:'100%'},children:[(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,N.jsx)(z.Stepper,{testID:l,value:e.qty,min:0,max:20,onChange:t=>pe({holds:(0,c.setEditableHoldQty)(q.holds??[],e.kind,e.id,t)}),label:i})]}),(0,N.jsx)(z.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${l}-remove`,onPress:()=>pe({holds:(0,c.removeEditableHold)(q.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(q.holds??[]).length?null:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==L.status?(0,N.jsxs)(Y,{title:"Status",testID:"edit-section-status",children:[(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>pe({status:e.id})},e.id))}),(0,N.jsx)(z.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,N.jsx)(Y,{title:"Notes",testID:"edit-section-notes",children:(0,N.jsx)(z.Field,{label:"Notes",value:q.notes,onChangeText:e=>pe({notes:e}),placeholder:Te.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),te?(0,N.jsxs)(n.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[te.map(e=>(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,ie?(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:ie}):null,Z?(0,N.jsxs)(n.default,{testID:"edit-discard-warn",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:j.colours.gold,backgroundColor:j.colours.surface2},children:[(0,N.jsx)(z.T,{size:20,weight:"bold",center:!0,children:"Discard unsaved changes?"}),(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.muted,children:"Your changes have not been saved."}),(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:"secondary",label:"Keep editing",testID:"edit-discard-keep",onPress:()=>ee(!1),style:{minHeight:52,flex:1}}),(0,N.jsx)(z.Button,{kind:"danger",label:"Discard changes",testID:"edit-discard-discard",onPress:()=>{ee(!1),m()},style:{minHeight:52,flex:1}})]})]}):null,We.length?(0,N.jsx)(Y,{title:"Changes",testID:"edit-history",children:We.slice(0,12).map((e,t)=>(0,N.jsx)(z.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,N.jsx)(W.CancelBookingButton,{rid:e,b:L,name:L.name,big:!0,onDone:()=>m()}),(0,N.jsx)(W.ReinstateBookingButton,{b:L,name:L.name,today:(0,D.ymd)(new Date),onDone:()=>m()})]})}},1119,[17,1031,85,858,996,993,860,856,1120,1053,1077,845,920,876,994,1090,804,863,1103,1121,815,1122,1104,1087,1099,1100,1101,1123,841,1115,777,840,8]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedDraftFields=W,_e.changedFields=j,_e.historyText=E,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=j(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:E(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${D(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!j(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return x}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: high chair, birthday, quiet table',o='This booking is on the website too. Saving here updates the website booking. The website may email the guest about a new date, time or status.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],u=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],h=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],k=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),w=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return w(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){return l.filter(i=>M(i,e)!==M(i,t))}function j(e,t){return W(y(e),t)}const A=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,D=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function E(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${A(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=k(o.holds),i=k(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${D(s)}`}const x=e=>e.map(e=>f[e]).join(', ')},1120,[1053,1098,1090,1094]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedDraftFields=W,_e.changedFields=j,_e.historyText=E,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=j(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:E(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${D(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!j(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return x}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: high chair, birthday, quiet table',o='This booking is on the website too. Saving here updates the website booking. The website may email the guest about a new date, time or status.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],u=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],h=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],k=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),w=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return w(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){return l.filter(i=>M(i,e)!==M(i,t))}function j(e,t){return W(y(e),t)}const A=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,D=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function E(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${A(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=k(o.holds),i=k(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${D(s)}`}const x=e=>e.map(e=>f[e]).join(', ')},1112,[1053,1098,1090,1094]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FinishConfirm=I,_e.RestoreSeatedConfirm=function({prompt:e,onYes:t,onNo:n}){return(0,k.jsxs)(s.default,{testID:"restore-seated-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:"Yes, seat them",testID:"restore-seated-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"restore-seated-no",onPress:n,style:w})]})},Object.defineProperty(_e,"finishBookingNow",{enumerable:!0,get:function(){return p.finishBookingNow}}),_e.undoFinishedNow=D,_e.restoreFinishedToTable=async function(e,t,s){const o=(0,b.tableKey)(s);await n.repo.bookings.update(t.id,{...(0,f.tablePatch)(o||null),status:'seated',finishedAt:void 0,lastTable:void 0}),o&&(0,p.resetTableLive)(e,o)},_e.offerFinishUndo=F,_e.finishAndOfferUndo=v,_e.finishUnseatedAndOfferUndo=N,_e.FinishButton=function({rid:e,b:s,name:n,allowed:o=!0,hint:c,small:b,bigToast:f,testID:u,label:h="Finished",a11y:p,kind:D="secondary"}){const[F,j]=t.default.useState(!1);if(!o)return null;const x=(0,l.finishConfirmPrompt)({name:n,table:s.table,seatedAt:s.seatedAt,now:new Date,seated:'seated'===s.status});if(F)return(0,k.jsx)(I,{prompt:x,onNo:()=>j(!1),onYes:()=>{j(!1),'seated'===s.status?v(e,[s],n,{big:f,table:s.table}):N(e,s,n,{big:f})}});return(0,k.jsx)(y.Button,{small:b,kind:D,label:h,testID:u,accessibilityLabel:p??`${h}: ${n}`,accessibilityHint:c,disabled:!o,onPress:()=>j(!0),style:b?void 0:w})};var t=e(r(d[0])),s=e(r(d[1])),n=r(d[2]),o=r(d[3]),l=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),u=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]);const w={minHeight:64};function I({prompt:e,onYes:t,onNo:n,yesLabel:o="Yes, finish"}){return(0,k.jsxs)(s.default,{testID:"finish-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:o,testID:"finish-confirm-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"finish-confirm-no",onPress:n,style:w})]})}async function D(e,t,s){const c=(0,l.tableForUndo)(t,s);await n.repo.bookings.update(t.id,(0,l.finishUndoPatch)(c)),c&&(0,o.tablesOf)(c).forEach(t=>o.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function F(e){const t=e.bookings[0];if(!t)return;const s=e.bookings.length>1?`${e.bookings.length} parties finished.`:`${e.name} finished.`,n=e.table?`${(0,c.tableWords)(e.table).replace(/^t/,'T')} needs clearing.`:void 0,o=`finish-undo-${t.id}`;(0,u.notify)({id:o,title:s,body:n,timeoutMs:l.FINISH_UNDO_MS,big:e.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{for(const t of e.bookings)await D(e.rid,{...t,table:void 0,lastTable:t.table||t.lastTable});(0,u.dismissNotice)(o)})()}}]})}async function v(e,t,s,n){const o=n?.table??t.find(e=>e.table)?.table;for(const s of t)await(0,p.finishBookingNow)(e,s);F({rid:e,bookings:t,name:s,table:o,big:n?.big})}async function N(e,t,s,o){await n.repo.bookings.setStatus(t.id,'finished');const c=`finish-undo-${t.id}`;(0,u.notify)({id:c,title:`${s} finished.`,timeoutMs:l.FINISH_UNDO_MS,big:o?.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{await n.repo.bookings.setStatus(t.id,t.walkIn?'cancelled':'confirmed'),(0,u.dismissNotice)(c)})()}}]})}},1113,[17,85,858,996,1111,1114,1094,1090,916,804,777,1096,8]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return s.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return c}}),e.freeTablesNow=function(t,a,s=!1){const l=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),n=l.filter(([,t])=>t.table.maxSeats>=a),o=t=>t.map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}));return s?[...o(n),...o(l.filter(([,t])=>t.table.maxSeatsh[t]&&(l.includes(h[t].status)||'dirty'===h[t].status||'blocked'===h[t].status));if(p.length&&p.every(t=>h[t])&&!t.length)f.push({id:'seat',label:`Seat at ${b(s.table).replace(/^t/,'T')}`,a11y:`Seat ${n}, ${u(s.partySize)}, at ${b(s.table)}`,table:s.table});else if(c(s,$)){const a=p.length?t.length?`${b(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===h[t[0]].status?'waiting to be cleared':'blocked'===h[t[0]].status?'blocked':'in use'}`:`${b(s.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';f.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${n}, ${u(s.partySize)}. ${a}.`,note:a})}c(s,$)&&f.push({id:'finished',label:'Finished',a11y:`Finished, ${n}, ${s.time} booking, without seating at a table`}),o($,s)<=0&&f.push({id:'noshow',label:'No-show',a11y:`No-show, ${n}, ${s.time} booking`})}return f.push({id:'details',label:'Guest details',a11y:`Guest details, ${n}`}),f};var t=r(d[0]),a=r(d[1]),s=r(d[2]);const l=['seated','mains','dessert','bill'],n=t=>new Date(`${t.date}T${t.time}:00`),o=(t,a)=>(n(a).getTime()-t.getTime())/6e4,b=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},u=t=>`${t} ${1===t?'person':'people'}`,c=(t,a)=>o(a,t)<=45},1114,[996,863,1074]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return x}}),_e.cancelWalkInWords=I,_e.reinstateWalkInWords=$,_e.cancelWalkInNow=j,_e.reinstateWalkInNow=C,_e.CancelWalkInButton=function({rid:e,b:t,onDone:o,small:c,big:u}){const[b,f]=(0,n.useState)(!1),k=(0,l.useInStaffApp)(),x=(0,s.useSeatClearFinish)();return p(t)?k&&!x.ok?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(w.Button,{kind:"secondary",small:c,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>f(!0),style:u?{minHeight:64}:c?{minHeight:44}:h}),b?(0,y.jsx)(W,{rid:e,b:t,onClose:()=>f(!1),onDone:o}):null]}):null},_e.CancelWalkInConfirm=W,_e.ReinstateWalkInButton=function({rid:e,b:t,today:o,onDone:u,small:b}){const[f,p]=(0,n.useState)(!1),I=(0,l.useInStaffApp)(),j=(0,s.useSeatClearFinish)();if(!x(t,o))return null;if(I&&!j.ok)return null;const W=$(t);if(!f)return(0,y.jsx)(w.Button,{kind:"ghost",small:b,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>p(!0),style:b?{minHeight:44}:h});return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:()=>p(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:W,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:W})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[h,{flexGrow:1}],onPress:async()=>{await C(e,t),p(!1),u?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>p(!1),style:h})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]),o=r(d[4]),c=(e=o)&&e.__esModule?e:{default:e},u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]),w=r(d[9]),y=r(d[10]);const h={minHeight:56},p=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),x=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function I(e){const t=(0,b.tablesOf)(e.table),n=(0,f.tablesWords)(t);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${t.length?` at ${n}`:''}, arrived ${e.time}? It comes off the Covers${t.length?` and ${n} ${t.length>1?'go':'goes'} back to Free`:''}.`}function $(e){return`Put walk-in ${e.ref} back to seated? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`}async function j(e,n){await u.repo.bookings.setStatus(n.id,'cancelled'),await u.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,b.tablesOf)(n.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function C(e,t){await u.repo.bookings.setStatus(t.id,'seated'),(0,b.tablesOf)(t.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function W({rid:e,b:t,onClose:n,onDone:l}){const s=I(t);return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:s,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:s})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[h,{flexGrow:1}],onPress:async()=>{await j(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,b.tablesOf)(t.table).length?` ${(0,f.tablesWords)((0,b.tablesOf)(t.table))} free.`:''}`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:h})]})]})}},1115,[1116,17,1055,1118,85,858,996,1094,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.cancelStamp=C,_e.cancelBookingNow=w,_e.reinstateBookingNow=$,_e.CancelBookingButton=function({rid:e,b:n,name:o,onDone:s,big:l,small:c}){const[u,f]=(0,t.useState)(!1);return(0,b.canCancelBooking)(n)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(x.Button,{kind:"secondary",small:c,label:"Cancel booking",testID:`cancel-booking-${n.id}`,accessibilityLabel:`Cancel booking for ${o}, ${n.time}, ${n.partySize} Covers`,onPress:()=>f(!0),style:l?{minHeight:64}:c?{minHeight:44}:j}),u?(0,h.jsx)(D,{rid:e,b:n,name:o,onClose:()=>f(!1),onDone:s}):null]}):null},_e.CancelBookingConfirm=D,_e.ReinstateBookingButton=function({b:e,name:n,today:s,onDone:l}){const[c,u]=(0,t.useState)(!1);if(!(0,b.canReinstateBooking)(e,s))return null;const y=(0,b.reinstateBookingWords)(e,n);if(!c)return(0,h.jsx)(x.Button,{kind:"ghost",label:"Undo cancel",testID:`reinstate-booking-${e.id}`,accessibilityLabel:`Undo cancel for ${n}`,onPress:()=>u(!0),style:j});return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:()=>u(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center'},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, put back to booked",testID:"reinstate-booking-yes",accessibilityLabel:`Yes, put ${n} back to booked`,style:[j,{flexGrow:1}],onPress:async()=>{await $(e),u(!1),l?.(`${n} put back to booked.`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-booking-no",onPress:()=>u(!1),style:j})]})]})};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]),c=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]),y=r(d[8]),k=r(d[9]),p=r(d[10]),x=r(d[11]),h=r(d[12]);const j={minHeight:56},B={display:'Display',owner:'Managers app',staff:'Staff app',chef:'Kitchen app',customer:'Customer page'};function C(e){const t=y.useSession.getState().meId,n=t?k.useOwner.getState().staff.find(e=>e.id===t):void 0,o=B[p.APP_VARIANT]??'CoverCharge';return{by:n?`${n.name.replace(' (example)','')} (${o})`:o,at:(new Date).toISOString(),app:o,...e.table?{table:e.table}:{}}}async function w(e,t){const n=(0,l.tablesOf)(t.table);await s.repo.bookings.update(t.id,{status:'cancelled',cancelled:C(t),...(0,c.tablePatch)(null)}),n.forEach(t=>l.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function $(e){await s.repo.bookings.setStatus(e.id,'confirmed')}function D({rid:e,b:t,name:n,onClose:s,onDone:c}){const y=(0,b.cancelBookingWords)(t,n),k=(0,l.tablesOf)(t.table);return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:s,title:"Cancel booking?",maxWidth:560,testID:"cancel-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center',gap:8},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, cancel booking",testID:"cancel-booking-yes",accessibilityLabel:`Yes, cancel booking for ${n}`,style:[j,{flexGrow:1}],onPress:async()=>{await w(e,t),s(),c?.(`${n} cancelled.${k.length?` ${(0,u.tablesWords)(k)} free.`:''}`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep booking",testID:"cancel-booking-no",accessibilityLabel:`Keep booking for ${n}`,onPress:s,style:j})]})]})}},1116,[17,85,858,996,1090,1117,1094,804,920,876,856,777,8]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canCancelBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canReinstateBooking",{enumerable:!0,get:function(){return t}}),e.cancelBookingWords=function(n,t){const o=`${n.partySize} Cover${1===n.partySize?'':'s'}`;return`Cancel booking for ${t}, ${n.time}, ${o}? The table is freed. Website bookings will cancel it on the website and may email the guest.`},e.reinstateBookingWords=function(n,t){return`Put ${t} back to booked for ${n.time}? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`},e.cancelledOnDay=o,e.cancelledDayTally=function(n,t){const a=o(n,t),l=a.filter(n=>!!n.walkIn),c=a.filter(n=>!n.walkIn);return{count:a.length,covers:a.reduce((n,t)=>n+t.partySize,0),bookings:c.length,bookingCovers:c.reduce((n,t)=>n+t.partySize,0),walkIns:l.length,walkInCovers:l.reduce((n,t)=>n+t.partySize,0),list:a}},e.cancelledTallyWords=function(n,t="today"){if(!n.count)return`No cancellations ${t}`;const o=[],a=n.bookings??0,l=n.walkIns??0;a&&o.push(`${a} booking${1===a?'':'s'} (${n.bookingCovers??0} Cover${1===(n.bookingCovers??0)?'':'s'})`);l&&o.push(`${l} walk-in${1===l?'':'s'} (${n.walkInCovers??0} Cover${1===(n.walkInCovers??0)?'':'s'})`);if(!o.length)return`Cancelled ${t}: ${n.count} \xb7 ${n.covers} Cover${1===n.covers?'':'s'}`;return`Cancelled ${t}: ${o.join(' \xb7 ')}`};const n=n=>!n.walkIn&&('confirmed'===n.status||'pending'===n.status||'seated'===n.status),t=(n,t)=>!n.walkIn&&'cancelled'===n.status&&n.date>=t;function o(n,t){return n.filter(n=>n.date===t&&'cancelled'===n.status).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name))}},1117,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSeatClearFinish=function(){const t=(0,A.useSignedIn)(),o=(0,A.useInStaffApp)(),_='staff'===s.APP_VARIANT||'chef'===s.APP_VARIANT||o,l=(0,c.canSeatClearFinish)({device:s.IS_CAR||'display'===s.APP_VARIANT||!_&&!t,viaDisplay:(0,n.isKitchenViaDisplay)(),role:t?.role,ownerAccess:t?.ownerAccess,managerAccess:t?.managerAccess});return{ok:l,hint:l?void 0:c.SEAT_CLEAR_HINT}};var s=r(d[0]),n=r(d[1]),c=r(d[2]),A=r(d[3])},1118,[856,922,1119,1055]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEAT_CLEAR_HINT",{enumerable:!0,get:function(){return n}}),e.canSeatClearFinish=function(n){return!(!n.device&&!n.viaDisplay)||('owner'===n.role||'manager'===n.role||!(!n.ownerAccess&&!n.managerAccess))};const n='Ask a manager to seat, finish or clear a table.'},1119,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:s,who:i,role:n,inStaffApp:l,shiftManager:a,big:o,testID:d}){const[h,u]=(0,t.useState)(!1),p=(0,b.useSession)(e=>e.meId),y=(0,m.useOwner)(e=>e.staff.find(e=>e.id===p&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:l,role:n,shiftManager:a})||p&&!(0,x.canChangeBookings)(y)?null:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:d??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),h?(0,N.jsx)(V,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:n,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,l.useBookings)(e).filter(e=>!e.walkIn&&e.date>=s&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,200);return o?(0,N.jsx)(V,{rid:e,id:o,who:i,hidePrivate:a,onClose:n}):(0,N.jsxs)(z.Sheet,{visible:!0,onClose:n,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,N.jsx)(z.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${L(e.date,s)} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${L(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,N.jsx)(z.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,N.jsx)(z.Button,{kind:"ghost",label:"Close",onPress:n,style:{minHeight:44}})]})},_e.EditBookingSheet=V;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=(e=i)&&e.__esModule?e:{default:e},l=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),f=_r(_d[19]),C=_r(_d[20]),I=_r(_d[21]),k=_r(_d[22]),w=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),O=_r(_d[28]),W=_r(_d[29]),z=_r(_d[30]),B=_r(_d[31]),N=_r(_d[32]);const E=/^([01]\d|2[0-3]):[0-5]\d$/,R=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const L=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,D.ymd)(s)?'Tomorrow':F(e)};const A=e=>e?(e/100).toFixed(e%100?2:0):'',M=e=>{const t=(0,B.parseMoneyInput)(e);return null!=t&&t>=0?Math.round(100*t):NaN},F=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',H=e=>{const t=e.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);return t?`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`:''},_=e=>e.charAt(0).toUpperCase()+e.slice(1);function Y({title:e,children:t,testID:s}){return(0,N.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,N.jsx)(z.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const G=({label:e,value:t,onChange:s,max:i=20,testID:n})=>(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:e}),(0,N.jsx)(z.Stepper,{testID:n,value:t,min:0,max:i,onChange:s,label:e})]});function V({rid:e,id:i,who:b,onClose:m,hidePrivate:x=!1}){(0,$.useBlurOutside)();const B=(0,l.useBookings)(e),L=B.find(e=>e.id===i),V=(0,d.useRestaurant)(e),K=(0,a.usePlan)(e),U=(0,o.useBlocks)(e=>e.blocks),[q,X]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Q,J]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Z,ee]=(0,t.useState)(!1),[te,se]=(0,t.useState)(null),[ie,ne]=(0,t.useState)(null),[le,ae]=(0,t.useState)(!1),[oe,de]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositDue:0)),[re,ce]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositAmount:0)),[he,ue]=(0,t.useState)(F(L?(0,c.draftOf)(L).depositDate:''));if(!L||!q||!V)return null;const pe=e=>{se(null),ne(null),X({...q,...e})},ge=(0,O.depositOf)(V.settings),be=e=>{const t=e.partySize??q.partySize,s=Math.min(e.children??q.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(L)&&q.depositOn&&!q.depositPaid&&M(oe||'0')===(0,O.depositDue)(ge,q.partySize,q.children??0)){const e=(0,O.depositDue)(ge,t,s);e>0&&de(A(e))}pe({...e,children:s})},me=(0,v.bookingSlotMinutesOf)(V),xe=R(q.time),ye=E.test(xe),je=q.area?K.areas.filter(e=>e.name===q.area).map(e=>e.id):null,De=e=>!je||e.split('+').every(e=>je.includes(K.tables.find(t=>t.name===e)?.areaId??'')),ve=(0,y.tableOptions)(K,B.filter(e=>e.date===q.date),q.table).filter(e=>De(e)||e===q.table),fe=!(q.depositOn&&(Number.isNaN(M(oe||'0'))||q.depositPaid&&(Number.isNaN(M(re||'0'))||he.trim()&&!H(he)))),Ce={...q,time:xe,depositDue:M(oe||'0')||0,depositAmount:M(re||'0')||0,depositDate:H(he)},Ie=(0,c.changedDraftFields)(Q??(0,c.draftOf)(L),Ce),ke=V.settings.turnMins??90,we=!!q?.email?.trim()&&q.email.trim()!==(L?.email??'').trim(),Te=(0,u.bookingRulesOf)(V),Se=async()=>{const t=(0,c.editPatch)(L,Ce,{by:b||'Team member',app:r.APP_VARIANT});if(le&&we&&Object.assign(t,(0,u.marketingChoice)(Ce.email,!0)),Object.keys(t).length&&await l.repo.bookings.update(L.id,t),'seated'===L.status&&'table'in t&&t.table!==L.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(L.table),n=s(t.table),l=a.useFloor.getState(),o=i.map(t=>l.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!n.includes(e)).forEach(t=>l.setLive(e,t,{stage:void 0,dirty:!0})),n.forEach(t=>l.setLive(e,t,{stage:o,dirty:!1}))}ne(`Saved. Changed: ${(0,c.editedWords)(Ie)}.`),se(null),m()},$e=()=>{const t=ye?(0,o.blockAt)(U,e,q.date,xe):void 0,s=(0,c.editWarnings)(L,Ce,B,t,ke,K);!s.length||te?Se():se(s)},Pe=q.allergies??[],Oe=e=>pe({allergyNone:!1,allergies:Pe.some(t=>t.allergen===e)?Pe.filter(t=>t.allergen!==e):[...Pe,{allergen:e,severity:'allergy'}]}),We=(0,c.historyLines)(L);return(0,N.jsxs)(z.Sheet,{visible:!0,onClose:()=>{Ie.length?ee(!0):(ee(!1),m())},title:`Edit booking \xb7 ${L.name} \xb7 ${L.ref}`,maxWidth:760,testID:"edit-booking-sheet",onTypingDone:()=>{(0,C.hideKeyboard)(),Ie.length&&ye&&fe&&q.name.trim().length>=1&&$e()},typingDoneLabel:Ie.length?'Done, save changes':'Done, hide the keyboard',footer:(0,N.jsx)(z.Button,{label:te?'Save anyway':'Save changes',testID:"edit-save",disabled:!ye||!fe||q.name.trim().length<1||!Ie.length,onPress:$e,style:{minHeight:56,width:'100%'}}),children:[(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(w.DepositChip,{b:L,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(L)?(0,N.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,N.jsxs)(Y,{title:"Deposit",testID:"edit-section-deposit",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No deposit",selected:!q.depositOn,testID:"edit-deposit-none",onPress:()=>pe({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit due",selected:!!q.depositOn&&!q.depositPaid&&!q.depositWaived,testID:"edit-deposit-due",onPress:()=>pe({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit paid",selected:!!q.depositOn&&!!q.depositPaid,testID:"edit-deposit-paid",onPress:()=>{re||ce(oe),he||ue(F((0,D.ymd)(new Date))),pe({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsx)(z.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsxs)(z.T,{size:15,center:!0,colour:j.colours.goldLight,testID:"edit-deposit-waived-by",children:[L.depositWaived?.by?(0,O.waiverText)(L.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,q.depositWaived||Ie.includes('deposit')?null:(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(P.WaiveDepositButton,{b:L,who:b,onDone:e=>{const t={...q,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e};X(t),J(s=>s?{...s,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e}:t)}})}),q.depositOn?(0,N.jsx)(z.Field,{money:!0,label:"Deposit due (\xa3)",value:oe,onChangeText:e=>{de(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,q.depositOn&&q.depositPaid?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Field,{money:!0,label:"Amount paid (\xa3)",value:re,onChangeText:e=>{ce(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"How was it paid?"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,N.jsx)(z.Chip,{label:_(e),selected:q.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>pe({depositMethod:e})},e))}),(0,N.jsx)(z.Field,{label:"Date paid (DD/MM/YYYY)",value:he,onChangeText:e=>{ue((0,s.slashDate)(e,he)),pe({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),he.trim()&&!H(he)?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,fe?null:(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,N.jsx)(z.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,N.jsxs)(Y,{title:"When",testID:"edit-section-when",children:[(0,N.jsx)(k.BookingDatePicker,{r:V,today:new Date,value:q.date,onChange:e=>pe({date:e})}),(0,N.jsx)(I.TimeRoller,{testID:"edit-time",value:(0,f.snapTime)(q.time,me),onChange:e=>pe({time:e}),step:me}),ye?null:(0,N.jsx)(z.T,{size:15,colour:j.colours.amber,center:!0,children:"Choose a time on the roller."}),(0,N.jsx)(T.AdultsChildren,{value:(0,S.peopleOf)(q.partySize,q.children),onChange:e=>be(e),depositsOn:ge.on&&ge.perPersonPence>0,testID:"edit-people"}),(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:"Table time"}),(0,N.jsx)(z.Stepper,{testID:"edit-duration",value:q.duration||0,min:0,max:360,step:15,onChange:e=>pe({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,N.jsxs)(Y,{title:"Where",testID:"edit-section-where",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"Any area",selected:!q.area,testID:"edit-area-any",onPress:()=>pe({area:''})}),K.areas.map(e=>(0,N.jsx)(z.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:q.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>pe({area:e.name})},e.id))]}),(0,N.jsx)(z.T,{size:18,weight:"semibold",center:!0,children:(0,y.tableButtonLabel)(q.table)}),(0,y.splitChoices)(q.table).length?(0,N.jsxs)(n.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:"Split the joined tables"}),(0,N.jsx)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,y.splitChoices)(q.table).map(e=>(0,N.jsx)(z.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>pe({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:q.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(q.table?'':', chosen'),onPress:()=>pe({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),ve.map(e=>(0,N.jsx)(z.Button,{kind:e===q.table?'primary':'secondary',label:(0,y.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,y.tableButtonLabel)(e)}${e===q.table?', chosen':''}`,onPress:()=>pe({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,N.jsxs)(Y,{title:"Guest",testID:"edit-section-guest",children:[(0,N.jsx)(z.Field,{label:"Name",value:q.name,onChangeText:e=>pe({name:e}),testID:"edit-name"}),(0,N.jsx)(z.Field,{label:"Phone",value:q.phone,onChangeText:e=>pe({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,N.jsx)(z.Field,{label:"Email",value:q.email,onChangeText:e=>pe({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),we&&Te.marketingOptIn?(0,N.jsx)(z.Toggle,{label:Te.marketingWords,value:le,onChange:ae,testID:"edit-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,N.jsx)(z.T,{size:16,center:!0,children:"Booked by"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>pe({source:e.id})},e.id))}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(q.tags??[]).includes(e);return(0,N.jsx)(z.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>pe({tags:t?(q.tags??[]).filter(t=>t!==e):[...q.tags??[],e].sort()})},e)})})]}),(0,N.jsxs)(Y,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,N.jsx)(G,{label:"Dogs",value:q.dogs??0,max:6,onChange:e=>pe({dogs:e}),testID:"edit-dogs"}),(0,N.jsx)(G,{label:"High chairs",value:q.highChairs??0,max:10,onChange:e=>pe({highChairs:e}),testID:"edit-high-chairs"}),(0,N.jsx)(G,{label:"Wheelchair users",value:q.wheelchair??0,max:10,onChange:e=>pe({wheelchair:e}),testID:"edit-wheelchair"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"Occasion"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:(q.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>pe({occasion:e.id})},e.id||'none'))})]}),(0,N.jsxs)(Y,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No allergies",selected:!!q.allergyNone&&!Pe.length,testID:"edit-allergy-none",onPress:()=>pe({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,N.jsx)(z.Chip,{label:e.short,selected:Pe.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>Oe(e.id)},e.id))]}),Pe.map(e=>(0,N.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,N.jsxs)(z.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,N.jsx)(z.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>pe({allergies:Pe.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,N.jsx)(z.Field,{label:"Anything else about allergies",value:q.allergyNote,onChangeText:e=>pe({allergyNote:e}),testID:"edit-allergy-note"}),Ie.includes('allergies')&&Pe.length?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,N.jsx)(G,{label:"Vegan",value:q.vegan??0,max:q.partySize,onChange:e=>pe({vegan:e}),testID:"edit-vegan"}),(0,N.jsx)(G,{label:"Vegetarian",value:q.vegetarian??0,max:q.partySize,onChange:e=>pe({vegetarian:e}),testID:"edit-vegetarian"})]}),(q.holds??[]).length||(L.holds??[]).some(e=>e.qty>0&&!e.served)?(0,N.jsxs)(Y,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,N.jsx)(z.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(q.holds??[]).map(e=>{const t=(0,h.reservablesOf)(V),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),l=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,N.jsxs)(n.default,{testID:l,style:{gap:6,width:'100%'},children:[(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,N.jsx)(z.Stepper,{testID:l,value:e.qty,min:0,max:20,onChange:t=>pe({holds:(0,c.setEditableHoldQty)(q.holds??[],e.kind,e.id,t)}),label:i})]}),(0,N.jsx)(z.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${l}-remove`,onPress:()=>pe({holds:(0,c.removeEditableHold)(q.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(q.holds??[]).length?null:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==L.status?(0,N.jsxs)(Y,{title:"Status",testID:"edit-section-status",children:[(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>pe({status:e.id})},e.id))}),(0,N.jsx)(z.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,N.jsx)(Y,{title:"Notes",testID:"edit-section-notes",children:(0,N.jsx)(z.Field,{label:"Notes",value:q.notes,onChangeText:e=>pe({notes:e}),placeholder:Te.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),te?(0,N.jsxs)(n.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[te.map(e=>(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,ie?(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:ie}):null,Z?(0,N.jsxs)(n.default,{testID:"edit-discard-warn",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:j.colours.gold,backgroundColor:j.colours.surface2},children:[(0,N.jsx)(z.T,{size:20,weight:"bold",center:!0,children:"Discard unsaved changes?"}),(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.muted,children:"Your changes have not been saved."}),(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:"secondary",label:"Keep editing",testID:"edit-discard-keep",onPress:()=>ee(!1),style:{minHeight:52,flex:1}}),(0,N.jsx)(z.Button,{kind:"danger",label:"Discard changes",testID:"edit-discard-discard",onPress:()=>{ee(!1),m()},style:{minHeight:52,flex:1}})]})]}):null,We.length?(0,N.jsx)(Y,{title:"Changes",testID:"edit-history",children:We.slice(0,12).map((e,t)=>(0,N.jsx)(z.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,N.jsx)(W.CancelBookingButton,{rid:e,b:L,name:L.name,big:!0,onDone:()=>m()}),(0,N.jsx)(W.ReinstateBookingButton,{b:L,name:L.name,today:(0,D.ymd)(new Date),onDone:()=>m()})]})}},1120,[17,1031,85,858,996,993,860,856,1112,1053,1077,845,920,876,994,1090,804,863,1103,1121,815,1122,1104,1087,1099,1100,1101,1123,841,1116,777,840,8]); __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.hmToMins=n,e.minsToHm=o,e.snapTime=u,e.hourValues=function(){return Array.from({length:24},(t,n)=>n)},e.minuteValues=function(t){const n=t>0&&t<=60&&60%t==0?t:15,o=[];for(let t=0;t<60;t+=n)o.push(t);return o},e.splitHm=function(o){const i=n(t.test(o)?o:u(o,15));return Number.isFinite(i)?{hour:Math.floor(i/60),minute:i%60}:{hour:12,minute:0}},e.joinHm=function(t,n){const o=(n%60+60)%60;return`${String((t%24+24)%24).padStart(2,'0')}:${String(o).padStart(2,'0')}`},e.timeRollerHint=function(t){return`24-hour. Times are every ${t>0?t:15} minutes. Roll or swipe each wheel. No typing.`};const t=/^([01]\d|2[0-3]):[0-5]\d$/;function n(t){const n=t.trim().match(/^(\d{1,2}):(\d{2})$/);if(!n)return NaN;const o=Number(n[1]),u=Number(n[2]);return o>23||u>59?NaN:60*o+u}function o(t){const n=(Math.round(t)%1440+1440)%1440,o=Math.floor(n/60),u=n%60;return`${String(o).padStart(2,'0')}:${String(u).padStart(2,'0')}`}function u(t,u){const i=u>0&&u<=60&&60%u==0?u:15,s=n(t),c=Number.isFinite(s)?s:720;return o(Math.round(c/i)*i)}},1121,[]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TimeRoller=function({value:e,onChange:t,step:n=15,testID:u="time-roller"}){const{hour:h,minute:m}=(0,s.splitHm)(e),f=(0,s.hourValues)(),x=(0,s.minuteValues)(n),p=f.indexOf(h),y=x.reduce((e,t)=>Math.abs(t-m)t((0,s.joinHm)(f[e],y)),label:"Hours",format:e=>String(e).padStart(2,'0'),testID:`${u}-hours`}),(0,c.jsx)(b,{values:x,index:j<0?0:j,onChange:e=>t((0,s.joinHm)(h,x[e])),label:"Minutes",format:e=>String(e).padStart(2,'0'),testID:`${u}-minutes`})]})]}),(0,c.jsx)(l.T,{size:13,center:!0,colour:o.colours.muted,children:(0,s.timeRollerHint)(n)})]})};var t=r(_d[0]),n=e(r(_d[1])),i=e(r(_d[2])),o=r(_d[3]),s=r(_d[4]),l=r(_d[5]),c=r(_d[6]);const d=48,u=5,h=2;function m(e,t){return(e%t+t)%t}function b({values:e,index:s,onChange:b,label:f,format:x,testID:p}){const y=(0,t.useRef)(null),j=(0,t.useRef)(0),v=e.length,w=e[m(s,v)],R=`${x(w)} ${f.toLowerCase()}`,S=e=>b(m(s+e,v)),T=()=>{y.current=null,j.current=0};return(0,c.jsx)(i.default,{testID:p,accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:f,accessibilityValue:{min:e[0],max:e[v-1],now:w,text:R},accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{'increment'===e.nativeEvent.actionName&&S(1),'decrement'===e.nativeEvent.actionName&&S(-1)},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{y.current=e.nativeEvent.pageY,j.current=0},onResponderMove:e=>{if(null==y.current)return;const t=e.nativeEvent.pageY-y.current;for(y.current=e.nativeEvent.pageY,j.current+=t;j.current<=-24;)S(1),j.current+=d;for(;j.current>=24;)S(-1),j.current-=d},onResponderRelease:T,onResponderTerminate:T,style:{width:120,height:240,alignItems:'center'},children:Array.from({length:u},(t,i)=>{const u=i-h,b=e[m(s+u,v)],f=0===u,p=2===Math.abs(u);return(0,c.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",onPress:()=>{u&&S(u)},style:{height:d,width:'100%',alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:f?28:p?18:22,weight:f?'bold':'medium',colour:f?o.colours.goldLight:o.colours.muted,center:!0,style:{opacity:f?1:p?.35:.7},children:x(b)})},`${i}-${b}`)})})}},1122,[17,385,85,804,1121,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1123,[17,85,858,856,1120,841,1095,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1123,[17,85,858,856,1112,841,1095,804,777,8]); __d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingHistory=function({rid:e,today:t}){const[b,k]=(0,s.useState)((0,n.addDaysIso)(t,-1)),[w,v]=(0,s.useState)('day'),[p,f]=(0,s.useState)((0,n.ddmmyyyy)((0,n.addDaysIso)(t,-1))),[D,$]=(0,s.useState)(!1),[_,I]=(0,s.useState)(0),T=(0,n.historyRange)(w,b,t),C=(0,c.useKitchenHistory)(e,T.from,T.to,t,_),P=(0,d.parseHistoryInput)(p),B=!!P&&(0,d.validPastDate)(P,t),L=e=>{(0,d.validPastDate)(e,t)&&(k(e),f((0,n.ddmmyyyy)(e)))};if(!C.allowed)return(0,h.jsx)(l.Card,{children:(0,h.jsx)(l.T,{size:20,center:!0,children:"Booking history is for the Head Chef and managers. Sign in to the Head Chef app to see it."})});const z='day'===w?1:7,S=(0,n.addDaysIso)('day'===w?b:(0,n.mondayOf)(b),-z),R='day'===w?(0,n.addDaysIso)(b,1):(0,n.addDaysIso)((0,n.mondayOf)(b),7),W='day'===w?'day':'week';return(0,h.jsxs)(o.default,{style:{gap:14},testID:"booking-history",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:12,alignItems:'stretch'},children:[(0,h.jsx)(l.T,{size:18,center:!0,children:"Bookings, covers and walk-ins on past days. Read-only; nothing is changed."}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:'day'===w?'primary':'secondary',testID:"bh-mode-day",label:"One day",accessibilityLabel:"Show one day"+('day'===w?', selected':''),onPress:()=>v('day')}),(0,h.jsx)(l.Button,{kind:'week'===w?'primary':'secondary',testID:"bh-mode-week",label:"Whole week",accessibilityLabel:"Show the whole week, Monday to Sunday"+('week'===w?', selected':''),onPress:()=>v('week')})]}),(0,h.jsx)(l.Field,{label:"Past date (DD/MM/YYYY)",value:p,onChangeText:e=>f((0,i.slashDate)(e,p)),placeholder:"09/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Past date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"bh-date",style:{textAlign:'center'}}),B?null:(0,h.jsx)(l.T,{size:16,center:!0,testID:"bh-date-hint",children:"Enter a past date as DD/MM/YYYY, for example 09/11/2026."}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:"secondary",label:"Pick a date",testID:"bh-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${u(b)}`,onPress:()=>$(!0)}),(0,h.jsx)(l.Button,{label:"Show",testID:"bh-show",accessibilityLabel:`Show booking history for ${B&&P?u(P):'a valid past date'}`,disabled:!B,onPress:()=>{P&&L(P),I(_+1)}})]}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:"secondary",testID:"bh-prev",label:`Previous ${W}`,accessibilityLabel:`Previous ${W}, ${u(S)}`,onPress:()=>L(S)}),(0,h.jsx)(l.Button,{kind:"secondary",testID:"bh-next",label:`Next ${W}`,accessibilityLabel:(0,d.validPastDate)(R,t)?`Next ${W}, ${u(R)}`:`Next ${W}, not available. Booking history is for past days only`,disabled:!(0,d.validPastDate)(R,t),onPress:()=>L(R)})]}),'day'===w?(0,h.jsx)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:(0,h.jsx)(l.Button,{small:!0,kind:"secondary",testID:"bh-prev-week",label:"Same day last week",accessibilityLabel:`Same day last week, ${u((0,n.addDaysIso)(b,-7))}`,onPress:()=>L((0,n.addDaysIso)(b,-7))})}):null]})}),(0,h.jsx)(y.LookBackCalendar,{visible:D,today:t,selected:b,purpose:"Booking history",idPrefix:"bh",onClose:()=>$(!1),onPick:e=>{L(e),$(!1)}}),C.data?'day'===w?C.data.days[0]?(0,h.jsx)(x,{d:C.data.days[0]}):null:(0,h.jsx)(j,{days:C.data.days,onDay:e=>{L(e),v('day')}}):(0,h.jsx)(l.Card,{children:(0,h.jsx)(o.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(l.T,{size:20,center:!0,testID:"bh-status",children:C.error||'Loading booking history\u2026'})})})]})};var e,s=r(_d[0]),t=r(_d[1]),o=(e=t)&&e.__esModule?e:{default:e},l=r(_d[2]),i=r(_d[3]),d=r(_d[4]),n=r(_d[5]),c=r(_d[6]),y=r(_d[7]),b=r(_d[8]),h=r(_d[9]);const u=e=>`${(0,n.dayName)(e)} ${(0,n.ddmmyyyy)(e)}`,k=({label:e,value:s,id:t})=>(0,h.jsxs)(o.default,{testID:`bh-stat-${t}`,accessible:!0,accessibilityLabel:`${e}: ${s}`,style:{alignItems:'center',minWidth:96,padding:8,borderRadius:12,borderWidth:1,borderColor:b.colours.border},children:[(0,h.jsx)(l.T,{size:28,weight:"bold",colour:b.colours.gold,center:!0,children:String(s)}),(0,h.jsx)(l.T,{size:16,center:!0,children:e})]});function x({d:e}){return(0,h.jsxs)(o.default,{style:{gap:12},testID:"bh-day",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:10,alignItems:'center'},accessible:!0,accessibilityLabel:(0,n.dayText)(e)+`. Done: ${e.done_covers+e.walk_in_covers} covers.`,children:[(0,h.jsx)(l.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:u(e.date)}),(0,h.jsx)(o.default,{testID:"bh-stats",style:{alignSelf:'stretch'},children:(0,h.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(k,{id:"bookings",label:"Bookings",value:e.bookings}),(0,h.jsx)(k,{id:"booked",label:"Booked covers",value:e.booked_covers}),(0,h.jsx)(k,{id:"walkins",label:"Walk-ins",value:e.walk_ins}),(0,h.jsx)(k,{id:"walkin-covers",label:"Walk-in covers",value:e.walk_in_covers}),(0,h.jsx)(k,{id:"done",label:"Done",value:e.done_covers+e.walk_in_covers}),(0,h.jsx)(k,{id:"total",label:"Total",value:e.total_covers})]})}),e.not_counted?(0,h.jsxs)(l.T,{size:16,center:!0,children:[e.not_counted," cancelled or no-show ",1===e.not_counted?'booking is':'bookings are'," listed but not counted."]}):null,e.old_records?(0,h.jsx)(l.T,{size:16,center:!0,colour:b.colours.muted,children:"Includes records from the previous booking system, which may be incomplete."}):null]})}),(e.lines??[]).length||e.walk_ins?null:(0,h.jsx)(l.Card,{children:(0,h.jsx)(l.T,{size:18,center:!0,children:"No bookings or walk-ins recorded for this day."})}),(e.lines??[]).map((e,s)=>(0,h.jsx)(o.default,{testID:"bh-line",accessible:!0,accessibilityLabel:(0,n.lineText)(e),style:{padding:10,borderRadius:12,borderWidth:1,borderColor:b.colours.border,alignItems:'center',opacity:e.counted?1:.7},children:(0,h.jsxs)(l.Row,{wrap:!0,gap:14,style:{justifyContent:'center'},children:[(0,h.jsx)(l.T,{size:20,weight:"bold",colour:b.colours.gold,children:e.time??'No time'}),(0,h.jsx)(l.T,{size:18,children:null==e.covers?'Covers not recorded':`${e.covers} ${1===e.covers?'cover':'covers'}`}),(0,h.jsx)(l.T,{size:18,children:e.table?`Table ${e.table}`:'No table'}),(0,h.jsx)(l.T,{size:18,children:(0,n.statusWord)(e.status)})]})},s))]})}function j({days:e,onDay:s}){const t=(0,n.sumDays)(e);return(0,h.jsxs)(o.default,{style:{gap:12},testID:"bh-week",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:10,alignItems:'center'},accessible:!0,accessibilityLabel:`Week ${(0,n.ddmmyyyy)(e[0].date)} to ${(0,n.ddmmyyyy)(e[e.length-1].date)}: ${t.bookings} bookings, ${t.booked_covers} booked covers, ${t.walk_ins} walk-ins with ${t.walk_in_covers} covers, ${t.total_covers} covers in total`,children:[(0,h.jsxs)(l.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:["Week ",(0,n.ddmmyyyy)(e[0].date)," to ",(0,n.ddmmyyyy)(e[e.length-1].date)]}),(0,h.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(k,{id:"week-bookings",label:"Bookings",value:t.bookings}),(0,h.jsx)(k,{id:"week-walkins",label:"Walk-ins",value:t.walk_ins}),(0,h.jsx)(k,{id:"week-total",label:"Total",value:t.total_covers})]})]})}),e.map(e=>(0,h.jsx)(l.Button,{kind:"secondary",testID:`bh-week-day-${e.date}`,label:`${(0,n.day3)(e.date)} ${(0,n.ddmmyyyy)(e.date)} \xb7 ${e.bookings} booked (${e.booked_covers}) \xb7 ${e.walk_ins} walk-in (${e.walk_in_covers}) \xb7 Total ${e.total_covers}`,accessibilityLabel:`${(0,n.dayText)(e)}. Double tap to see this day's bookings.`,onPress:()=>s(e.date)},e.date))]})}},1124,[17,85,777,1031,1062,1125,1061,1048,804,8]); __d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"addDaysIso",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ddmmyyyy",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"day3",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"dayName",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"mondayOf",{enumerable:!0,get:function(){return l}}),e.historyRange=function(o,t,s){if('day'===o)return{from:t,to:t};const a=l(t),c=n(a,6),d=n(s,-1);return{from:a,to:c({bookings:o.bookings+t.bookings,booked_covers:o.booked_covers+t.booked_covers,walk_ins:o.walk_ins+t.walk_ins,walk_in_covers:o.walk_in_covers+t.walk_in_covers,total_covers:o.total_covers+t.total_covers}),{bookings:0,booked_covers:0,walk_ins:0,walk_in_covers:0,total_covers:0})};const o=o=>o.toISOString().slice(0,10),t=o=>new Date(o+'T12:00:00Z'),n=(n,s)=>{const a=t(n);return a.setUTCDate(a.getUTCDate()+s),o(a)},s=o=>`${o.slice(8,10)}/${o.slice(5,7)}/${o.slice(0,4)}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],c=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=o=>a[t(o).getUTCDay()],u=o=>c[t(o).getUTCDay()],l=o=>n(o,-(t(o).getUTCDay()+6)%7);function b(o){switch((o??'').toLowerCase()){case'finished':case'seated':return'Done';case'confirmed':case'booked':case'amended':return'Booked';case'cancelled':return'Cancelled';case'noshow':return'No-show';default:return o||'Not recorded'}}const y=(o,t,n)=>`${o} ${1===o?t:n}`},1125,[]); __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TempUnitsSetup=function(){const e=(0,f.useSync)(e=>e.mode),s='live'===e||'offline'===e||'connecting'===e,o=(0,c.useSafety)(e=>e.points),b=(0,d.useOwner)(e=>e.site),[k,j]=(0,t.useState)(()=>(0,u.draftsFrom)(c.useSafety.getState().points)),[$,S]=(0,t.useState)(null),[I,w]=(0,t.useState)(!1),[T,D]=(0,t.useState)(''),[C,L]=(0,t.useState)(1),B=(0,t.useMemo)(()=>(0,u.changesOf)(k,o),[k,o]),z=e=>(0,h.chefCanSee)(b,e),A=Object.fromEntries(k.map(e=>[e.key,(0,u.problemOf)(e,k,z)])),P=Object.values(A).some(Boolean),R=e=>{j(t=>t.map(t=>t.key===e.key?e:t)),D(''),w(!1)},_=k.filter(e=>!e.archived),O=k.filter(e=>e.archived&&e.id),F=_.filter(e=>'fridge'===e.kind).length,H=_.length-F,M=e=>{const t=`new${C}`;L(C+1),D(''),w(!1),j(s=>[...s,{key:t,name:'',kind:e,location:'',max:String(u.DEFAULT_MAX[e]),due:'09:00, 16:00',archived:!1}])},W=P?'Fix the unit marked in red first.':B.length?`${B.length} change${1===B.length?'':'s'} not saved yet.`:'No changes yet.';return(0,x.jsxs)(n.default,{testID:"tu-setup",style:{gap:12,alignSelf:'center',width:'100%',maxWidth:560,alignItems:'stretch'},children:[(0,x.jsx)(l.T,{weight:"semibold",size:18,center:!0,accessibilityRole:"header",children:"Temperature units"}),(0,x.jsx)(l.T,{testID:"tu-count",size:15,center:!0,children:`${F} fridge${1===F?'':'s'} and ${H} freezer${1===H?'':'s'} checked`}),(0,x.jsx)(p.TempSaveBanner,{testID:"tu-save-banner"}),(0,x.jsx)(l.Banner,{kind:"info",title:s?'Shared with every device':'Not connected yet',children:s?'These units and their readings are on the shared food safety log, so every phone, tablet and screen at the venue shows the same units.':'These units are saved on this device until it connects. Then they are shared with every device at the venue.'}),_.map(e=>(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsx)(v,{d:e,problem:A[e.key],onChange:R,onArchive:()=>e.id?S(e.key):j(t=>t.filter(t=>t.key!==e.key))}),$===e.key?(0,x.jsxs)(n.default,{testID:"tu-archive-ask",style:{gap:8,padding:12,borderRadius:12,backgroundColor:y.colours.amberBg,alignItems:'center'},children:[(0,x.jsx)(l.T,{size:15,center:!0,children:`Archive ${e.name.trim()||'this unit'}? It will no longer be checked. Its past readings stay in History and the EHO report. Nothing is deleted.`}),(0,x.jsxs)(l.Row,{gap:8,children:[(0,x.jsx)(l.Button,{small:!0,testID:"tu-archive-confirm",label:"Archive",accessibilityLabel:`Yes, archive ${e.name}`,onPress:()=>{R({...e,archived:!0}),S(null)}}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-archive-cancel",label:"Keep it",accessibilityLabel:`No, keep ${e.name}`,onPress:()=>S(null)})]})]}):null]},e.key)),(0,x.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-add-fridge",label:"Add a fridge",onPress:()=>M('fridge')}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-add-freezer",label:"Add a freezer",onPress:()=>M('freezer')})]}),O.length?(0,x.jsxs)(n.default,{testID:"tu-archived",style:{gap:6,alignItems:'center'},children:[(0,x.jsx)(l.T,{weight:"medium",center:!0,children:"Archived (not checked, history kept)"}),O.map(e=>(0,x.jsxs)(l.Row,{gap:8,style:{justifyContent:'center'},children:[(0,x.jsx)(l.T,{size:14,center:!0,children:e.name}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:`tu-restore-${e.key}`,label:"Bring back",accessibilityLabel:`Bring back ${e.name}`,onPress:()=>R({...e,archived:!1,due:e.due||'09:00, 16:00'})})]},e.key))]}):null,I?(0,x.jsxs)(n.default,{testID:"tu-save-ask",style:{gap:8,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold,alignItems:'center'},children:[(0,x.jsx)(l.T,{weight:"medium",center:!0,children:`Save ${B.length} change${1===B.length?'':'s'}?`}),B.map(e=>(0,x.jsx)(l.T,{size:14,center:!0,children:e.text},e.key)),(0,x.jsxs)(l.Row,{gap:8,children:[(0,x.jsx)(l.Button,{small:!0,testID:"tu-save-confirm",label:"Save",accessibilityLabel:"Yes, save the changes",onPress:()=>{const e=c.useSafety.getState(),t=new Set(e.points.map(e=>e.id));for(const t of B)t.add?e.addPoint(t.add):t.id&&t.patch&&e.setPoint(t.id,t.patch);j((0,u.draftsFrom)(c.useSafety.getState().points)),w(!1);const n=[...B.filter(e=>e.id).map(e=>e.id),...c.useSafety.getState().points.filter(e=>!t.has(e.id)).map(e=>e.id)],l=`Saved ${B.length} change${1===B.length?'':'s'}.`;D(s?`${l} Sending to every device\u2026`:`${l} (on this device until it connects).`),s&&(0,p.reportTempSave)('temp_units',n,l,D)}}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-save-cancel",label:"Back",accessibilityLabel:"Go back without saving",onPress:()=>w(!1)})]})]}):null,(0,x.jsx)(l.Button,{testID:"tu-save",label:"Save changes",disabled:!B.length||P,accessibilityHint:W,onPress:()=>w(!0),style:{alignSelf:'center',minWidth:200}}),T?(0,x.jsx)(l.T,{testID:"tu-saved",size:15,colour:y.colours.ok,center:!0,accessibilityRole:"text",children:T}):(0,x.jsx)(l.Muted,{style:{textAlign:'center'},children:W})]})};var e,t=r(_d[0]),s=r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),h=r(_d[6]),u=r(_d[7]),y=r(_d[8]),p=r(_d[9]),f=r(_d[10]),x=r(_d[11]);const b=['Downstairs','Upstairs'],k={fridge:'Fridge',freezer:'Freezer'};function v({d:e,problem:t,onChange:s,onArchive:c}){const d=e.name.trim()||'new unit';return(0,x.jsxs)(n.default,{testID:`tu-unit-${e.key}`,style:{gap:8,padding:12,borderRadius:12,borderWidth:1,borderColor:t?y.colours.red:y.colours.border,alignSelf:'stretch'},children:[(0,x.jsx)(o.TextInput,{testID:`tu-name-${e.key}`,accessibilityLabel:`Name of ${d}`,value:e.name,onChangeText:t=>s({...e,name:t}),placeholder:"e.g. Upstairs fridge 5",placeholderTextColor:"#7D776C",style:[l.styles.input,{alignSelf:'stretch',width:'100%'}]}),(0,x.jsxs)(l.Row,{wrap:!0,gap:6,children:[['fridge','freezer'].map(t=>(0,x.jsx)(l.Chip,{testID:`tu-kind-${e.key}-${t}`,label:k[t],selected:e.kind===t,accessibilityLabel:`${d}: ${k[t]}${e.kind===t?', selected':''}`,onPress:()=>s((0,u.withKind)(e,t))},t)),b.map(t=>(0,x.jsx)(l.Chip,{testID:`tu-loc-${e.key}-${t.toLowerCase()}`,label:t,selected:e.location.trim().toLowerCase()===t.toLowerCase(),accessibilityLabel:`${d}: location ${t}`,onPress:()=>s({...e,location:t})},t))]}),(0,x.jsxs)(l.Row,{wrap:!0,gap:8,children:[(0,x.jsx)(o.TextInput,{testID:`tu-loc-${e.key}`,accessibilityLabel:`Location of ${d}`,value:e.location,onChangeText:t=>s({...e,location:t}),placeholder:"Location",placeholderTextColor:"#7D776C",style:[l.styles.input,{flexGrow:1,flexBasis:120,minWidth:0,width:40}]}),(0,x.jsxs)(l.Row,{gap:6,style:{flexWrap:'nowrap'},children:[(0,x.jsx)(o.TextInput,{testID:`tu-max-${e.key}`,accessibilityLabel:`Safe limit for ${d}, degrees or colder`,value:e.max,onChangeText:t=>s({...e,max:t}),placeholder:String(u.DEFAULT_MAX[e.kind]),placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[l.styles.input,{width:72,textAlign:'center'}]}),(0,x.jsx)(l.T,{size:14,children:"\xb0C or colder"})]})]}),(0,x.jsx)(o.TextInput,{testID:`tu-due-${e.key}`,accessibilityLabel:`Check times for ${d}, 24 hour, comma separated`,value:e.due,onChangeText:t=>s({...e,due:t}),placeholder:"Check times, e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[l.styles.input,{alignSelf:'stretch',width:'100%'}]}),t?(0,x.jsx)(l.T,{testID:`tu-problem-${e.key}`,size:14,colour:y.colours.red,center:!0,accessibilityRole:"text",children:t}):null,(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:`tu-archive-${e.key}`,label:"Archive",accessibilityLabel:`Archive ${d}`,accessibilityHint:"Stops the checks. Its past readings stay in History and the EHO report",onPress:c,style:{alignSelf:'center'}})]})}},1126,[17,85,777,812,1001,876,820,1127,804,1128,899,8]); @@ -1285,7 +1285,7 @@ __d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.AccidentBook=function(n){return null}},1202,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MissedBanner=function(n){return null},e.HaccpLog=function(n){return null}},1203,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SpecialsEditor=function(t){return null}},1204,[]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},1205,[843,1026,17,219,385,85,780,858,804,777,1206,1102,1207,8]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by email",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},1205,[843,1026,17,219,385,85,780,858,804,777,1206,1102,1207,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,"BANNER_MS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return I}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:b}){const g=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!h||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=p,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,I),x=e.length-y.length,R=(0,f.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:h?'fixed':'absolute',left:10,right:n?10:76,top:8+g.top,zIndex:2147483001,gap:8,alignItems:'center',...h?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,f.jsx)(C,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>b(e)},e.id+':'+e.at)),x>0?(0,f.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:u.SLIDER.bg,borderWidth:1,borderColor:u.SLIDER.border},children:(0,f.jsxs)(c.T,{size:13,colour:u.SLIDER.quiet,children:[x," more new ",1===x?'booking':'bookings']})}):null]});if(h)try{const e=r(_d[13],"react-dom");if(e?.createPortal)return e.createPortal(R,document.body)}catch{}return R};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]),f=r(_d[12]);const h='undefined'!=typeof document,p="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",y=e=>h?{dataSet:{ccbn:e}}:{},x=7e3,I=3;function C({a:e,big:a,managers:p,me:I,onOpen:C,onClose:R}){const j='pending'===e.kind,[k,D]=(0,o.useState)(null),L=j&&p&&!k;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(R,k?1800:x);return()=>clearTimeout(e)},[L,k]);const S=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&R()}})).current,E=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',z=[e.when,E,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),v=j?'Booking request':'New booking',w=[e.when,E,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),T=`${v}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${C?' Tap to open bookings.':''}`,$=n=>{e.refId&&!e.test&&g.repo.bookings.decide(e.refId,n,I??'Manager'),D('confirmed'===n?'Confirmed.':'Declined.')};return(0,f.jsxs)(s.default,{...S.panHandlers,...y('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:u.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':u.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:j?d.colours.amber:d.colours.gold,...h?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,f.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:T,disabled:!C,onPress:()=>{R(),C?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,f.jsx)(c.T,{size:a?14:12,weight:"bold",colour:j?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:k??v.toUpperCase()}),(0,f.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:u.SLIDER.text,numberOfLines:1,children:e.name}),z?(0,f.jsx)(c.T,{size:a?18:15,colour:u.SLIDER.quiet,numberOfLines:1,children:z}):null,e.allergy?(0,f.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,f.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,f.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>$('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:u.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(c.T,{size:15,weight:"bold",colour:u.SLIDER.ink,children:"Confirm"})}),(0,f.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>$('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,f.jsx)(b.ToastClose,{testID:"booking-banner-close",label:`Close ${v.toLowerCase()} for ${e.name}`,onPress:R,size:a?'lg':'md',colour:u.SLIDER.quiet,style:{minWidth:56,minHeight:56,marginRight:4}})]})}},1206,[843,17,363,219,385,85,19,804,777,779,1102,858,8,260]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},1207,[1208,1209,1211,1210,1212,1016,1213]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1208,[]); @@ -1399,7 +1399,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1316,[812,843,17,85,777,845,851,1151,1317,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})},1317,[928,899,1151]); __d(function(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]})}},1318,[13,17,856,1319,1391,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 Je}}),_e2.DisplayBoard=function(e={}){const t=(0,ie.useOwner)(e=>e.site);return(0,te.useRestaurant)(t)?(0,qe.jsx)(at,{...e}):(0,qe.jsx)(U.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Y.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]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=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=_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]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]);const Ye='#221C12',Qe='#2E2618',Je=12e4,Xe={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},Ze={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},et={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},tt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),lt=e=>e.slotTime?(0,ee.hm)(new Date(e.slotTime)):'ASAP';function it({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,qe.jsxs)(U.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)(U.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)(U.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)(Y.T,{size:s?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,qe.jsx)(Y.T,{size:s?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,qe.jsx)(F.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)(U.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)(Y.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,qe.jsxs)(U.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,qe.jsx)(U.default,{style:{width:`${l.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,qe.jsx)(U.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,qe.jsxs)(F.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)(U.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,qe.jsx)(Y.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Y.T,{size:12,colour:se.colours.muted,children:s}):null]})}function ot({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ve.statusBlock)(e,t,(0,Ve.linkedBooking)(e,l));return e.length?(0,qe.jsx)(U.default,{style:{gap:8},children:e.map(e=>(0,qe.jsxs)(U.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:s?16:18,weight:"bold",children:[lt(e)," \xb7 ",tt(e.customerName)]}),(0,qe.jsx)(Y.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)(Y.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)(Y.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,Z.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Fe.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Y.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Y.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>te.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Y.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Y.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Ce.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Y.Muted,{children:"No takeaway orders right now."})}function at({embedded:e=!1,boardW:b,headerExtra:Z,subHeader:Fe,noVoice:Ve=!1}={}){const lt=(0,K.default)(),at=b??lt.width,dt=lt.height,ct=at<700,ut=at>=dt,ht=!ct&&ut&&at>=600,gt=ht,bt=Math.round(Math.min(520,Math.max(at>=1e3?448:280,.3*at))),yt=P.default.useRef(null),pt=P.default.useRef(0),[ft,xt]=(0,H.useState)({w:0,h:0}),mt=(0,ie.useOwner)(e=>e.site),jt=(0,te.useRestaurant)(mt);(0,Re.useAlertWatcher)(mt,{enabled:!e});const wt=(0,te.useOrders)(mt),kt=(0,te.useBookings)(mt),It=(0,te.useEvents)(mt),Dt=(0,te.useStore)(e=>e.skipMinutes),vt=(0,te.useStore)(e=>e.clock.mode),St=(0,te.useNow)(5e3),Ct=(0,ie.useOwner)(e=>e.staff),Tt=(0,ie.useOwner)(e=>e.attendance),Rt=(0,ie.useOwner)(e=>e.shifts),$t=(0,ie.useOwner)(e=>e.leave),Bt=P.default.useMemo(()=>(0,Oe.workingShifts)(Rt,$t),[Rt,$t]);P.default.useEffect(()=>{(0,oe.ensureAttendance)((0,ee.ymd)(St),St)},[(0,ee.ymd)(St)]);const Wt=(0,R.useSession)(e=>e.meId),Lt=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:tt(Ct.find(e=>e.id===Wt)?.name)}),zt=I.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Ht=(0,ee.ymd)(St),Pt=(0,A.useTravelDay)('display',Ht),Mt=(0,ne.useFrontDoor)(Ht,ut),At=(0,ae.useDisplaySettings)(mt),Et=At.privacy,Ot=(0,pe.useSaverSync)(),Nt=(0,ae.usePlan)(mt),_t=(0,ae.useFloor)(e=>e.live[mt]),Gt=(0,$e.useBlocks)(e=>e.blocks),[Ft,Vt]=(0,H.useState)('plan'),[Ut,Kt]=(0,H.useState)(!1),[qt,Yt]=(0,H.useState)('all'),[Qt,Jt]=(0,H.useState)(null),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(!1),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(null),[rs,ds]=(0,H.useState)(!1),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(null),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[ks,Is]=(0,H.useState)(!1),Ds=P.default.useRef(0),vs=e=>{Ds.current=Date.now(),ws(e)};P.default.useEffect(()=>{if(!js)return;const e=setInterval(()=>{Date.now()-Ds.current>=ze.DAY_IDLE_MS&&ws(null)},5e3);return()=>clearInterval(e)},[js]);const Ss=(0,te.useWaitlist)(mt),Cs=(0,te.useStore)(e=>e.walkIns[mt]??0),[Ts,Rs]=(0,H.useState)(!1),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1);(0,J.useReviewAlerts)(mt);const[Ps,Ms]=(0,H.useState)({view:0,content:0}),[As,Es]=(0,H.useState)(null);P.default.useEffect(()=>{As&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:As,timeoutMs:4500,big:!0,testID:'floor-toast'}),Es(null))},[As]),P.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Os,Ns]=(0,H.useState)(null),_s=P.default.useRef(0),[Gs,Fs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Os)return;_s.current=Date.now();const e=setInterval(()=>{const e=Date.now()-_s.current;if(e>=Je)return Ns(null),void Es('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Fs(e>=105e3?Math.ceil((Je-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Os]);const Vs=e=>e.date!==Ht?ts({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Ht)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Ht?(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Ht)}, ${e.time}`,disabled:!wi.ok,accessibilityHint:wi.hint,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}):null,(0,ve.bookingDetails)(e)]})}):ts({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(rt,{rid:mt,id:e.id,turnBase:jt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(we.CancelWalkInButton,{rid:mt,b:e,big:!0,onDone:e=>{ts(null),Es(e)}}):null,e.walkIn?(0,qe.jsx)(we.ReinstateWalkInButton,{rid:mt,b:e,today:Ht,onDone:e=>{ts(null),Es(e)}}):null,(0,ve.bookingDetails)(e)]})}),Us=kt.filter(e=>e.date===Ht).sort((e,t)=>e.time.localeCompare(t.time)),Ks=Us.filter(e=>!['cancelled','noshow'].includes(e.status)),qs=wt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,H.useMemo)(()=>(0,c.forecastToday)(jt,kt,wt,It,St),[jt,kt,wt,It,St.getTime()/6e4|0]),Qs=(0,$e.closedAreasAt)(Gt,mt,Ht,(0,ee.hm)(St)),Js=[...Qs].join(','),Xs=(0,H.useMemo)(()=>(0,re.floorView)(Nt,kt,wt,_t??{},St,jt.settings.turnMins,Qs),[Nt,kt,wt,_t,St.getTime(),Js]),Zs=(0,De.hoursFor)(jt,St),el=Zs?.open??new Date(`${Ht}T12:00:00`),tl=Zs?.close??new Date(`${Ht}T21:00:00`),sl=(0,ee.addMins)(el,-el.getMinutes()),ll=(0,ee.addMins)(tl,30),il=e=>new Date(`${Ht}T${e}:00`),nl=(0,$e.blocksOn)(Gt,mt,Ht).map(e=>({from:il(e.from),to:il(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(jt,St,Ht)),ol=Object.keys(Xs).filter(e=>'blocked'===Xs[e]?.status),al=js&&js!==Ht?js:Ht,rl=al!==Ht,dl=(0,ze.dayWord)(al,Ht),cl=/^(Today|Yesterday|Tomorrow)$/.test(dl),ul=rl?(0,ze.bookingsForDay)(kt,al,Ht).sort((e,t)=>e.time.localeCompare(t.time)):Us,hl=(0,ee.parseYmd)(al);hl.setHours(12);const gl=rl?(0,De.hoursFor)(jt,hl):Zs,bl=gl?.open??new Date(`${al}T12:00:00`),yl=gl?.close??new Date(`${al}T21:00:00`),pl=e=>new Date(`${al}T${e}:00`),fl=[...rl?(0,$e.blocksOn)(Gt,mt,al).map(e=>({from:pl(e.from),to:pl(e.to),label:e.reason??'Paused'})):nl,...rl?(0,n.queuedServicePauses)(jt,hl,al):[]],xl=(0,n.queuedServiceSessions)(jt,hl),ml=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),jl=(0,qe.jsxs)(U.default,{testID:"queued-hours-gate",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Y.Muted,{children:i.queuedVenues[mt]?.hours.note})]}),wl=rl?gl||ul.length?alrl?(0,re.dayFloorView)(Nt,ul,al):Xs,[rl,Nt,ul,al,Xs]),[Il,Dl]=(0,H.useState)(null),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(!1),[Rl,$l]=(0,H.useState)(null),Bl=rl?ul.filter(e=>!['cancelled','noshow'].includes(e.status)):Ks,Wl=Bl.reduce((e,t)=>e+t.partySize,0),Ll=(0,u.coversSplit)(Bl,al),zl=(0,Pe.cancelledDayTally)(kt,al),Hl=(0,Me.cancellationsFor)(kt,al,e=>e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)','')),Pl=(0,Pe.cancelledTallyWords)(zl,cl?dl.toLowerCase():rl?`on ${dl}`:'today'),Ml=Gt.filter(e=>e.rid===mt&&e.date===al&&!e.removedAt),Al=60*bl.getHours()+bl.getMinutes(),El=60*yl.getHours()+yl.getMinutes(),Ol=(0,Le.chartBands)(Ml,Al,El),Nl=(0,Le.seasonClosedAreaIds)(Ml,Al,El),_l=Nl.size?{...Nt,areas:Nt.areas.filter(e=>!Nl.has(e.id)),tables:Nt.tables.filter(e=>!Nl.has(e.areaId))}:Nt,Gl=rl?[]:ol.filter(e=>!Nl.has(Nt.tables.find(t=>t.name===e)?.areaId??'')),Fl=new Set((0,Le.blockedHours)(Ol)),Vl=St.getHours()+(St.getMinutes()>=30?1:0),Ul=Ys.hours.filter(e=>e.hour>=Vl&&!Fl.has(e.hour)),Kl=Ul.reduce((e,t)=>e+t.coversHigh,0),ql=Ul.reduce((e,t)=>e+t.coversLow,0),Yl=Math.round((ql+Kl)/2),Ql=!Ys.example&&Ys.open&&Ys.enough&&Kl>0?`Usually ${(0,c.coversRange)(Yl,Yl)} more`:void 0,Jl=async(e,t)=>{const s=Xs[e]?.booking;if(!s||e===t)return;const l=Xs[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 ${re.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,ke.guardBookingChange)(Es,{b:s,tables:[t]}))return;await te.repo.bookings.update(s.id,{table:t});const i=_t?.[e]?.stage;ae.useFloor.getState().setLive(mt,t,{stage:i??'seated',dirty:!1}),ae.useFloor.getState().setLive(mt,e,{stage:void 0,dirty:!0}),Es(`Saving: ${(0,fe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,ke.reportBookingSave)(s.id,`${(0,fe.privName)(s,Et)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}`,Es)},Xl=e=>{if(xs)return Sl(null),void ms(t=>t?{...t,tables:(0,Ie.toggleTable)(t.tables,e)}:t);rl?Dl(e):Xt?(e!==Xt&&Jl(Xt,e),Zt(null)):Jt(e)},Zl=xs?kt.find(e=>e.id===xs.id):void 0,ei=xs&&Zl?(()=>{const e=Zl.walkIn?(0,fe.privName)(Zl,Et):tt(Zl.name),t=(0,Ie.seatsOf)(Nt,xs.tables).total,s=(0,Ie.seatLine)(t,Zl.partySize),l=(0,Ie.pickClashes)(Zl,xs.tables,kt.filter(e=>e.date===Zl.date),jt.settings.turnMins),i=(0,Ie.tableKey)(xs.tables)!==(0,Ie.tableKey)((0,ae.tablesOf)(Zl.table));return(0,qe.jsxs)(U.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,qe.jsxs)(U.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Zl.date,Ht)} ${Zl.time}. Tap tables on the plan to add or take them off. ${(0,Ie.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Zl.date,Ht)," ",Zl.time]}),(0,qe.jsxs)(Y.T,{size:16,colour:se.colours.text,children:[(0,Ie.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),vl?(0,qe.jsx)(U.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:vl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,qe.jsx)(Y.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:vl})}):null,Cl&&Zl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Tl(!1),(async()=>{if(!(0,ke.guardBookingChange)(Es,{b:Zl,tables:xs.tables}))return Sl(null),void ms(null);const s=xs.tables;ms(null),await(0,ke.saveTablesReported)(mt,Zl,s,e,t,Es)})()},onNo:()=>Tl(!1)}):null,(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:vl?'plan-pick-overcap-yes':'plan-pick-save',label:vl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${vl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,Ie.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Zl)return void ms(null);if(!(0,ke.guardBookingChange)(Es,{b:Zl,tables:xs.tables}))return Sl(null),void ms(null);const s=(0,Ie.overCapacityAsk)(xs.tables,t,Zl.partySize);if(s&&!vl)return void Sl(s);if('finished'===Zl.status&&xs.tables.length&&!Cl)return void Tl(!0);Sl(null),Tl(!1);const l=xs.tables;ms(null),await(0,ke.saveTablesReported)(mt,Zl,l,e,t,Es)}}),(0,qe.jsx)(Y.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Sl(null),ms(null)}})]})]})})():null,ti=_l.areas.filter(e=>_l.tables.some(t=>t.areaId===e.id)),si=e=>{const t=Nt.tables.filter(t=>t.areaId===e);return rl?`${t.filter(e=>!kl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Xs[e.name]?.status??'free')).length}/${t.length} free`},li='all'===qt||ti.some(e=>e.id===qt)?qt:'all',ii=e=>(0,qe.jsx)(de.FloorCanvas,{plan:_l,areaId:e,mode:"live",fit:"contain",crop:!0,fill:ht,big:!0,view:kl,privacy:Et,turnBase:jt.settings.turnMins,highlight:xs?xs.tables:Xt?[Xt]:void 0,onTap:e=>Xl(e.name),onDrop:(e,t)=>xs||rl?void 0:Jl(e.name,t.name)}),ni=ct?1:ut||ti.length>2?2:1,oi=e=>{const t=Nt.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},ai=[];for(let e=0;e{const t=(0,de.areaBounds)(Nt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,de.minReadableScale)(Nt,e.id)}}),ft.w,ft.h):null,di=e=>(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',height:ce.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:si(e.id)})]}),ci=(0,qe.jsx)(U.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-ft.w)>1||Math.abs(s-ft.h)>1)&&xt({w:t,h:s})},children:ri?(0,qe.jsx)(V.default,{style:{flex:1},scrollEnabled:ri.scroll,showsVerticalScrollIndicator:ri.scroll,contentContainerStyle:{gap:ce.GRID_GAP},children:ri.rows.map((e,t)=>(0,qe.jsx)(U.default,{style:{height:ri.rowHeights[t],flexDirection:'row',gap:ce.GRID_GAP},children:e.map(e=>{const t=ti.find(t=>t.id===e);return(0,qe.jsxs)(U.default,{testID:`area-cell-${e}`,style:{width:ri.cellW,gap:2},children:[di(t),(0,qe.jsx)(U.default,{style:{flex:1},children:ii(e)})]},e)})},t))}):null}),ui=(0,qe.jsxs)(U.default,{testID:"venue-plan",style:{flex:ct?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:Nt}),Nt.tables.length?null:(0,qe.jsxs)(U.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,qe.jsx)(Y.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Y.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)(Y.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,qe.jsx)(nt,{chipId:"all",compact:!ct,label:"Whole venue",selected:'all'===li,onPress:()=>Yt('all')},"__all"),...ti.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ct,label:`${e.name}${(0,ue.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ct?Qs.has(e.id)?'closed':li===e.id?si(e.id):void 0:void 0,selected:li===e.id,onPress:()=>Yt(e.id)},e.id))];return ct?(0,qe.jsx)(U.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,qe.jsx)(V.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:Ps.view>0&&Ps.content>0&&Ps.content<=Ps.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ps.view>0&&Ps.content<=Ps.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),ei,Xt?(0,qe.jsxs)(Y.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Y.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Xt),": tap the new table."]}),(0,qe.jsx)(Y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Zt(null)})]}):null,'all'===li&&ht?ci:'all'===li?(0,qe.jsx)(U.default,{style:{flex:ct?void 0:1,gap:12,minHeight:gt?void 0:360},children:ai.map((e,t)=>(0,qe.jsxs)(U.default,{style:{flex:ct?void 0:Math.max(.3,...e.map(e=>oi(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(U.default,{style:{flex:1,gap:2},children:[ct?(0,qe.jsxs)(U.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Y.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{center:!0,children:si(e.id)})]}):(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{children:si(e.id)})]}),(0,qe.jsx)(U.default,{style:ct?{height:Math.max(280,Math.round((at-40)*oi(e.id)))}:{flex:1},children:ii(e.id)})]},e.id)),e.length{if(rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},al)}),gi='timeline'===Ft,bi=Ut?(0,qe.jsx)(_.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Kt(!1),supportedOrientations:['landscape','portrait'],children:(0,qe.jsxs)(U.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,qe.jsx)(F.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Kt(!1),style:{minHeight:64,minWidth:at<600?120:180,paddingHorizontal:at<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,qe.jsx)(U.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,qe.jsx)(Y.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${rl?(0,ze.dayLong)(al):'Today'}`})}),at<600?null:(0,qe.jsx)(U.default,{style:{minWidth:180}})]}),ml?jl:(0,qe.jsx)(U.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(be.Timeline,{hideNow:!0,fit:!0,plan:_l,bookings:rl?ul:Us,now:rl?bl:St,privacy:Et,turnBase:jt.settings.turnMins,t0:rl?(0,ee.addMins)(bl,-bl.getMinutes()):sl,t1:rl?(0,ee.addMins)(yl,30):ll,pauses:rl?fl:nl,blockedTables:Gl,onOpen:e=>{if(Kt(!1),rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},`full-${al}`)})]})}):null,yi=rl?(0,qe.jsxs)(U.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:cl?`Showing ${dl} \xb7 ${(0,ee.niceDate)((0,ee.parseYmd)(al))}`:`Showing ${(0,ze.dayWord)(al,Ht)}`}),(0,qe.jsx)(U.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Pl}. Showing ${(0,ze.dayLong)(al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Y.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ms(null),vs(null)},style:{minHeight:44}})]}):null,pi=(0,qe.jsx)(U.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:ct?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(gi||Ut);return(0,qe.jsx)(F.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?(Vt('plan'),Kt(!0)):(Kt(!1),Vt('plan'))},style:{flex:ct?1:void 0,minHeight:ct?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',...Ne.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)(Y.T,{size:ct?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),fi='display'===I.APP_VARIANT&&!e,xi='display'===I.APP_VARIANT&&!e,mi=!e&&!I.IS_CAR&&!ct,ji=fi?(0,qe.jsxs)(U.default,{testID:"display-view-row",style:{flexDirection:ct?'column':'row',flexWrap:ct||mi?'nowrap':'wrap',gap:6,alignItems:ct||mi?'stretch':'center'},children:[pi,(0,qe.jsx)(k.DisplayRotaKitchenButtons,{phone:ct,fill:mi,shifts:Rt,staff:Ct,today:Ht,leave:$t})]}):pi,wi=(0,h.useBookingWrite)(),ki=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Walk-in",onPress:Mt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"New booking",onPress:Mt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint})]});(0,Ke.useDisplayNotices)(mt,!e);const Ii=!e&&!I.IS_CAR&&!ct,Di=ct?180:202,[vi,Si]=(0,H.useState)(ct?180:168),Ci=P.default.useRef(ct?180:168),Ti=P.default.useRef(null),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(!1),[Wi,Li]=(0,H.useState)(!1),zi=!ct&&dt<=800,Hi=We.DAY_GRAPH_CHROME+(zi?24:8),Pi=P.default.useRef(0),[Mi,Ai]=(0,H.useState)(Hi),[Ei,Oi]=(0,H.useState)(!0),[Ni,Gi]=(0,H.useState)(!1);P.default.useEffect(()=>{Gi(!1)},[at,dt]);const Fi=P.default.useRef(()=>{}),Vi=P.default.useCallback(e=>{Math.abs(e-Pi.current)>=2&&(Pi.current=e,setTimeout(()=>Fi.current(),0))},[]),Ui=()=>{const e=Ti.current,t=Ri.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=t>Ci.current?Math.ceil(t-Ci.current):0,o=Ii?Math.max(Hi,Pi.current):Math.max(Hi,n);Ii&&o!==Mi&&Ai(o);const a=!ct&&dt>=700?140:70,r=Math.floor(s-4-e)-o-l,d=i>0&&r-i>=a;Ii&&d!==Ei&&Oi(d),Ii&&!Ni&&r<48&&Gi(!0);const c=r-(d?i:0),u=Math.min(Di,c>=a?Math.max(a,c):Math.max(0,c));Math.abs(Ci.current-u)>=2&&(Ci.current=u,Si(u))},l=44+(dt<820?4:8),i=46+(dt<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=$i.current;Ii&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=dt<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Bi.current?44+d:0)}):s(n,a,t,Ii?i:l)})})};Fi.current=Ui,P.default.useEffect(()=>{const e=setTimeout(()=>Fi.current(),60),t=setTimeout(()=>Fi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[at,dt,al]);const Ki=(0,qe.jsxs)(U.default,{ref:Ri,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ui()},style:{flexDirection:'row',flexWrap:at>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ct?12:zi?2:6,justifyContent:ct?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ue.DisplayClockButton,{}),(0,qe.jsx)(ge.HoldToEdit,{quiet:!0,onUnlock:()=>{Fs(null),Ns({at:Date.now()})},onHint:()=>Es('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(Be.BlockBookingsButton,{rid:mt,r:jt,now:St,by:Lt,quiet:!0,display:!0,day:al}),Nt.areas.some(e=>e.outdoor)?(0,qe.jsx)(Be.CloseGardenButton,{rid:mt,r:jt,now:St,by:Lt,quiet:!0,short:!0}):null,(0,qe.jsx)(F.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Hs(!0),style:({pressed:e})=>({...Ne.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,qe.jsx)(f.GiftQrButton,{rid:mt,venue:jt.name})]}),qi=qs.length?(0,qe.jsxs)(U.default,{testID:"takeaway-panel",style:[Ne.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Y.T,{size:12,colour:se.colours.muted,children:[qs.length," live"]})]}),(0,qe.jsx)(U.default,{style:{padding:10},children:(0,qe.jsx)(ot,{list:qs,me:Lt,compact:!0,bookings:kt})})]}):null,Yi=(Ee.DueToday,jt.settings.turnMins||90),Qi=rl?ul:(0,v.todaysGuestList)(Us,St,Yi),Ji=rl?[]:(0,v.todaysFinishedList)(Us,St,Yi),Xi=rl?cl?`${dl}\u2019s guests`:`Guests ${dl}`:'Today\u2019s guests',Zi=(0,qe.jsxs)(qe.Fragment,{children:[0===Qi.length?(0,qe.jsx)(Y.Muted,{children:rl?al{const t=(0,v.isLeftEarly)(e,St,Yi),s=(0,le.isSeatedHighlight)(e.status,{otherDay:rl})&&!t,l=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=se.colours.text,n=s?se.colours.goldLight:se.colours.muted,o=se.colours.gold,a=l.depositWarn?se.colours.amber:se.colours.goldLight;return(0,qe.jsxs)(F.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:rl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,le.seatedHighlightStyle)({backgroundColor:e?Qe:Ye,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,qe.jsx)(Y.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)(U.default,{style:{paddingTop:2},children:(0,qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,qe.jsxs)(Y.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Y.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}),(0,qe.jsx)(Y.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,qe.jsx)(Y.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(U.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(me.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,qe.jsx)(Y.T,{size:15,colour:se.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),Ji.length?(0,qe.jsxs)(U.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(F.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ji.length}${bs?', expanded':', collapsed'}`,accessibilityState:{expanded:bs},onPress:()=>ys(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Y.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ji.length,")"]}),(0,qe.jsx)(Y.T,{size:16,colour:se.colours.muted,children:bs?'\u25be':'\u25b8'})]}),bs?Ji.map(e=>{const t=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,qe.jsxs)(F.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Y.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Y.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,qe.jsx)(U.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,qe.jsx)(S.BookingUndo,{b:e,rid:mt,today:Ht,who:t.name,allowed:wi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ae.CancellationsSection,{items:Hl,dayWord:rl?cl?dl.toLowerCase():`on ${dl}`:'today'})]}),en=(0,qe.jsx)(V.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Zi}),tn=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&gs(!1)}}),sn=(0,qe.jsxs)(F.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Xi}, ${Qi.length}`,accessibilityState:{expanded:hs},'aria-expanded':hs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>gs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:hs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:hs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Y.T,{size:16,weight:"bold",colour:se.colours.gold,children:Qi.length}),(0,qe.jsx)(U.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(U.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,qe.jsxs)(Y.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Xi," ",hs?'\u2039':'\u203a']})})})]}),ln=hs?(0,qe.jsxs)(U.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,qe.jsxs)(U.default,{testID:"guests-drawer",...tn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*at)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,...Ne.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,qe.jsxs)(U.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Xi.toUpperCase()," (",Qi.length,")"]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Xi}`,onPress:()=>gs(!1),style:{marginRight:-6}})]}),zl.count?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Pl}):null,(0,qe.jsx)(U.default,{testID:"guests-tools",style:{flexDirection:'row',gap:8,marginTop:6,justifyContent:'center'},children:(0,qe.jsx)(F.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:cs},'aria-expanded':cs,onPress:()=>us(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:14,borderRadius:12,borderWidth:1,borderColor:cs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',backgroundColor:e?se.colours.tilePressed:cs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:se.colours.goldLight,children:["Guest key ",cs?'\u25b4':'\u25be']})})}),cs?(0,qe.jsx)(U.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: warning sign allergy, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:6},children:[['\u26a0','allergy'],['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(Y.T,{size:16,children:e}),(0,qe.jsx)(Y.T,{size:14,children:t})]},t))}):null]}),en]}),(0,qe.jsx)(F.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Xi}`,accessibilityRole:"button",onPress:()=>gs(!1),style:{flex:1}})]}):null,nn=ml?jl:l.IS_KIRKTON&&!Object.values(jt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(U.default,{testID:"kirkton-hours-to-confirm",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Y.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(jt,kt,St).busy,todays:ul,open:bl,close:yl,now:St,turnBase:jt.settings.turnMins,blocks:Ml,pauses:fl,compact:ct,dense:!ct,fit:ht,tight:ht&&dt<=600,height:ht?vi:Di,forecastNote:rl?void 0:Ql,emptyText:wl,past:al{Ds.current=Date.now(),Is(!0)},shortDay:!ct&&at<1100}),rn=(0,qe.jsx)(He.DisplayCalendar,{visible:ks,today:Ht,day:al,bookings:kt,restaurant:jt,now:St,onDay:vs,onClose:()=>Is(!1)}),dn=()=>{rl?gs(!0):Kt(!0)},cn=(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',padding:zi?4:dt<820?8:12,paddingTop:zi?Ii?2:4:dt<820?Ii?4:6:Ii?8:10,gap:zi?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:yi,Pt?(0,qe.jsx)(V.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"})}):gi?hi:ui,bi,ln]}),(0,qe.jsxs)(U.default,{testID:"display-side",style:{width:bt,gap:dt<820?4:8,minHeight:0},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ki(!1)}),(0,qe.jsx)(U.default,{style:{flexShrink:0},children:ji}),Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",onLayout:Ui,style:Ii&&!Ni?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:dt<820,snug:dt<820,tight:dt<800,fill:Ii&&!Ni,sound:(0,E.flapSoundOn)(),onPress:dn})}),Pt?null:(0,qe.jsx)(U.default,{ref:Ti,testID:"day-graph-slot",onLayout:Ui,style:{flexGrow:0,flexShrink:Ii?0:1,flexBasis:(ct?Di:vi)+(Ii?Mi:Hi),height:(ct?Di:vi)+(Ii?Mi:Hi),minHeight:dt<=600?90:Math.min((ct?Di:vi)+We.DAY_GRAPH_CHROME,!ct&&dt>=768?140+We.DAY_GRAPH_CHROME:120),overflow:'visible'},children:on}),Ii&&!Pt?(0,qe.jsx)(U.default,{ref:$i,testID:"display-side-split",onLayout:Ui,style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})}):null,(0,qe.jsxs)(V.default,{testID:"display-side-scroll",style:Ii?{flexGrow:0,flexShrink:1,minHeight:Wi&&Ei?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Bi.current&&(Bi.current=s,Li(s),setTimeout(Ui,0))},children:[Ii||xi?null:(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),qi,(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt})]})]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Ds.current=Date.now()},onMouseDown:()=>{Ds.current=Date.now()},children:[ct?(0,qe.jsx)(U.default,{style:{flex:1},children:(0,qe.jsxs)(V.default,{ref:yt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,qe.jsxs)(U.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,qe.jsx)(U.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,qe.jsx)(j.ExitButton,{})}),(0,qe.jsx)(X.RestaurantLogo,{rid:mt,size:64}),(0,qe.jsx)(Y.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:jt.name}),(0,qe.jsx)(X.PoweredBy,{}),(0,qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(U.default,{accessible:!0,accessibilityLabel:`Current time ${(0,ee.hm)(St)}`,children:(0,qe.jsx)(Y.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,ee.hm)(St)})}),(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:"m"}),(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",size:"m"}),Z]}),Fe,I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(ke.BookingSaveBanner,{rid:mt}),an,(0,qe.jsx)(U.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(it,{phone:!0,split:Ll,items:[{label:`Tables \xb7 ${dl}`,value:Bl.length,testID:'badge-tables'},{label:`Covers \xb7 ${dl}`,value:Wl,testID:'badge-covers'},{label:'Takeaway',value:qs.length,alert:qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ls(!0)}]})}),(0,qe.jsx)(U.default,{testID:"primary-actions",style:{gap:8},children:ki(!0)}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt}),ji,(0,qe.jsxs)(U.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[gi?hi:ui,bi]}),(0,qe.jsxs)(U.default,{onLayout:e=>{pt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ne.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Y.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Xi," (",Qi.length,")"]}),(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{gap:4},children:Zi})]}),qi,on,(0,qe.jsx)(U.default,{testID:"covers-dock",children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>yt.current?.scrollTo({y:pt.current,animated:!0})})}),(0,qe.jsxs)(U.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,qe.jsx)(Y.T,{center:!0,size:14,colour:Et?se.colours.muted:se.colours.amber,children:Et?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Y.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Rs(!0),style:{minHeight:48,alignSelf:'stretch'}}),xi?null:(0,qe.jsx)(Y.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ki]})}):(0,qe.jsxs)(qe.Fragment,{children:[Ii?(0,qe.jsx)(U.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:se.colours.hairline},children:(0,qe.jsx)(U.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)(U.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,paddingVertical:zi?2:dt<820?4:8,gap:8,minHeight:zi&&Ii?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ne.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(U.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:Ii?16:8,minWidth:0,overflow:'hidden',...Ii?{justifyContent:'flex-start'}:null},children:[(0,qe.jsx)(U.default,{testID:"display-header-brand",style:Ii?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(X.RestaurantBrand,{rid:jt.id,size:at<900?32:40,beside:!0,noLogo:Ii})}),(0,qe.jsxs)(U.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Y.T,{size:at<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,ee.hm)(St)}),at>=900?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:(0,ee.niceDate)(St)}):null]})]}),Pt?(0,qe.jsx)(U.default,{style:{width:220}}):(0,qe.jsx)(U.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:an}),(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,qe.jsxs)(U.default,{testID:"display-header-chips",style:{flexDirection:at>=1400||Ii?'row':'column',alignItems:at>=1400||Ii?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:at<1240?'xs':at<1280||dt<700?'s':'m'}),Pt?null:(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",slot:Ii,size:at<1340?'xs':at<1400||dt<700?'s':'m'})]}),'simulated'===vt?(0,qe.jsx)(F.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>Dt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,Z,e?null:(0,qe.jsx)(U.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(j.ExitButton,{size:44})})]})]}),Fe,I.IS_CAR||!Pt||Ii?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(ke.BookingSaveBanner,{rid:mt,margin:{marginHorizontal:12,marginTop:6}}),Pt||Ii?null:(0,qe.jsx)(U.default,{testID:"display-day-stats",style:Xe,children:(0,qe.jsxs)(U.default,{style:Ze,children:[I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(U.default,{style:et,children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})})]})}),ht?cn:(un=(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{testID:"front-door-bar",style:{gap:10},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ki(!1)}),ji]}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt}),Pt?(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"}):(0,qe.jsx)(qe.Fragment,{children:(0,qe.jsxs)(U.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[yi,gi?hi:ui,bi,ln]})]})}),qi,Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,sound:(0,E.flapSoundOn)(),onPress:dn})}),Pt?null:(0,qe.jsx)(U.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Di+We.DAY_GRAPH_CHROME},children:on})]}),(0,qe.jsx)(V.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:un})),Ki]}),(0,qe.jsx)($.SoldOutStrip,{rid:mt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:zs,onClose:()=>Hs(!1),rid:mt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:mt}),Mt.elements,is?(0,qe.jsx)(y.EditBookingPicker,{rid:mt,today:Ht,who:Lt,onClose:()=>ns(!1)}):null,os?(0,qe.jsx)(y.EditBookingSheet,{rid:mt,id:os,who:Lt,onClose:()=>as(null)}):null,Qt?(0,qe.jsx)(ve.TableSheet,{rid:mt,name:Qt,view:Xs,plan:Nt,todays:Us,now:St,privacy:Et,turnBase:jt.settings.turnMins,onClose:()=>Jt(null),onWalkIn:e=>Mt.openWalkInAt(e),onMove:e=>Zt(e),onDetails:Vs}):null,Il?(()=>{const e=kl[Il],t=e?.dayBookings??[];return(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>{$l(null),Dl(null)},title:`${(0,d.tableNumbersA11y)(Il)} \xb7 ${cl?dl:(0,ze.dayLong)(al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Y.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${cl?dl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${cl?dl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Et):tt(e.name);return(0,qe.jsx)(Y.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,Ie.tablesWords)((0,ae.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Dl(null),fs(e.id)},style:{minHeight:56}},e.id)}),al>=Ht?(()=>{const t=e?.table.maxSeats??0,s=kt.filter(e=>e.date===al&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,ae.tablesOf)(e.table).includes(Il)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,qe.jsxs)(U.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(Il)]}),Rl?(0,qe.jsxs)(U.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Rl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Rl.ask}),(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!wi.ok,accessibilityHint:wi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=kt.find(e=>e.id===Rl.id);if($l(null),!e)return;const s=tt(e.name);Dl(null),await(0,ke.saveTablesReported)(mt,e,[Il],s,t,Es)}}),(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>$l(null)})]})]}):null,Rl?null:s.slice(0,12).map(e=>{const s=tt(e.name),l=e.partySize>t;return(0,qe.jsx)(Y.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:!wi.ok,accessibilityHint:wi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(Il)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,ke.guardBookingChange)(Es,{b:e,tables:[Il]}))return;const l=(0,Ie.overCapacityAsk)([Il],t,e.partySize);l?$l({id:e.id,ask:l}):(Dl(null),await(0,ke.saveTablesReported)(mt,e,[Il],s,t,Es))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Y.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{$l(null),Dl(null)},style:{minHeight:56}})]})})():null,ps?(()=>{const e=kt.find(e=>e.id===ps);return e?(0,qe.jsx)(je.GuestActionsSheet,{rid:mt,b:e,name:e.walkIn?(0,fe.privName)(e,Et):tt(e.name),view:Xs,now:St,otherDay:e.date!==Ht,turnBase:jt.settings.turnMins,onClose:()=>fs(null),onDetails:Vs,onDone:Es,onEdit:e=>{fs(null),as(e.id)},onPickOnPlan:(e,t)=>{gs(!1),Vt('plan'),Yt('all'),ms({id:e.id,tables:t})}}):null})():null,es?(0,qe.jsx)(ve.DetailsPanel,{title:es.title,onClose:()=>ts(null),children:es.body}):null,rn,rs?(0,qe.jsx)(ve.ServiceSummary,{r:jt,todays:Us,orders:wt,waitlistAll:Ss,walkInCount:Cs,onClose:()=>ds(!1)}):null,Ts?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Rs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsx)(Y.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Rs(!1)})]}):null,Ws?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ls(!1),Bs(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,$s?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(Q.ReviewsSection,{rid:mt,mode:"read",venueName:jt.name}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,ss?(0,qe.jsxs)(ve.DetailsPanel,{title:"Takeaway",onClose:()=>ls(!1),children:[(0,qe.jsx)(Y.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(ot,{list:qs,me:Lt,bookings:kt})]}):null,Os?(0,qe.jsx)(U.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,qe.jsx)(he.PlanDesigner,{initial:Nt,venue:jt.name,mode:"display",startStep:"arrange",onActivity:()=>{_s.current=Date.now(),null!==Gs&&Fs(null)},notice:null!==Gs?`Locking again in ${Gs} s \xb7 touch to keep editing`:null,onSave:e=>{ae.useFloor.getState().setPlan(mt,e),Ns(null),Es('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{ae.useFloor.getState().setPlan(mt,e),Es('Live seating plan updated on every screen.')},onCancel:()=>{Ns(null),Es('No changes kept. Editing is locked again.')}},Os.at)}):null,e?null:(0,qe.jsx)(ye.Screensaver,{rid:mt,idleMins:At.idleMins,pinOn:At.pinOn,wake:At,tonightCards:At.tonightCards,cfg:Ot}),e?null:(0,qe.jsx)(Ce.PrintHost,{rid:mt}),e?null:(0,qe.jsx)(Se.AlertHost,{variant:"display",rid:mt,skipTakeaway:!0}),e?null:(0,qe.jsx)(O.SeatAllergenReminder,{rid:mt}),e?null:(0,qe.jsx)(Te.TakeawayTakeover,{rid:mt,me:Lt})]});var un}function rt({rid:e,id:t,turnBase:s}){const l=(0,te.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1319,[1051,779,805,806,1320,813,1321,1092,843,1138,1322,1323,1324,1089,1119,1325,1326,1331,1332,1200,1333,856,1338,1339,1340,1112,1111,920,1341,1150,891,1102,1342,17,1070,1176,1016,1085,1343,378,363,385,278,85,409,19,777,1216,1220,857,845,863,858,804,1088,876,1096,1055,996,1074,1107,1344,1106,1345,1352,1354,1357,1362,1356,1363,1366,1367,1114,1093,1094,862,1372,1205,1373,1215,1207,993,1378,1383,1384,1052,1050,1116,1386,1387,1388,1069,1169,1389,1168,1159,853,1334,1390,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 Je}}),_e2.DisplayBoard=function(e={}){const t=(0,ie.useOwner)(e=>e.site);return(0,te.useRestaurant)(t)?(0,qe.jsx)(at,{...e}):(0,qe.jsx)(U.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Y.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]),S=_r(_d[23]),v=_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=_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]),Se=_r(_d[76]),ve=_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]);const Ye='#221C12',Qe='#2E2618',Je=12e4,Xe={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},Ze={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},et={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},tt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),lt=e=>e.slotTime?(0,ee.hm)(new Date(e.slotTime)):'ASAP';function it({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,qe.jsxs)(U.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)(U.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)(U.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)(Y.T,{size:s?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,qe.jsx)(Y.T,{size:s?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,qe.jsx)(F.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)(U.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)(Y.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,qe.jsxs)(U.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,qe.jsx)(U.default,{style:{width:`${l.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,qe.jsx)(U.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,qe.jsxs)(F.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)(U.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,qe.jsx)(Y.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Y.T,{size:12,colour:se.colours.muted,children:s}):null]})}function ot({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ve.statusBlock)(e,t,(0,Ve.linkedBooking)(e,l));return e.length?(0,qe.jsx)(U.default,{style:{gap:8},children:e.map(e=>(0,qe.jsxs)(U.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:s?16:18,weight:"bold",children:[lt(e)," \xb7 ",tt(e.customerName)]}),(0,qe.jsx)(Y.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)(Y.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)(Y.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,Z.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Fe.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Y.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Y.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>te.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Y.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Y.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Ce.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Y.Muted,{children:"No takeaway orders right now."})}function at({embedded:e=!1,boardW:b,headerExtra:Z,subHeader:Fe,noVoice:Ve=!1}={}){const lt=(0,K.default)(),at=b??lt.width,dt=lt.height,ct=at<700,ut=at>=dt,ht=!ct&&ut&&at>=600,gt=ht,bt=Math.round(Math.min(520,Math.max(at>=1e3?448:280,.3*at))),yt=P.default.useRef(null),pt=P.default.useRef(0),[ft,xt]=(0,H.useState)({w:0,h:0}),mt=(0,ie.useOwner)(e=>e.site),jt=(0,te.useRestaurant)(mt);(0,Re.useAlertWatcher)(mt,{enabled:!e});const wt=(0,te.useOrders)(mt),It=(0,te.useBookings)(mt),kt=(0,te.useEvents)(mt),Dt=(0,te.useStore)(e=>e.skipMinutes),St=(0,te.useStore)(e=>e.clock.mode),vt=(0,te.useNow)(5e3),Ct=(0,ie.useOwner)(e=>e.staff),Tt=(0,ie.useOwner)(e=>e.attendance),Rt=(0,ie.useOwner)(e=>e.shifts),$t=(0,ie.useOwner)(e=>e.leave),Bt=P.default.useMemo(()=>(0,Ee.workingShifts)(Rt,$t),[Rt,$t]);P.default.useEffect(()=>{(0,oe.ensureAttendance)((0,ee.ymd)(vt),vt)},[(0,ee.ymd)(vt)]);const Wt=(0,R.useSession)(e=>e.meId),Lt=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:tt(Ct.find(e=>e.id===Wt)?.name)}),zt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Ht=(0,ee.ymd)(vt),Pt=(0,A.useTravelDay)('display',Ht),Mt=(0,ne.useFrontDoor)(Ht,ut),At=(0,ae.useDisplaySettings)(mt),Ot=At.privacy,Et=(0,pe.useSaverSync)(),Nt=(0,ae.usePlan)(mt),_t=(0,ae.useFloor)(e=>e.live[mt]),Gt=(0,$e.useBlocks)(e=>e.blocks),[Ft,Vt]=(0,H.useState)('plan'),[Ut,Kt]=(0,H.useState)(!1),[qt,Yt]=(0,H.useState)('all'),[Qt,Jt]=(0,H.useState)(null),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(!1),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(null),[rs,ds]=(0,H.useState)(!1),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(null),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(!1),Ds=P.default.useRef(0),Ss=e=>{Ds.current=Date.now(),ws(e)};P.default.useEffect(()=>{if(!js)return;const e=setInterval(()=>{Date.now()-Ds.current>=ze.DAY_IDLE_MS&&ws(null)},5e3);return()=>clearInterval(e)},[js]);const vs=(0,te.useWaitlist)(mt),Cs=(0,te.useStore)(e=>e.walkIns[mt]??0),[Ts,Rs]=(0,H.useState)(!1),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1);(0,J.useReviewAlerts)(mt);const[Ps,Ms]=(0,H.useState)({view:0,content:0}),[As,Os]=(0,H.useState)(null);P.default.useEffect(()=>{As&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:As,timeoutMs:4500,big:!0,testID:'floor-toast'}),Os(null))},[As]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[Es,Ns]=(0,H.useState)(null),_s=P.default.useRef(0),[Gs,Fs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Es)return;_s.current=Date.now();const e=setInterval(()=>{const e=Date.now()-_s.current;if(e>=Je)return Ns(null),void Os('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Fs(e>=105e3?Math.ceil((Je-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Es]);const Vs=e=>e.date!==Ht?ts({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Ht)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Ht?(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Ht)}, ${e.time}`,disabled:!wi.ok,accessibilityHint:wi.hint,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ts({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(rt,{rid:mt,id:e.id,turnBase:jt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(we.CancelWalkInButton,{rid:mt,b:e,big:!0,onDone:e=>{ts(null),Os(e)}}):null,e.walkIn?(0,qe.jsx)(we.ReinstateWalkInButton,{rid:mt,b:e,today:Ht,onDone:e=>{ts(null),Os(e)}}):null,(0,Se.bookingDetails)(e)]})}),Us=It.filter(e=>e.date===Ht).sort((e,t)=>e.time.localeCompare(t.time)),Ks=Us.filter(e=>!['cancelled','noshow'].includes(e.status)),qs=wt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,H.useMemo)(()=>(0,c.forecastToday)(jt,It,wt,kt,vt),[jt,It,wt,kt,vt.getTime()/6e4|0]),Qs=(0,$e.closedAreasAt)(Gt,mt,Ht,(0,ee.hm)(vt)),Js=[...Qs].join(','),Xs=(0,H.useMemo)(()=>(0,re.floorView)(Nt,It,wt,_t??{},vt,jt.settings.turnMins,Qs),[Nt,It,wt,_t,vt.getTime(),Js]),Zs=(0,De.hoursFor)(jt,vt),el=Zs?.open??new Date(`${Ht}T12:00:00`),tl=Zs?.close??new Date(`${Ht}T21:00:00`),sl=(0,ee.addMins)(el,-el.getMinutes()),ll=(0,ee.addMins)(tl,30),il=e=>new Date(`${Ht}T${e}:00`),nl=(0,$e.blocksOn)(Gt,mt,Ht).map(e=>({from:il(e.from),to:il(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(jt,vt,Ht)),ol=Object.keys(Xs).filter(e=>'blocked'===Xs[e]?.status),al=js&&js!==Ht?js:Ht,rl=al!==Ht,dl=(0,ze.dayWord)(al,Ht),cl=/^(Today|Yesterday|Tomorrow)$/.test(dl),ul=rl?(0,ze.bookingsForDay)(It,al,Ht).sort((e,t)=>e.time.localeCompare(t.time)):Us,hl=(0,ee.parseYmd)(al);hl.setHours(12);const gl=rl?(0,De.hoursFor)(jt,hl):Zs,bl=gl?.open??new Date(`${al}T12:00:00`),yl=gl?.close??new Date(`${al}T21:00:00`),pl=e=>new Date(`${al}T${e}:00`),fl=[...rl?(0,$e.blocksOn)(Gt,mt,al).map(e=>({from:pl(e.from),to:pl(e.to),label:e.reason??'Paused'})):nl,...rl?(0,n.queuedServicePauses)(jt,hl,al):[]],xl=(0,n.queuedServiceSessions)(jt,hl),ml=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),jl=(0,qe.jsxs)(U.default,{testID:"queued-hours-gate",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Y.Muted,{children:i.queuedVenues[mt]?.hours.note})]}),wl=rl?gl||ul.length?alrl?(0,re.dayFloorView)(Nt,ul,al):Xs,[rl,Nt,ul,al,Xs]),[kl,Dl]=(0,H.useState)(null),[Sl,vl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(!1),[Rl,$l]=(0,H.useState)(null),Bl=rl?ul.filter(e=>!['cancelled','noshow'].includes(e.status)):Ks,Wl=Bl.reduce((e,t)=>e+t.partySize,0),Ll=(0,u.coversSplit)(Bl,al),zl=(0,Pe.cancelledDayTally)(It,al),Hl=(0,Me.cancellationsFor)(It,al,e=>e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)','')),Pl=(0,Pe.cancelledTallyWords)(zl,cl?dl.toLowerCase():rl?`on ${dl}`:'today'),Ml=Gt.filter(e=>e.rid===mt&&e.date===al&&!e.removedAt),Al=60*bl.getHours()+bl.getMinutes(),Ol=60*yl.getHours()+yl.getMinutes(),El=(0,Le.chartBands)(Ml,Al,Ol),Nl=(0,Le.seasonClosedAreaIds)(Ml,Al,Ol),_l=Nl.size?{...Nt,areas:Nt.areas.filter(e=>!Nl.has(e.id)),tables:Nt.tables.filter(e=>!Nl.has(e.areaId))}:Nt,Gl=rl?[]:ol.filter(e=>!Nl.has(Nt.tables.find(t=>t.name===e)?.areaId??'')),Fl=new Set((0,Le.blockedHours)(El)),Vl=vt.getHours()+(vt.getMinutes()>=30?1:0),Ul=Ys.hours.filter(e=>e.hour>=Vl&&!Fl.has(e.hour)),Kl=Ul.reduce((e,t)=>e+t.coversHigh,0),ql=Ul.reduce((e,t)=>e+t.coversLow,0),Yl=Math.round((ql+Kl)/2),Ql=!Ys.example&&Ys.open&&Ys.enough&&Kl>0?`Usually ${(0,c.coversRange)(Yl,Yl)} more`:void 0,Jl=async(e,t)=>{const s=Xs[e]?.booking;if(!s||e===t)return;const l=Xs[t]?.status;if(l&&!['free','soon'].includes(l))return void Os('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${re.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(Os,{b:s,tables:[t]}))return;await te.repo.bookings.update(s.id,{table:t});const i=_t?.[e]?.stage;ae.useFloor.getState().setLive(mt,t,{stage:i??'seated',dirty:!1}),ae.useFloor.getState().setLive(mt,e,{stage:void 0,dirty:!0}),Os(`Saving: ${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(s.id,`${(0,fe.privName)(s,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}`,Os)},Xl=e=>{if(xs)return vl(null),void ms(t=>t?{...t,tables:(0,ke.toggleTable)(t.tables,e)}:t);rl?Dl(e):Xt?(e!==Xt&&Jl(Xt,e),Zt(null)):Jt(e)},Zl=xs?It.find(e=>e.id===xs.id):void 0,ei=xs&&Zl?(()=>{const e=Zl.walkIn?(0,fe.privName)(Zl,Ot):tt(Zl.name),t=(0,ke.seatsOf)(Nt,xs.tables).total,s=(0,ke.seatLine)(t,Zl.partySize),l=(0,ke.pickClashes)(Zl,xs.tables,It.filter(e=>e.date===Zl.date),jt.settings.turnMins),i=(0,ke.tableKey)(xs.tables)!==(0,ke.tableKey)((0,ae.tablesOf)(Zl.table));return(0,qe.jsxs)(U.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,qe.jsxs)(U.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Zl.date,Ht)} ${Zl.time}. Tap tables on the plan to add or take them off. ${(0,ke.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Zl.date,Ht)," ",Zl.time]}),(0,qe.jsxs)(Y.T,{size:16,colour:se.colours.text,children:[(0,ke.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Sl?(0,qe.jsx)(U.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Sl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,qe.jsx)(Y.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Sl})}):null,Cl&&Zl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Tl(!1),(async()=>{if(!(0,Ie.guardBookingChange)(Os,{b:Zl,tables:xs.tables}))return vl(null),void ms(null);const s=xs.tables;ms(null),await(0,Ie.saveTablesReported)(mt,Zl,s,e,t,Os)})()},onNo:()=>Tl(!1)}):null,(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.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,ke.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Zl)return void ms(null);if(!(0,Ie.guardBookingChange)(Os,{b:Zl,tables:xs.tables}))return vl(null),void ms(null);const s=(0,ke.overCapacityAsk)(xs.tables,t,Zl.partySize);if(s&&!Sl)return void vl(s);if('finished'===Zl.status&&xs.tables.length&&!Cl)return void Tl(!0);vl(null),Tl(!1);const l=xs.tables;ms(null),await(0,Ie.saveTablesReported)(mt,Zl,l,e,t,Os)}}),(0,qe.jsx)(Y.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{vl(null),ms(null)}})]})]})})():null,ti=_l.areas.filter(e=>_l.tables.some(t=>t.areaId===e.id)),si=e=>{const t=Nt.tables.filter(t=>t.areaId===e);return rl?`${t.filter(e=>!Il[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Xs[e.name]?.status??'free')).length}/${t.length} free`},li='all'===qt||ti.some(e=>e.id===qt)?qt:'all',ii=e=>(0,qe.jsx)(de.FloorCanvas,{plan:_l,areaId:e,mode:"live",fit:"contain",crop:!0,fill:ht,big:!0,view:Il,privacy:Ot,turnBase:jt.settings.turnMins,highlight:xs?xs.tables:Xt?[Xt]:void 0,onTap:e=>Xl(e.name),onDrop:(e,t)=>xs||rl?void 0:Jl(e.name,t.name)}),ni=ct?1:ut||ti.length>2?2:1,oi=e=>{const t=Nt.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},ai=[];for(let e=0;e{const t=(0,de.areaBounds)(Nt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,de.minReadableScale)(Nt,e.id)}}),ft.w,ft.h):null,di=e=>(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',height:ce.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:si(e.id)})]}),ci=(0,qe.jsx)(U.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-ft.w)>1||Math.abs(s-ft.h)>1)&&xt({w:t,h:s})},children:ri?(0,qe.jsx)(V.default,{style:{flex:1},scrollEnabled:ri.scroll,showsVerticalScrollIndicator:ri.scroll,contentContainerStyle:{gap:ce.GRID_GAP},children:ri.rows.map((e,t)=>(0,qe.jsx)(U.default,{style:{height:ri.rowHeights[t],flexDirection:'row',gap:ce.GRID_GAP},children:e.map(e=>{const t=ti.find(t=>t.id===e);return(0,qe.jsxs)(U.default,{testID:`area-cell-${e}`,style:{width:ri.cellW,gap:2},children:[di(t),(0,qe.jsx)(U.default,{style:{flex:1},children:ii(e)})]},e)})},t))}):null}),ui=(0,qe.jsxs)(U.default,{testID:"venue-plan",style:{flex:ct?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:Nt}),Nt.tables.length?null:(0,qe.jsxs)(U.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,qe.jsx)(Y.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Y.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)(Y.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,qe.jsx)(nt,{chipId:"all",compact:!ct,label:"Whole venue",selected:'all'===li,onPress:()=>Yt('all')},"__all"),...ti.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ct,label:`${e.name}${(0,ue.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ct?Qs.has(e.id)?'closed':li===e.id?si(e.id):void 0:void 0,selected:li===e.id,onPress:()=>Yt(e.id)},e.id))];return ct?(0,qe.jsx)(U.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,qe.jsx)(V.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:Ps.view>0&&Ps.content>0&&Ps.content<=Ps.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ps.view>0&&Ps.content<=Ps.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),ei,Xt?(0,qe.jsxs)(Y.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Y.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Xt),": tap the new table."]}),(0,qe.jsx)(Y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Zt(null)})]}):null,'all'===li&&ht?ci:'all'===li?(0,qe.jsx)(U.default,{style:{flex:ct?void 0:1,gap:12,minHeight:gt?void 0:360},children:ai.map((e,t)=>(0,qe.jsxs)(U.default,{style:{flex:ct?void 0:Math.max(.3,...e.map(e=>oi(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(U.default,{style:{flex:1,gap:2},children:[ct?(0,qe.jsxs)(U.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Y.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{center:!0,children:si(e.id)})]}):(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{children:si(e.id)})]}),(0,qe.jsx)(U.default,{style:ct?{height:Math.max(280,Math.round((at-40)*oi(e.id)))}:{flex:1},children:ii(e.id)})]},e.id)),e.length{if(rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},al)}),gi='timeline'===Ft,bi=Ut?(0,qe.jsx)(_.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Kt(!1),supportedOrientations:['landscape','portrait'],children:(0,qe.jsxs)(U.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,qe.jsx)(F.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Kt(!1),style:{minHeight:64,minWidth:at<600?120:180,paddingHorizontal:at<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,qe.jsx)(U.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,qe.jsx)(Y.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${rl?(0,ze.dayLong)(al):'Today'}`})}),at<600?null:(0,qe.jsx)(U.default,{style:{minWidth:180}})]}),ml?jl:(0,qe.jsx)(U.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(be.Timeline,{hideNow:!0,fit:!0,plan:_l,bookings:rl?ul:Us,now:rl?bl:vt,privacy:Ot,turnBase:jt.settings.turnMins,t0:rl?(0,ee.addMins)(bl,-bl.getMinutes()):sl,t1:rl?(0,ee.addMins)(yl,30):ll,pauses:rl?fl:nl,blockedTables:Gl,onOpen:e=>{if(Kt(!1),rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},`full-${al}`)})]})}):null,yi=rl?(0,qe.jsxs)(U.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:cl?`Showing ${dl} \xb7 ${(0,ee.niceDate)((0,ee.parseYmd)(al))}`:`Showing ${(0,ze.dayWord)(al,Ht)}`}),(0,qe.jsx)(U.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Pl}. Showing ${(0,ze.dayLong)(al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Y.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ms(null),Ss(null)},style:{minHeight:44}})]}):null,pi=(0,qe.jsx)(U.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:ct?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(gi||Ut);return(0,qe.jsx)(F.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?(Vt('plan'),Kt(!0)):(Kt(!1),Vt('plan'))},style:{flex:ct?1:void 0,minHeight:ct?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',...Ne.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)(Y.T,{size:ct?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),fi='display'===k.APP_VARIANT&&!e,xi='display'===k.APP_VARIANT&&!e,mi=!e&&!k.IS_CAR&&!ct,ji=fi?(0,qe.jsxs)(U.default,{testID:"display-view-row",style:{flexDirection:ct?'column':'row',flexWrap:ct||mi?'nowrap':'wrap',gap:6,alignItems:ct||mi?'stretch':'center'},children:[pi,(0,qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ct,fill:mi,shifts:Rt,staff:Ct,today:Ht,leave:$t})]}):pi,wi=(0,h.useBookingWrite)(),Ii=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Walk-in",onPress:Mt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"New booking",onPress:Mt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint})]});(0,Ke.useDisplayNotices)(mt,!e);const ki=!e&&!k.IS_CAR&&!ct,Di=ct?180:202,[Si,vi]=(0,H.useState)(ct?180:168),Ci=P.default.useRef(ct?180:168),Ti=P.default.useRef(null),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(!1),[Wi,Li]=(0,H.useState)(!1),zi=!ct&&dt<=800,Hi=We.DAY_GRAPH_CHROME+(zi?24:8),Pi=P.default.useRef(0),[Mi,Ai]=(0,H.useState)(Hi),[Oi,Ei]=(0,H.useState)(!0),[Ni,Gi]=(0,H.useState)(!1);P.default.useEffect(()=>{Gi(!1)},[at,dt]);const Fi=P.default.useRef(()=>{}),Vi=P.default.useCallback(e=>{Math.abs(e-Pi.current)>=2&&(Pi.current=e,setTimeout(()=>Fi.current(),0))},[]),Ui=()=>{const e=Ti.current,t=Ri.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=t>Ci.current?Math.ceil(t-Ci.current):0,o=ki?Math.max(Hi,Pi.current):Math.max(Hi,n);ki&&o!==Mi&&Ai(o);const a=!ct&&dt>=700?140:70,r=Math.floor(s-4-e)-o-l,d=i>0&&r-i>=a;ki&&d!==Oi&&Ei(d),ki&&!Ni&&r<48&&Gi(!0);const c=r-(d?i:0),u=Math.min(Di,c>=a?Math.max(a,c):Math.max(0,c));Math.abs(Ci.current-u)>=2&&(Ci.current=u,vi(u))},l=44+(dt<820?4:8),i=46+(dt<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=$i.current;ki&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=dt<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Bi.current?44+d:0)}):s(n,a,t,ki?i:l)})})};Fi.current=Ui,P.default.useEffect(()=>{const e=setTimeout(()=>Fi.current(),60),t=setTimeout(()=>Fi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[at,dt,al]);const Ki=(0,qe.jsxs)(U.default,{ref:Ri,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ui()},style:{flexDirection:'row',flexWrap:at>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ct?12:zi?2:6,justifyContent:ct?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ue.DisplayClockButton,{}),(0,qe.jsx)(ge.HoldToEdit,{quiet:!0,onUnlock:()=>{Fs(null),Ns({at:Date.now()})},onHint:()=>Os('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(Be.BlockBookingsButton,{rid:mt,r:jt,now:vt,by:Lt,quiet:!0,display:!0,day:al}),Nt.areas.some(e=>e.outdoor)?(0,qe.jsx)(Be.CloseGardenButton,{rid:mt,r:jt,now:vt,by:Lt,quiet:!0,short:!0}):null,(0,qe.jsx)(F.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Hs(!0),style:({pressed:e})=>({...Ne.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,qe.jsx)(f.GiftQrButton,{rid:mt,venue:jt.name})]}),qi=qs.length?(0,qe.jsxs)(U.default,{testID:"takeaway-panel",style:[Ne.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Y.T,{size:12,colour:se.colours.muted,children:[qs.length," live"]})]}),(0,qe.jsx)(U.default,{style:{padding:10},children:(0,qe.jsx)(ot,{list:qs,me:Lt,compact:!0,bookings:It})})]}):null,Yi=(Oe.DueToday,jt.settings.turnMins||90),Qi=rl?ul:(0,S.todaysGuestList)(Us,vt,Yi),Ji=rl?[]:(0,S.todaysFinishedList)(Us,vt,Yi),Xi=rl?cl?`${dl}\u2019s guests`:`Guests ${dl}`:'Today\u2019s guests',Zi=(0,qe.jsxs)(qe.Fragment,{children:[0===Qi.length?(0,qe.jsx)(Y.Muted,{children:rl?al{const t=(0,S.isLeftEarly)(e,vt,Yi),s=(0,le.isSeatedHighlight)(e.status,{otherDay:rl})&&!t,l=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=se.colours.text,n=s?se.colours.goldLight:se.colours.muted,o=se.colours.gold,a=l.depositWarn?se.colours.amber:se.colours.goldLight;return(0,qe.jsxs)(F.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:rl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,le.seatedHighlightStyle)({backgroundColor:e?Qe:Ye,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,qe.jsx)(Y.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)(U.default,{style:{paddingTop:2},children:(0,qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,qe.jsx)(Y.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,qe.jsx)(Y.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&re.OCCASION_ICON[l.occasion]?(0,qe.jsx)(Y.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:re.OCCASION_ICON[l.occasion]}):null]}),(0,qe.jsxs)(Y.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Y.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}),(0,qe.jsx)(Y.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,qe.jsx)(Y.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(U.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(me.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,qe.jsx)(Y.T,{size:15,colour:se.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),Ji.length?(0,qe.jsxs)(U.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(F.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ji.length}${bs?', expanded':', collapsed'}`,accessibilityState:{expanded:bs},onPress:()=>ys(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Y.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ji.length,")"]}),(0,qe.jsx)(Y.T,{size:16,colour:se.colours.muted,children:bs?'\u25be':'\u25b8'})]}),bs?Ji.map(e=>{const t=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,qe.jsxs)(F.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Y.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Y.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,qe.jsx)(U.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,qe.jsx)(v.BookingUndo,{b:e,rid:mt,today:Ht,who:t.name,allowed:wi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ae.CancellationsSection,{items:Hl,dayWord:rl?cl?dl.toLowerCase():`on ${dl}`:'today'})]}),en=(0,qe.jsx)(V.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Zi}),tn=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&gs(!1)}}),sn=(0,qe.jsxs)(F.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Xi}, ${Qi.length}`,accessibilityState:{expanded:hs},'aria-expanded':hs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>gs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:hs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:hs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Y.T,{size:16,weight:"bold",colour:se.colours.gold,children:Qi.length}),(0,qe.jsx)(U.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(U.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,qe.jsxs)(Y.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Xi," ",hs?'\u2039':'\u203a']})})})]}),ln=Math.min(560,Math.max(320,.44*at))<400,nn=hs?(0,qe.jsxs)(U.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,qe.jsxs)(U.default,{testID:"guests-drawer",...tn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*at)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,...Ne.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,qe.jsxs)(U.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,qe.jsxs)(U.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsxs)(U.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,qe.jsxs)(Y.T,{testID:"guests-heading",size:ln?14:17,weight:"semibold",colour:se.colours.gold,style:{flexShrink:1,minWidth:0},children:[Xi.toUpperCase()," (",Qi.length,")"]}),(0,qe.jsx)(F.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:cs},'aria-expanded':cs,onPress:()=>us(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:ln?8:12,borderRadius:12,borderWidth:1,borderColor:cs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?se.colours.tilePressed:cs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:se.colours.goldLight,children:[ln?'Key':'Guest key'," ",cs?'\u25b4':'\u25be']})})]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Xi}`,onPress:()=>gs(!1),style:{marginRight:-6,flexShrink:0}})]}),zl.count?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Pl}):null,cs?(0,qe.jsxs)(U.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:se.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,qe.jsxs)(U.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:se.colours.amber,ink:se.colours.bg}),(0,qe.jsx)(Y.T,{size:14,children:"allergy"})]}),(0,qe.jsxs)(U.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(me.DogIcon,{size:18}),(0,qe.jsx)(Y.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,qe.jsxs)(U.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(Y.T,{size:16,children:e}),(0,qe.jsx)(Y.T,{size:14,children:t})]},t))]}):null]}),en]}),(0,qe.jsx)(F.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Xi}`,accessibilityRole:"button",onPress:()=>gs(!1),style:{flex:1}})]}):null,on=ml?jl:l.IS_KIRKTON&&!Object.values(jt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(U.default,{testID:"kirkton-hours-to-confirm",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Y.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(jt,It,vt).busy,todays:ul,open:bl,close:yl,now:vt,turnBase:jt.settings.turnMins,blocks:Ml,pauses:fl,compact:ct,dense:!ct,fit:ht,tight:ht&&dt<=600,height:ht?Si:Di,forecastNote:rl?void 0:Ql,emptyText:wl,past:al{Ds.current=Date.now(),ks(!0)},shortDay:!ct&&at<1100}),dn=(0,qe.jsx)(He.DisplayCalendar,{visible:Is,today:Ht,day:al,bookings:It,restaurant:jt,now:vt,onDay:Ss,onClose:()=>ks(!1)}),cn=()=>{rl?gs(!0):Kt(!0)},un=(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',padding:zi?4:dt<820?8:12,paddingTop:zi?ki?2:4:dt<820?ki?4:6:ki?8:10,gap:zi?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:yi,Pt?(0,qe.jsx)(V.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"})}):gi?hi:ui,bi,nn]}),(0,qe.jsxs)(U.default,{testID:"display-side",style:{width:bt,gap:dt<820?4:8,minHeight:0},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Ii(!1)}),(0,qe.jsx)(U.default,{style:{flexShrink:0},children:ji}),Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",onLayout:Ui,style:ki&&!Ni?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:dt<820,snug:dt<820,tight:dt<800,fill:ki&&!Ni,sound:(0,O.flapSoundOn)(),onPress:cn})}),Pt?null:(0,qe.jsx)(U.default,{ref:Ti,testID:"day-graph-slot",onLayout:Ui,style:{flexGrow:0,flexShrink:ki?0:1,flexBasis:(ct?Di:Si)+(ki?Mi:Hi),height:(ct?Di:Si)+(ki?Mi:Hi),minHeight:dt<=600?90:Math.min((ct?Di:Si)+We.DAY_GRAPH_CHROME,!ct&&dt>=768?140+We.DAY_GRAPH_CHROME:120),overflow:'visible'},children:an}),ki&&!Pt?(0,qe.jsx)(U.default,{ref:$i,testID:"display-side-split",onLayout:Ui,style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})}):null,(0,qe.jsxs)(V.default,{testID:"display-side-scroll",style:ki?{flexGrow:0,flexShrink:1,minHeight:Wi&&Oi?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Bi.current&&(Bi.current=s,Li(s),setTimeout(Ui,0))},children:[ki||xi?null:(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),qi,(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt})]})]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Ds.current=Date.now()},onMouseDown:()=>{Ds.current=Date.now()},children:[ct?(0,qe.jsx)(U.default,{style:{flex:1},children:(0,qe.jsxs)(V.default,{ref:yt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,qe.jsxs)(U.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,qe.jsx)(U.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,qe.jsx)(j.ExitButton,{})}),(0,qe.jsx)(X.RestaurantLogo,{rid:mt,size:64}),(0,qe.jsx)(Y.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:jt.name}),(0,qe.jsx)(X.PoweredBy,{}),(0,qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(U.default,{accessible:!0,accessibilityLabel:`Current time ${(0,ee.hm)(vt)}`,children:(0,qe.jsx)(Y.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,ee.hm)(vt)})}),(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:"m"}),(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",size:"m"}),Z]}),Fe,k.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:mt}),rn,(0,qe.jsx)(U.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(it,{phone:!0,split:Ll,items:[{label:`Tables \xb7 ${dl}`,value:Bl.length,testID:'badge-tables'},{label:`Covers \xb7 ${dl}`,value:Wl,testID:'badge-covers'},{label:'Takeaway',value:qs.length,alert:qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ls(!0)}]})}),(0,qe.jsx)(U.default,{testID:"primary-actions",style:{gap:8},children:Ii(!0)}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt}),ji,(0,qe.jsxs)(U.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[gi?hi:ui,bi]}),(0,qe.jsxs)(U.default,{onLayout:e=>{pt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ne.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Y.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Xi," (",Qi.length,")"]}),(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{gap:4},children:Zi})]}),qi,an,(0,qe.jsx)(U.default,{testID:"covers-dock",children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>yt.current?.scrollTo({y:pt.current,animated:!0})})}),(0,qe.jsxs)(U.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,qe.jsx)(Y.T,{center:!0,size:14,colour:Ot?se.colours.muted:se.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Y.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Rs(!0),style:{minHeight:48,alignSelf:'stretch'}}),xi?null:(0,qe.jsx)(Y.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ki]})}):(0,qe.jsxs)(qe.Fragment,{children:[ki?(0,qe.jsx)(U.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:se.colours.hairline},children:(0,qe.jsx)(U.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)(U.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,paddingVertical:zi?2:dt<820?4:8,gap:8,minHeight:zi&&ki?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ne.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(U.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:ki?16:8,minWidth:0,overflow:'hidden',...ki?{justifyContent:'flex-start'}:null},children:[(0,qe.jsx)(U.default,{testID:"display-header-brand",style:ki?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(X.RestaurantBrand,{rid:jt.id,size:at<900?32:40,beside:!0,noLogo:ki})}),(0,qe.jsxs)(U.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Y.T,{size:at<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,ee.hm)(vt)}),at>=900?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:(0,ee.niceDate)(vt)}):null]})]}),Pt?(0,qe.jsx)(U.default,{style:{width:220}}):(0,qe.jsx)(U.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:rn}),(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,qe.jsxs)(U.default,{testID:"display-header-chips",style:{flexDirection:at>=1400||ki?'row':'column',alignItems:at>=1400||ki?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:at<1240?'xs':at<1280||dt<700?'s':'m'}),Pt?null:(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",slot:ki,size:at<1340?'xs':at<1400||dt<700?'s':'m'})]}),'simulated'===St?(0,qe.jsx)(F.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>Dt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,Z,e?null:(0,qe.jsx)(U.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(j.ExitButton,{size:44})})]})]}),Fe,k.IS_CAR||!Pt||ki?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:mt,margin:{marginHorizontal:12,marginTop:6}}),Pt||ki?null:(0,qe.jsx)(U.default,{testID:"display-day-stats",style:Xe,children:(0,qe.jsxs)(U.default,{style:Ze,children:[k.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(U.default,{style:et,children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})})]})}),ht?un:(hn=(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{testID:"front-door-bar",style:{gap:10},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Ii(!1)}),ji]}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt}),Pt?(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"}):(0,qe.jsx)(qe.Fragment,{children:(0,qe.jsxs)(U.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[yi,gi?hi:ui,bi,nn]})]})}),qi,Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,sound:(0,O.flapSoundOn)(),onPress:cn})}),Pt?null:(0,qe.jsx)(U.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Di+We.DAY_GRAPH_CHROME},children:an})]}),(0,qe.jsx)(V.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:hn})),Ki]}),(0,qe.jsx)($.SoldOutStrip,{rid:mt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:zs,onClose:()=>Hs(!1),rid:mt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:mt}),Mt.elements,is?(0,qe.jsx)(y.EditBookingPicker,{rid:mt,today:Ht,who:Lt,onClose:()=>ns(!1)}):null,os?(0,qe.jsx)(y.EditBookingSheet,{rid:mt,id:os,who:Lt,onClose:()=>as(null)}):null,Qt?(0,qe.jsx)(Se.TableSheet,{rid:mt,name:Qt,view:Xs,plan:Nt,todays:Us,now:vt,privacy:Ot,turnBase:jt.settings.turnMins,onClose:()=>Jt(null),onWalkIn:e=>Mt.openWalkInAt(e),onMove:e=>Zt(e),onDetails:Vs}):null,kl?(()=>{const e=Il[kl],t=e?.dayBookings??[];return(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>{$l(null),Dl(null)},title:`${(0,d.tableNumbersA11y)(kl)} \xb7 ${cl?dl:(0,ze.dayLong)(al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Y.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${cl?dl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${cl?dl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Ot):tt(e.name);return(0,qe.jsx)(Y.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,ke.tablesWords)((0,ae.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Dl(null),fs(e.id)},style:{minHeight:56}},e.id)}),al>=Ht?(()=>{const t=e?.table.maxSeats??0,s=It.filter(e=>e.date===al&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,ae.tablesOf)(e.table).includes(kl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,qe.jsxs)(U.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(kl)]}),Rl?(0,qe.jsxs)(U.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Rl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Rl.ask}),(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!wi.ok,accessibilityHint:wi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Rl.id);if($l(null),!e)return;const s=tt(e.name);Dl(null),await(0,Ie.saveTablesReported)(mt,e,[kl],s,t,Os)}}),(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>$l(null)})]})]}):null,Rl?null:s.slice(0,12).map(e=>{const s=tt(e.name),l=e.partySize>t;return(0,qe.jsx)(Y.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:!wi.ok,accessibilityHint:wi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(kl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(Os,{b:e,tables:[kl]}))return;const l=(0,ke.overCapacityAsk)([kl],t,e.partySize);l?$l({id:e.id,ask:l}):(Dl(null),await(0,Ie.saveTablesReported)(mt,e,[kl],s,t,Os))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Y.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{$l(null),Dl(null)},style:{minHeight:56}})]})})():null,ps?(()=>{const e=It.find(e=>e.id===ps);return e?(0,qe.jsx)(je.GuestActionsSheet,{rid:mt,b:e,name:e.walkIn?(0,fe.privName)(e,Ot):tt(e.name),view:Xs,now:vt,otherDay:e.date!==Ht,turnBase:jt.settings.turnMins,onClose:()=>fs(null),onDetails:Vs,onDone:Os,onEdit:e=>{fs(null),as(e.id)},onPickOnPlan:(e,t)=>{gs(!1),Vt('plan'),Yt('all'),ms({id:e.id,tables:t})}}):null})():null,es?(0,qe.jsx)(Se.DetailsPanel,{title:es.title,onClose:()=>ts(null),children:es.body}):null,dn,rs?(0,qe.jsx)(Se.ServiceSummary,{r:jt,todays:Us,orders:wt,waitlistAll:vs,walkInCount:Cs,onClose:()=>ds(!1)}):null,Ts?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Rs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsxs)(U.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:se.colours.amber,ink:se.colours.bg}),(0,qe.jsx)(Y.T,{size:14,children:"allergy"})]}),(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(me.DogIcon,{size:18}),(0,qe.jsx)(Y.T,{size:14,children:"dog"})]}),(0,qe.jsx)(Y.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Rs(!1)})]}):null,Ws?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ls(!1),Bs(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,$s?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(Q.ReviewsSection,{rid:mt,mode:"read",venueName:jt.name}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,ss?(0,qe.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>ls(!1),children:[(0,qe.jsx)(Y.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(ot,{list:qs,me:Lt,bookings:It})]}):null,Es?(0,qe.jsx)(U.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,qe.jsx)(he.PlanDesigner,{initial:Nt,venue:jt.name,mode:"display",startStep:"arrange",onActivity:()=>{_s.current=Date.now(),null!==Gs&&Fs(null)},notice:null!==Gs?`Locking again in ${Gs} s \xb7 touch to keep editing`:null,onSave:e=>{ae.useFloor.getState().setPlan(mt,e),Ns(null),Os('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{ae.useFloor.getState().setPlan(mt,e),Os('Live seating plan updated on every screen.')},onCancel:()=>{Ns(null),Os('No changes kept. Editing is locked again.')}},Es.at)}):null,e?null:(0,qe.jsx)(ye.Screensaver,{rid:mt,idleMins:At.idleMins,pinOn:At.pinOn,wake:At,tonightCards:At.tonightCards,cfg:Et}),e?null:(0,qe.jsx)(Ce.PrintHost,{rid:mt}),e?null:(0,qe.jsx)(ve.AlertHost,{variant:"display",rid:mt,skipTakeaway:!0}),e?null:(0,qe.jsx)(E.SeatAllergenReminder,{rid:mt}),e?null:(0,qe.jsx)(Te.TakeawayTakeover,{rid:mt,me:Lt})]});var hn}function rt({rid:e,id:t,turnBase:s}){const l=(0,te.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1319,[1051,779,805,806,1320,813,1321,1092,843,1138,1322,1323,1324,1089,1120,1325,1326,1331,1332,1200,1333,856,1338,1339,1340,1113,1111,920,1341,1150,891,1102,1342,17,1070,1176,1016,1085,1343,378,363,385,278,85,409,19,777,1216,1220,857,845,863,858,804,1088,876,1096,1055,996,1074,1107,1344,1106,1345,1352,1354,1357,1362,1356,1363,1366,1367,1115,1093,1094,862,1372,1205,1373,1215,1207,993,1378,1383,1384,1052,1050,1117,1386,1387,1388,1069,1169,1389,1168,1159,853,1334,1390,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},1322,[]); @@ -1420,7 +1420,7 @@ __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(t,c){return}},1337,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.displayActionBy=function(t){if(t.isCar)return'Car';if(t.isDisplayApp)return'Display';return(t.personName??'').trim()||'Duty Manager'}},1338,[]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"finishClearPatch",{enumerable:!0,get:function(){return s.finishClearPatch}}),Object.defineProperty(e,"DEFAULT_TURN_MINS",{enumerable:!0,get:function(){return a}}),e.bookingEndAt=u,e.isLeftEarly=o,e.todaysGuestList=function(t,n,s=a){return t.filter(t=>'confirmed'===t.status||'seated'===t.status||o(t,n,s)).sort((t,n)=>t.time.localeCompare(n.time))},e.todaysFinishedList=function(t,n,s=a){return t.filter(t=>'finished'===t.status&&!o(t,n,s)).sort((t,n)=>t.time.localeCompare(n.time))};var t=r(d[0]),n=r(d[1]),s=r(d[2]);const a=90;function u(s,u=a){if(!s.date||!s.time)return null;const o=(0,n.atTime)((0,n.parseYmd)(s.date),s.time),f=u>0?u:a,c=s.durationMins&&s.durationMins>=15?s.durationMins:(0,t.turnFor)(s.partySize??2,f);return new Date(o.getTime()+6e4*c)}function o(t,s,o=a){if('finished'!==t.status||!t.date||!t.time||!t.finishedAt)return!1;const f=(0,n.atTime)((0,n.parseYmd)(t.date),t.time);if(new Date(t.finishedAt).getTime()>=f.getTime())return!1;const c=u(t,o);return!!c&&(s??new Date).getTime()1?'are':'is'} free again`:'',"."]}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${$}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>I(t,e,{stage:void 0,dirty:!1})),j(!1)}}),(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${$} seated`,onPress:()=>j(!1)})]})]}):(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${$}: ${e.walkIn?'removes the walk-in':'back to booked'}${v?`, frees ${v}`:''}`,onPress:()=>j(!0)});const L='undo-finished'===x?'seated':'confirmed';return(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===x?`Undo finished: ${$} back to seated${v?` at ${v}`:''}`:`Undo no-show: ${$} back to booked`,onPress:async()=>{'undo-finished'!==x?await n.repo.bookings.setStatus(e.id,L):await(0,b.undoFinishedNow)(t,e)}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),h=r(d[7]),f=r(d[8]);function k(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1340,[17,85,858,996,777,804,1112,1111,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=k,_e.BookingUndo=function({b:e,rid:t,today:w,who:$,allowed:y=!0}){const[p,j]=(0,s.useState)(!1),x=k(e,w);if(!x||!y)return null;const U=(0,h.tableForUndo)(e),v=(0,l.tableCardLabel)(U),I=l.useFloor.getState().setLive;if('unseat'===x)return p?(0,f.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,f.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",$,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',v?` and ${v} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${$}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>I(t,e,{stage:void 0,dirty:!1})),j(!1)}}),(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${$} seated`,onPress:()=>j(!1)})]})]}):(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${$}: ${e.walkIn?'removes the walk-in':'back to booked'}${v?`, frees ${v}`:''}`,onPress:()=>j(!0)});const L='undo-finished'===x?'seated':'confirmed';return(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===x?`Undo finished: ${$} back to seated${v?` at ${v}`:''}`:`Undo no-show: ${$} back to booked`,onPress:async()=>{'undo-finished'!==x?await n.repo.bookings.setStatus(e.id,L):await(0,b.undoFinishedNow)(t,e)}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),h=r(d[7]),f=r(d[8]);function k(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1340,[17,85,858,996,777,804,1113,1111,8]); __d(function(g,r,i,a,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},1341,[813,812,17,219,385,278,85,777,1150,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])},1342,[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])},1343,[17,85,780,804,8]); @@ -1443,16 +1443,16 @@ __d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?global __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||'')}},1360,[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},1362,[17,831,928,899,1361]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=$,e.guestRowText=function(n,p){const l=n.partySize,b=Math.max(0,Math.min(l-1,Math.round(Number(n.children)||0))),f=`${l} ${1===l?'person':'people'}${b?` (${b} ${1===b?'child':'children'})`:''}`,h=(0,o.tablesOf)(n.table??void 0),c=h.length?`${p.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',w=p.leftEarly?"Left early"+(c?` \xb7 ${c}`:''):p.finished?"Finished"+(c?` \xb7 ${c}`:''):p.seated?"Seated"+(c?` \xb7 ${c}`:''):c||'No table yet',x=$(n),y=h.length?`table${h.length>1?'s':''} ${u(h.map(t.plainTableNumber))}`:p.finished?'finished':'no table yet',D=!!n.dog,m=(0,s.allergyLine)(n),k=(0,d.guestChangeLine)(n),v=[n.time,p.name,m?`allergy noted: ${m}`:'',f,p.leftEarly?'left early':p.finished?'finished':p.seated?'seated':'',x?.spoken??'',y,D?'dog':''].filter(Boolean).join(', ')+'.'+(k?` ${k}`:'');return{time:n.time,name:p.name,people:f,deposit:x?.text??null,depositWarn:!!x?.warn,table:w,dog:D,allergy:m,guestChange:k,a11y:v}};var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),s=r(_d[3]),d=r(_d[4]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,l=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 o=(0,n.depositBadge)(t,p);if(!o)return null;const s=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||d>0&&u>d&&!o.label.startsWith('Deposit paid')){const t=d||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${l(t).replace(' pounds','')} of ${l(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(o.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const $=o.label.match(/\xa3[\d.,]+/);if(o.label.startsWith('Deposit paid')){const t=/about/.test(o.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(o.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(o.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}}},1363,[843,841,996,1364,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}}},1363,[843,841,996,1364,1365]); __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])},1364,[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}},1365,[]); __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])},1366,[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'},1367,[1368,843,1093,996,17,85,777,1096,858,1113,1363,1094,863,1091,1114,1115,1116,804,1323,1370,1371,1112,1340,1111,8]); +__d(function(_g,r,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'},1367,[1368,843,1093,996,17,85,777,1096,858,1114,1363,1094,863,1091,1115,1116,1117,804,1323,1370,1371,1113,1340,1111,8]); __d(function(g,r,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])},1368,[17,362,385,85,858,920,876,994,1369,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')}`}},1369,[]); __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},1372,[1169,1368,813,1093,812,843,1138,1089,1114,863,17,1076,219,385,278,85,777,1096,1356,858,996,845,1087,1074,1301,804,1323,1370,1371,1112,1111,8]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"Card",{enumerable:!0,get:function(){return M}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const l=e.filter(e=>'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},1372,[1169,1368,813,1093,812,843,1138,1089,1115,863,17,1076,219,385,278,85,777,1096,1356,858,996,845,1087,1074,1301,804,1323,1370,1371,1113,1111,8]); __d(function(g,_r,_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.']}]},1373,[812,17,219,385,85,777,858,996,1374,804,1375,1377,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))},1374,[]); __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)}},1375,[831,858,996,1374,1376,1377]); @@ -1494,7 +1494,7 @@ __d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModu __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1411,[]); __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}},1412,[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]},1413,[17,85,777,804,914,1020,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])},1414,[805,1411,1093,1247,1415,812,822,1114,1115,1089,1119,1416,1120,1116,1386,1387,1055,1323,994,1117,1087,841,1365,1123,1418,1216,1419,1378,1076,1053,1088,17,85,777,1343,858,845,851,863,1301,804,1175,1096,1112,996,1340,1060,1159,1420,1207,899,1177,1383,862,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1414,[805,1411,1093,1247,1415,812,822,1115,1116,1089,1120,1416,1112,1117,1386,1387,1055,1323,994,1118,1087,841,1365,1123,1418,1216,1419,1378,1076,1053,1088,17,85,777,1343,858,845,851,863,1301,804,1175,1096,1113,996,1340,1060,1159,1420,1207,899,1177,1383,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])},1415,[806,17,85,777,899,1251,8]); __d(function(g,r,_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])},1416,[17,385,85,1417,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},1417,[]); @@ -1518,7 +1518,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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])},1435,[17,278,85,777,857,804,1436,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(' ')},1436,[]); __d(function(g,_r,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]})}},1437,[888,813,17,1067,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])},1438,[1176,1070,1114,1087,17,385,85,777,876,863,804,1088,1168,1165,1055,1117,1173,1425,1159,860,1177,853,1175,884,1340,996,843,1112,1190,1197,1069,8]); +__d(function(g,_r,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])},1438,[1176,1070,1115,1087,17,385,85,777,876,863,804,1088,1168,1165,1055,1118,1173,1425,1159,860,1177,853,1175,884,1340,996,843,1113,1190,1197,1069,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]})}},1439,[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(()=>{})},1440,[1441,899,778,1392,1443,993,13,1470,479,17,368,319,219,24,85,805,857,1063,856,1472,19,858,996,876,804,1433,920,986,1475,1476,1026,1102,880,1006,914,1477,1362,8,1478,1479,1480,1481]); __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.'}},1441,[880,812,17,219,366,85,777,1442,899,804,1179,920,876,909,8]); diff --git a/customer-app/admin.html b/customer-app/admin.html index bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 14dfd5efb9a59ac4490b521aa6b8a7e0e75ac2e6..a5f6a5e6397a71138b57836dbd0bc1420d9ca3fe 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 4b3bfd405e2227b9809f40b7edba1397be4e1bbf..6b94eda4e084bc9b3f4b1d4907ff6aebf09feb54 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-9da258e1a5"; +const V = "cc-customer-e340d9cfd5"; 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=9da258e1a5661a91f95e15150b45970b101bc4d1740dbd55736208094c8d67c5"]; +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=e340d9cfd52b059c10ef8d8fb277da296e9be3673543bd62771bb5068392471c"]; // 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 bdbf52c5eda440f563794005330dcc6d2967a2f4..370a0f2146bcb4d99ad2ca8af7c8bba2a6bc7bd0 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 8149fffc0aee9cdf39991bf9cd43151aae5e7dd1..f6ac2c511acb0f3a6a75f71038a4844eaee28583 100644 --- a/display-app/_expo/static/js/web/bundle.js +++ b/display-app/_expo/static/js/web/bundle.js @@ -1058,7 +1058,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.205'},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.206'},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 c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},979,[980,981,928,972,976]); __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]); @@ -1166,17 +1166,17 @@ __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,"useChatOpen",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)()(t=>({request:n=>t({ch:n})}))},1083,[831]); __d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},1084,[912,17,1010,876,816,913,927,1066,916,1065]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:u}){const h=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const f=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==u||'seated'!==s.status||s.date!==(0,c.venueYmd)(new Date)||!(0,l.hasAllergens)(s)||h.current.has(s.id))continue;const n=f.get(s.id);n&&'seated'!==n&&(h.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} Covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[u]),null},e.useKitchenTodoChime=function(t,c,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=c&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,u.soundAllowed)()&&(0,u.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} Covers \xb7 ${t.date===c?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6])},1085,[843,17,916,858,1053,863,1016]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:s,today:o,by:S,app:j}){const $=(0,n.useBookings)(s).filter(e=>e.date===o&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),w=$.reduce((e,t)=>e+(t.diet?.vegan??0),0),T=$.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,x.jsxs)(a.default,{style:{gap:12},testID:"todays-bookings",children:[(0,x.jsx)(p.CoversToday,{rid:s}),(0,x.jsx)(b.PlattersBooked,{rid:s,date:o,label:"Platters booked today"}),w||T?(0,x.jsxs)(l.T,{colour:h.colours.ok,children:["\u24cb ",w?`${w} vegan`:'',w&&T?' \xb7 ':'',T?`${T} vegetarian`:''," today"]}):null,(0,x.jsx)(b.KitchenSignoffs,{rid:s,today:o,by:S,app:j,showAll:!0}),$.length?$.map(o=>(0,x.jsxs)(a.default,{testID:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?`kitchen-seated-${o.id}`:`kitchen-booking-${o.id}`,style:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?{gap:6,padding:14,borderRadius:16,...(0,c.seatedHighlightStyle)()}:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface,opacity:'finished'===o.status?.55:1},children:[(0,x.jsxs)(l.T,{weight:"semibold",colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,accessibilityLabel:`${o.time}, ${o.walkIn?`Walk-in ${o.ref}`:o.name}, ${o.partySize} Covers${o.table?`, ${(0,e.tableNumbersA11y)(o.table)}`:''}`,children:[o.time," \xb7 ",o.walkIn?`Walk-in ${o.ref}`:o.name," \xb7 ",o.partySize," Covers",o.table?` \xb7 ${(0,e.tableNumbers)(o.table)}`:'']}),(0,x.jsx)(t.DepositChip,{b:o,money:!0,testID:`kitchen-deposit-${o.id}`}),(0,x.jsx)(k.BookingTableButton,{rid:s,booking:o,readOnly:'chef'===j}),'chef'!==j&&o.walkIn?(0,x.jsx)(y.CancelWalkInButton,{rid:s,b:o,small:!0}):null,o.notes?(0,x.jsxs)(l.T,{size:16,colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,testID:`kitchen-notes-${o.id}`,children:["Notes: ",o.notes]}):null,(0,x.jsx)(f.BookingEditButton,{rid:s,booking:o,who:S,inStaffApp:'staff'===j}),(0,x.jsx)(b.BookingNeeds,{b:o}),'seated'===(0,u.shownStatus)(o)?(0,x.jsx)(l.T,{weight:"semibold",colour:c.SEATED_FG,children:"Seated"}):'finished'===o.status?(0,x.jsx)(l.Muted,{children:"Finished"}):null]},o.id)):(0,x.jsx)(l.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var s,o=r(d[3]),a=(s=o)&&s.__esModule?s:{default:s},l=r(d[4]),n=r(d[5]),u=r(d[6]),h=r(d[7]),c=r(d[8]),b=r(d[9]),k=r(d[10]),y=r(d[11]),f=r(d[12]),p=r(d[13]),x=r(d[14])},1086,[843,1087,17,85,777,858,1053,804,1088,1076,1089,1114,1119,1070,8]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:s,today:o,by:S,app:j}){const $=(0,n.useBookings)(s).filter(e=>e.date===o&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),w=$.reduce((e,t)=>e+(t.diet?.vegan??0),0),T=$.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,x.jsxs)(a.default,{style:{gap:12},testID:"todays-bookings",children:[(0,x.jsx)(p.CoversToday,{rid:s}),(0,x.jsx)(b.PlattersBooked,{rid:s,date:o,label:"Platters booked today"}),w||T?(0,x.jsxs)(l.T,{colour:h.colours.ok,children:["\u24cb ",w?`${w} vegan`:'',w&&T?' \xb7 ':'',T?`${T} vegetarian`:''," today"]}):null,(0,x.jsx)(b.KitchenSignoffs,{rid:s,today:o,by:S,app:j,showAll:!0}),$.length?$.map(o=>(0,x.jsxs)(a.default,{testID:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?`kitchen-seated-${o.id}`:`kitchen-booking-${o.id}`,style:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?{gap:6,padding:14,borderRadius:16,...(0,c.seatedHighlightStyle)()}:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface,opacity:'finished'===o.status?.55:1},children:[(0,x.jsxs)(l.T,{weight:"semibold",colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,accessibilityLabel:`${o.time}, ${o.walkIn?`Walk-in ${o.ref}`:o.name}, ${o.partySize} Covers${o.table?`, ${(0,e.tableNumbersA11y)(o.table)}`:''}`,children:[o.time," \xb7 ",o.walkIn?`Walk-in ${o.ref}`:o.name," \xb7 ",o.partySize," Covers",o.table?` \xb7 ${(0,e.tableNumbers)(o.table)}`:'']}),(0,x.jsx)(t.DepositChip,{b:o,money:!0,testID:`kitchen-deposit-${o.id}`}),(0,x.jsx)(k.BookingTableButton,{rid:s,booking:o,readOnly:'chef'===j}),'chef'!==j&&o.walkIn?(0,x.jsx)(y.CancelWalkInButton,{rid:s,b:o,small:!0}):null,o.notes?(0,x.jsxs)(l.T,{size:16,colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,testID:`kitchen-notes-${o.id}`,children:["Notes: ",o.notes]}):null,(0,x.jsx)(f.BookingEditButton,{rid:s,booking:o,who:S,inStaffApp:'staff'===j}),(0,x.jsx)(b.BookingNeeds,{b:o}),'seated'===(0,u.shownStatus)(o)?(0,x.jsx)(l.T,{weight:"semibold",colour:c.SEATED_FG,children:"Seated"}):'finished'===o.status?(0,x.jsx)(l.Muted,{children:"Finished"}):null]},o.id)):(0,x.jsx)(l.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var s,o=r(d[3]),a=(s=o)&&s.__esModule?s:{default:s},l=r(d[4]),n=r(d[5]),u=r(d[6]),h=r(d[7]),c=r(d[8]),b=r(d[9]),k=r(d[10]),y=r(d[11]),f=r(d[12]),p=r(d[13]),x=r(d[14])},1086,[843,1087,17,85,777,858,1053,804,1088,1076,1089,1115,1120,1070,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DepositChip=function({b:e,money:o,big:n,testID:b}){const f=(0,s.depositView)(e,o);if(!f)return null;const h={gold:[t.colours.goldTint,t.colours.goldLight,t.colours.gold],amber:[t.colours.amberBg,'#FFE2A8',t.colours.amber],red:[t.colours.redBg,'#FFD9D4',t.colours.red],neutral:[t.colours.surface2,t.colours.muted,t.colours.border]}[f.kind];return(0,u.jsxs)(l.default,{accessible:!0,accessibilityRole:"text",accessibilityLabel:f.a11y,testID:b??'deposit-chip',style:{alignSelf:'flex-start',maxWidth:'100%'},children:[(0,u.jsx)(l.default,{style:{backgroundColor:h[0],borderColor:h[2],borderWidth:n?2:1,borderRadius:8,paddingHorizontal:n?12:8,paddingVertical:n?6:3},children:(0,u.jsx)(c.T,{size:16,weight:"semibold",colour:h[1],children:f.label})}),f.note?(0,u.jsx)(c.Muted,{size:12,children:f.note}):null]})},r(d[0]);var e,o=r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),c=r(d[4]),u=r(d[5])},1087,[17,85,841,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEATED_BG",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SEATED_FG",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEATED_MUTED",{enumerable:!0,get:function(){return u}}),e.isSeatedHighlight=function(t,o){return'seated'===t&&!o?.otherDay},e.seatedHighlightStyle=function(u){return{backgroundColor:o,borderColor:t.colours.goldLight,borderWidth:1.5,borderLeftWidth:8,borderLeftColor:n,...u}};var t=r(d[0]);const o=t.colours.gold,n=t.colours.onGold,u='#3F3218'},1088,[804]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f,canClear:h=!0}){const[j,k]=(0,t.useState)(!1),x=(0,s.tableButtonLabel)(l.table),_=f??`table-btn-${l.id}`;if(y)return(0,b.jsx)(n.default,{testID:_,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,b.jsx)(u.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:x})});return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u.Button,{kind:"secondary",label:x,testID:_,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>k(!0),style:{minHeight:44}}),j?(0,b.jsx)(c.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>k(!1),canClear:h}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6])},1089,[17,85,1090,804,1091,777,8]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const u={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(u)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(u,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}}),e.splitChoices=function(t){const n=String(t??'').split('+').map(t=>t.trim()).filter(Boolean);return n.length>1?[...new Set(n)]:[]};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1090,[843,1074]); -__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,t,s){const l=(0,p.tableKey)(s);if('finished'===t.status&&l)return void await(0,j.restoreFinishedToTable)(e,t,s);const o=(0,g.tablesOf)(t.table);await h.repo.bookings.update(t.id,(0,y.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(t=>g.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,m.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:m=90,onClose:T,onSaved:S,onPickOnPlan:L,canClear:P=!0}){const W=(0,g.usePlan)(e),z=(0,h.useBookings)(e),[D,I]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),R=(0,l.useMemo)(()=>(0,p.pickGroups)(W),[W]),B=z.filter(e=>e.date===y.date),O=(0,p.seatsOf)(W,D),N=(0,p.seatLine)(O.total,y.partySize),F=(0,p.pickClashes)(y,D,B,m),M=e=>(0,p.pickClashes)(y,[e],B,m)[0]?.with,Y=(0,p.tableKey)(D)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,C.useBlocks)(e=>e.blocks),A=(0,C.blockAt)(_,e,y.date,y.time),[G,K]=(0,l.useState)(null),E=e=>{K(null),I(t=>(0,p.toggleTable)(t,e))},[H]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{H&&(0,c.announce)(`Tables can't be saved: ${H}.`)},[H]);const[U,V]=(0,l.useState)(!1),[q,J]=(0,l.useState)(!1),Q=async t=>{(0,o.guardBookingChange)(S,{b:y,tables:t})?(V(!0),T(),await(0,o.saveTablesReported)(e,y,t,f,(0,p.seatsOf)(W,t).total,e=>S?.(e))):T()},X=(0,w.jsxs)(u.default,{style:{gap:8},children:[(0,w.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(D)} picked. ${N.text}.`,children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(D)}),(0,w.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:N.text})]}),A?(0,w.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,w.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,F.length?(0,w.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(F)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,w.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(F)," You can still save."]})}):null,q?(0,w.jsx)(j.RestoreSeatedConfirm,{prompt:(0,v.restoreSeatedPrompt)(f,(0,p.tableKey)(D)),onYes:()=>{J(!1),Q(D)},onNo:()=>J(!1)}):null,G?(0,w.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:G,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,w.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:G}),(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(D)} for ${f}, ${y.partySize} people`,disabled:U,onPress:()=>{Q(D)},style:[$,{flexGrow:1}]}),(0,w.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>K(null),style:$})]})]}):null,(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[G?null:(0,w.jsx)(x.Button,{testID:"table-pick-save",label:U?'Saving\u2026':F.length?'Save anyway':'Save tables',disabled:!Y||!D.length||U,accessibilityLabel:`${F.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(D)} for ${f}. ${N.text}.${F.length?` ${(0,p.clashWords)(F)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(S,{b:y,tables:D}))return void T();const e=(0,p.overCapacityAsk)(D,O.total,y.partySize);!e||G?'finished'!==y.status||!D.length||q?Q(D):J(!0):K(e)},style:[$,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&P?(0,w.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:U,onPress:()=>Q([]),style:$}):null,(0,w.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:T,style:$})]})]});return(0,w.jsxs)(x.Sheet,{visible:!0,onClose:T,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:X,children:[(0,w.jsx)(t.TableNumberWarning,{plan:W}),H?(0,w.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${H}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,w.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${H}.`})}):null,(0,w.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),L?(0,w.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>L(D),style:$}):null,R.map(e=>(0,w.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,w.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,w.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=D.includes(e.name),l=M(e.name);return(0,w.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,t,l),onPress:()=>E(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",colour:t?k.colours.onGold:k.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,w.jsxs)(x.T,{size:14,colour:t?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),R.length?null:(0,w.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),m=r(d[15]),j=r(d[16]),v=r(d[17]),C=r(d[18]),w=r(d[19]);const $={minHeight:56}},1091,[1092,843,17,1093,899,1095,385,85,858,996,1090,1094,804,863,777,1096,1112,1111,993,8]); +__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,t,s){const l=(0,p.tableKey)(s);if('finished'===t.status&&l)return void await(0,j.restoreFinishedToTable)(e,t,s);const o=(0,g.tablesOf)(t.table);await h.repo.bookings.update(t.id,(0,y.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(t=>g.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,m.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:m=90,onClose:T,onSaved:S,onPickOnPlan:L,canClear:P=!0}){const W=(0,g.usePlan)(e),z=(0,h.useBookings)(e),[D,I]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),R=(0,l.useMemo)(()=>(0,p.pickGroups)(W),[W]),B=z.filter(e=>e.date===y.date),O=(0,p.seatsOf)(W,D),N=(0,p.seatLine)(O.total,y.partySize),F=(0,p.pickClashes)(y,D,B,m),M=e=>(0,p.pickClashes)(y,[e],B,m)[0]?.with,Y=(0,p.tableKey)(D)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,C.useBlocks)(e=>e.blocks),A=(0,C.blockAt)(_,e,y.date,y.time),[G,K]=(0,l.useState)(null),E=e=>{K(null),I(t=>(0,p.toggleTable)(t,e))},[H]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{H&&(0,c.announce)(`Tables can't be saved: ${H}.`)},[H]);const[U,V]=(0,l.useState)(!1),[q,J]=(0,l.useState)(!1),Q=async t=>{(0,o.guardBookingChange)(S,{b:y,tables:t})?(V(!0),T(),await(0,o.saveTablesReported)(e,y,t,f,(0,p.seatsOf)(W,t).total,e=>S?.(e))):T()},X=(0,w.jsxs)(u.default,{style:{gap:8},children:[(0,w.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(D)} picked. ${N.text}.`,children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(D)}),(0,w.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:N.text})]}),A?(0,w.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,w.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,F.length?(0,w.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(F)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,w.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(F)," You can still save."]})}):null,q?(0,w.jsx)(j.RestoreSeatedConfirm,{prompt:(0,v.restoreSeatedPrompt)(f,(0,p.tableKey)(D)),onYes:()=>{J(!1),Q(D)},onNo:()=>J(!1)}):null,G?(0,w.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:G,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,w.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:G}),(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(D)} for ${f}, ${y.partySize} people`,disabled:U,onPress:()=>{Q(D)},style:[$,{flexGrow:1}]}),(0,w.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>K(null),style:$})]})]}):null,(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[G?null:(0,w.jsx)(x.Button,{testID:"table-pick-save",label:U?'Saving\u2026':F.length?'Save anyway':'Save tables',disabled:!Y||!D.length||U,accessibilityLabel:`${F.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(D)} for ${f}. ${N.text}.${F.length?` ${(0,p.clashWords)(F)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(S,{b:y,tables:D}))return void T();const e=(0,p.overCapacityAsk)(D,O.total,y.partySize);!e||G?'finished'!==y.status||!D.length||q?Q(D):J(!0):K(e)},style:[$,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&P?(0,w.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:U,onPress:()=>Q([]),style:$}):null,(0,w.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:T,style:$})]})]});return(0,w.jsxs)(x.Sheet,{visible:!0,onClose:T,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:X,children:[(0,w.jsx)(t.TableNumberWarning,{plan:W}),H?(0,w.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${H}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,w.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${H}.`})}):null,(0,w.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),L?(0,w.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>L(D),style:$}):null,R.map(e=>(0,w.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,w.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,w.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=D.includes(e.name),l=M(e.name);return(0,w.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,t,l),onPress:()=>E(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",colour:t?k.colours.onGold:k.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,w.jsxs)(x.T,{size:14,colour:t?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),R.length?null:(0,w.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),m=r(d[15]),j=r(d[16]),v=r(d[17]),C=r(d[18]),w=r(d[19]);const $={minHeight:56}},1091,[1092,843,17,1093,899,1095,385,85,858,996,1090,1094,804,863,777,1096,1113,1111,993,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},1092,[17,842,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.guardBookingChange=w,_e.saveTablesReported=async function(e,t,n,o,s,u){if(!w(u,{b:t,tables:n}))return!1;const v=n.length?(0,h.notSavedWhat)({...t,name:o,table:n.join('+')}):`Taking the table off ${o}`;u(`Saving ${v}\u2026`);try{await(0,b.saveBookingTables)(e,t,n)}catch(e){const t=`${v} did not save: ${String(e?.message??e).slice(0,120)}`;return u(t),(0,l.announce)(t),!1}const y=await(0,c.waitForBookingSave)(t.id);if('saved'===y.state||'local'===y.state){const e=(0,r.savedWords)(o,t.partySize,n,s);return u(e),(0,l.announce)(e),!0}const k='waiting'===y.state?`${v}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${v} did not save. ${f("why"in y?y.why:"the shared system did not take it")}. Tap the red banner to try again.`;return u(k),(0,l.announce)(k),!1},_e.reportBookingSave=async function(e,t,n,o){const s=await(0,c.waitForBookingSave)(e);if('saved'===s.state||'local'===s.state)return o(t),(0,l.announce)(t),!0;const r='waiting'===s.state?`${n}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${n} did not save. ${f('why'in s?s.why:'the shared system did not take it')}. Tap the red banner to try again.`;return o(r),(0,l.announce)(r),!1},_e.BookingSaveBanner=function({rid:e,testID:r="booking-save-banner",margin:c}){const b=(0,h.useBookingSaves)(e=>e.notSaved),w=(0,s.useBookings)(e).filter(e=>b[e.id]).map(e=>void 0!==b[e.id].want?{...e,table:b[e.id].want||void 0}:e),{msg:S,retry:$}=k(),m=(0,t.useRef)(''),p=w.map(e=>(0,h.notSavedLine)(e)),B=w.map(e=>e.id).sort().join(',');if((0,t.useEffect)(()=>{B&&B!==m.current&&(0,l.announce)(1===w.length?p[0]:`${w.length} booking changes did not save. Tap the red banner to try again.`),m.current=B},[B]),!w.length)return null;const j=1===w.length?p[0]:`${w.length} booking changes did not save. Tap to try again.`;return(0,y.jsx)(n.default,{testID:r,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${j}${w.length>1?` ${w.map(e=>(0,h.notSavedWhat)(e)).join('. ')}.`:''} ${f(b[w[0].id].why)}.`,onPress:$,style:{...c??{},alignSelf:'stretch',gap:4,padding:12,borderRadius:12,borderWidth:2,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:(0,y.jsxs)(o.default,{accessibilityRole:"alert",style:{alignItems:'center',gap:4},children:[(0,y.jsx)(v.T,{testID:`${r}-title`,size:17,weight:"semibold",center:!0,colour:"#FFD2CC",children:j}),w.length>1?w.slice(0,6).map(e=>(0,y.jsx)(v.T,{testID:`${r}-line`,size:15,center:!0,colour:"#FFD2CC",children:(0,h.notSavedWhat)(e)},e.id)):null,(0,y.jsx)(v.T,{testID:`${r}-why`,size:14,center:!0,colour:"#FFB3AA",children:w.length>1?`${f(b[w[0].id].why)}${w.length>6?` \xb7 and ${w.length-6} more`:''}`:f(b[w[0].id].why)}),S?(0,y.jsx)(v.T,{testID:`${r}-msg`,size:14,center:!0,colour:u.colours.goldLight,children:S}):null]})})},_e.BookingNotSavedLine=function({b:e}){const t=(0,h.useBookingSaves)(t=>t.notSaved[e.id]),{msg:o,retry:s}=k();if(!t)return null;void 0!==t.want&&(e={...e,table:t.want||void 0});return(0,y.jsxs)(n.default,{testID:`booking-not-saved-${e.id}`,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${(0,h.notSavedLine)(e)} ${f(t.why)}.`,onPress:s,style:{alignSelf:'stretch',padding:8,borderRadius:10,borderWidth:1.5,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:[(0,y.jsx)(v.T,{size:15,weight:"semibold",center:!0,colour:"#FFD2CC",children:(0,h.notSavedLine)(e)}),o?(0,y.jsx)(v.T,{size:13,center:!0,colour:u.colours.goldLight,children:o}):null]})};var t=_r(d[0]),n=e(_r(d[1])),o=e(_r(d[2])),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),b=_r(d[9]),v=_r(d[10]),y=_r(d[11]);const f=e=>e.charAt(0).toUpperCase()+e.slice(1);function w(e,t){const n=(0,c.bookingSaveBlocker)();if(!n)return!0;t&&h.useBookingSaves.getState().mark({id:t.b.id,table:t.b.walkIn?'walk_ins':'bookings',why:n,...t.tables?{want:t.tables.join('+')}:{}});const o=`${t?(0,h.notSavedWhat)({...t.b,...t.tables?{table:t.tables.join('+')||void 0}:{}}):'This change'} did not save: ${n}.`;return e?.(o),(0,l.announce)(o),!1}function k(){const[e,n]=(0,t.useState)('');return{msg:e,retry:async()=>{n('Saving\u2026'),(0,l.announce)('Saving');const e=await(0,c.saveBookingsNow)(!0),t=e?`Not saved: ${e}.`:h.useBookingSaves.getState().count()?'Sent again. The banner clears when the shared system takes it.':'Nothing is left waiting. Check the plan and make the change again if it is not there.';n(t),(0,l.announce)(t)}}}},1093,[17,385,85,858,1094,1095,899,983,804,1091,777,8]); __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=u,e.requestedFreeTable=function(t,n,a,s,l=90){const o={id:n.id??'new',status:'confirmed',...n};for(const n of t)if(a.includes(n)&&!u(o,[n],s,l).length)return n;return null},e.overCapacityAsk=function(n,s,l){const u=a(o(n));if(!u.length||s>=l)return null;const c=u.map(n=>(0,t.tableNumbers)(n));return`${1===c.length?`Table ${c[0]} seats`:`Tables ${c.slice(0,-1).join(', ')} and ${c[c.length-1]} seat`} ${s} \u2013 this booking is ${l}. Use it anyway?`},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=c,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${c(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${c(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${c(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))}function c(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1094,[843,1074]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.primeAnnouncer=function(){u()},_e.announce=function(t){const e=String(t??'').trim();if(!e)return;{const t=u();if(!t)return;const n=++o;return t.textContent='',void setTimeout(()=>{n===o&&(t.textContent=e)},80)}},Object.defineProperty(_e,"lastAnnounced",{enumerable:!0,get:function(){return c}});var t,e=r(d[0]);(t=e)&&t.__esModule;r(d[1]);let n=null,o=0;function u(){if('undefined'==typeof document||!document.body)return null;if(n&&document.body.contains(n))return n;const t=document.createElement('div');return t.id='cc-announcer',t.setAttribute('aria-live','assertive'),t.setAttribute('aria-atomic','true'),t.setAttribute('role','status'),t.setAttribute('data-testid','cc-announcer'),Object.assign(t.style,{position:'absolute',width:'1px',height:'1px',margin:'-1px',padding:'0',overflow:'hidden',clip:'rect(0 0 0 0)',whiteSpace:'nowrap',border:'0'}),document.body.appendChild(t),n=t,t}const c=()=>n?.textContent??''},1095,[264,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,"TABLES",{enumerable:!0,get:function(){return A}}),_e.useTableNames=R,_e.resetTableLive=W,_e.seatBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'seated'),W(e,t.table)},_e.finishBookingNow=async function(e,t){const s=(new Date).toISOString();await k.repo.bookings.update(t.id,(0,N.finishClearPatch)(s,t.table)),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=E,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return _}}),_e.TablePicker=H,_e.WalkInSheet=q,_e.AssignTableSheet=G,_e.undoNotice=Y,_e.NewBookingSheet=V,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[n,i]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>i({b:e}),combineTables:e=>i({b:e,combine:!0}),elements:(0,L.jsxs)(L.Fragment,{children:[s?(0,L.jsx)(q,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,L.jsx)(V,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,L.jsx)(G,{booking:n.b,combine:n.combine,onClose:()=>i(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),z=_r(_d[29]),B=_r(_d[30]),M=_r(_d[31]),N=_r(_d[32]),L=_r(_d[33]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),A=Array.from({length:12},(e,t)=>String(t+1));function R(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function W(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function E(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=R(e),a=(0,v.useFloor)(t=>t.live[e])??{},n=(0,v.usePlan)(e),i=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(i,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const _=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function H({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=n?6:8,f=n?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(i??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,L.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],i=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!i,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,L.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:i?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,L.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,L.jsx)(C.T,{weight:"bold",size:22,colour:i?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,L.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,L.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,L.jsx)(C.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const U=[1,2,3,4,5,6,7,8];function q({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:r,r:d,now:u}=(0,y.useCtx)(15e3),x=E(r,u),[T,I]=(0,c.useState)(2),[P,$]=(0,c.useState)(!1),[O,z]=(0,c.useState)(i??null),B=(0,v.usePlan)(r),N=(0,k.useBookings)(r),A=(0,D.useBlocks)(e=>e.blocks),R=(0,D.closedAreasAt)(A,r,(0,w.ymd)(u),(0,w.hm)(u)),_=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(x).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(B,N.filter(e=>e.date===(0,w.ymd)(u)),e,T,u,(0,j.turnFor)(T,d.settings.turnMins),90,void 0,{closed:R})?.table??null},[B,N,x,T,R.size,u.getTime()]);(0,c.useEffect)(()=>{O&&(0,v.tablesOf)(O).some(e=>'Closed'===x[e]?.label)&&z(null)},[O,R.size]);const[q,G]=(0,c.useState)(!1),[Y,V]=(0,c.useState)(''),K=(e,t=String(e),s=()=>{$(!1),I(e)})=>{const o='9+'===t?P:!P&&T===e;return(0,L.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,L.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},Q=(0,L.jsx)(s.PartySizeInput,{value:T,onChange:I,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),X=(0,L.jsxs)(m.default,{style:{gap:8,width:n?256:void 0},children:[(0,L.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,L.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[U.map(e=>K(e)),K(9,'9+',()=>{$(!0),I(e=>e>=9?e:9)})]}),P?Q:null]}),[J,Z]=(0,c.useState)(!1),ee=async(t=O)=>{if(!J&&(0,M.guardBookingChange)(F)){Z(!0);try{const s=await k.repo.bookings.seatWalkIn(r,T,t??void 0,Y);W(r,t??void 0),a(s),e()}finally{Z(!1)}}},te=(0,L.jsxs)(m.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,L.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,L.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),O?(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>z(null)}):null]}),(0,L.jsx)(H,{use:x,value:O,onPick:e=>{x[e]&&!x[e].busy?ee(e):z(O===e?null:e)},big:n,dense:n,best:_,bestSet:(0,h.bestTables)(B)}),(0,L.jsxs)(C.Muted,{children:["Tap a free table to seat them there",_&&!O?` (suggested for ${T}: ${(0,l.tableNumbers)(_)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(u)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,L.jsx)(C.Button,{label:`Seat walk-in \xb7 ${T} ${1===T?'person':'people'}${O?` \xb7 ${(0,l.tableNumbers)(O)}`:''}`,disabled:J,onPress:()=>{ee()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,L.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[X,te]}):(0,L.jsxs)(L.Fragment,{children:[X,te]}),(0,L.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[q?(0,L.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:Y,onChangeText:V,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,L.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,L.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function G({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,y.useCtx)(15e3),i=E(o,n),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(n)),t,e.partySize,n,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,n.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),P=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,$=D.reduce((e,t)=>e+P(t),0),O=D.length>0&&${if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&W(o,l),t()},B=x?(0,L.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,L.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,L.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${$} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,L.jsx)(m.default,{testID:"combine-short",children:(0,L.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-$," more needed. Add another table."]})}):null,(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,L.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,L.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,L.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,L.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${_(e)}`,testID:"assign-table-sheet",footer:B,children:[f&&!x?(0,L.jsx)(m.default,{testID:"assign-suggested",children:(0,L.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,L.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,L.jsx)(H,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function Y(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${_(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function V({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:N}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const A=(0,w.ymd)(p),[R,W]=(0,c.useState)(ee.blocks),[H,U]=(0,c.useState)(!1),[q,G]=(0,c.useState)(''),[Y,V]=(0,c.useState)(2),[K,Q]=(0,c.useState)(0),X=Math.min(K,Math.max(0,Y-1)),[J,Z]=(0,c.useState)(null),[ee,te]=(0,c.useState)(''),[se,oe]=(0,c.useState)(''),[le,ae]=(0,c.useState)(''),[ne,ie]=(0,c.useState)(!1),[re,de]=(0,c.useState)('phone'),[ue,ce]=(0,c.useState)((0,P.emptyNeeds)()),be=(0,P.needsMissing)(ue),[ge,he]=(0,c.useState)(null),pe=(0,v.usePlan)(b),me=(0,O.dogSetUp)(pe),fe=!0===ue.dog&&me,ye=ue.dog?ue.dogs:0,ke=(0,w.parseYmd)(R),xe=(0,j.turnFor)(Y,h.settings.turnMins),je=E.filter(e=>e.date===R),we=e=>(0,j.dogTablesAt)(pe,je,Y,(0,j.slotStart)(R,e),xe,h.settings.turnMins,(0,D.closedAreasAt)(_,b,R,e)),Se=fe&&J?we(J):[];(0,c.useEffect)(()=>{he(null)},[fe,J,Y]);const Te=(0,x.bookingSlots)(h,ke,e=>E.filter(t=>t.date===R&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Y,R===(0,w.ymd)(p)?p:(0,w.addMins)(ke,0),e=>E.filter(t=>t.date===R&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),Ce=(0,T.guestPhone)(se),[ve,De]=(0,c.useState)(!1),Ie=J?Te.find(e=>e.time===J):void 0,Pe=Ie&&Ie.left=2&&!!J&&(!Oe||ve)&&(0,o.validParty)(Y)&&Ce.ok&&(0,T.emailOk)(le)&&(!ze||Be&&H)&&(!fe||Se.length>0)&&!Me,Le=ue.wheelchair>0||ue.stepFree,Fe=(0,$.bookingRulesOf)(h),Ae=(0,$.largeGroupTables)(Fe,Y),Re=(0,$.dogPartyCheck)(Fe,Y,!0===ue.dog,ue.assistDog),We=(0,$.bookingDepositSplit)((0,n.depositOf)(h.settings),Y,X,(0,P.needsPatch)(ue),(0,O.reservablesOf)(h));return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(ke)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,L.jsx)(P.FirstQuestions,{rid:b,value:ue,onChange:ce,party:Y,audience:"staff"}),ue.dog&&!me?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,L.jsx)(I.BookingDatePicker,{r:h,today:p,value:R,onChange:e=>{e!==R&&(W(e),Z(null),U(!1))}}),(0,L.jsxs)(C.Row,{gap:6,children:[(0,L.jsx)(C.Chip,{label:"Phone",selected:'phone'===re,onPress:()=>de('phone')}),(0,L.jsx)(C.Chip,{label:"In person",selected:'in-person'===re,onPress:()=>de('in-person')})]}),(0,L.jsx)(C.Field,{label:"Name",value:q,onChangeText:G,placeholder:"e.g. Reid",testID:"nb-name"}),(0,L.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:se,onChangeText:oe,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!Ce.ok&&se?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:Ce.error}):null,(0,L.jsx)(C.Field,{label:"Email (optional)",value:le,onChangeText:ae,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email",testID:"nb-email"}),(0,T.emailOk)(le)?null:(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),le.trim()&&Fe.marketingOptIn?(0,L.jsx)(C.Toggle,{label:Fe.marketingWords,value:ne,onChange:ie,testID:"nb-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,L.jsx)(i.AdultsChildren,{value:(0,r.peopleOf)(Y,X),onChange:e=>{V(e.partySize),Q(e.children),De(!1)},depositsOn:(0,n.depositOf)(h.settings).on&&(0,n.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:Te.map(e=>{const t=fe&&e.available&&!we(e.time).length||!(0,P.dogTimeOk)(h,E,R,e.time,ye);return(0,L.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(_,b,R,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:J===e.time,onPress:()=>{Z(e.time),U(!1),De(!1)}},e.time)})}),Oe?(0,L.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[Pe?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Y,Pe.left,Pe.time)}):null,$e?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)($e.time,$e.cap)}):null,(0,L.jsx)(C.Chip,{label:ve?'Booking over the limit: on':'Book anyway (over the limit)',selected:ve,onPress:()=>De(e=>!e),testID:"nb-over-ok"})]}):null,fe&&J?(0,L.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,L.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,L.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",pe.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),Se.length?pe.areas.filter(e=>Se.some(t=>t.area===e.name)).map(e=>(0,L.jsxs)(m.default,{style:{gap:6},accessibilityLabel:e.name,children:[(0,L.jsxs)(C.T,{size:13,center:!0,colour:S.colours.muted,children:[e.name,e.outdoor?' (outdoor)':'']}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:Se.filter(t=>t.area===e.name).map(e=>{const t=Se[0]?.table===e.table;return(0,L.jsx)(C.Chip,{testID:`nb-dog-table-${(0,l.tableNumbers)(e.table)}`,label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.seats} seats${t?' \xb7 best':''}${Le&&(0,O.accessibleSetUp)(pe)&&!(0,O.isAccessible)(pe,e.table)?' \xb7 not step-free':''}`,selected:(ge??Se[0].table)===e.table,onPress:()=>he(e.table)},e.table)})})]},e.id)):(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Y," at ",J,". Try another time."]})]}):null,ze?(0,L.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,L.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",ze.from,"\u2013",ze.to,ze.reason?` (${ze.reason})`:'']}),Be?(0,L.jsx)(C.Chip,{label:H?'Manager override on':'Override and book anyway',selected:H,onPress:()=>U(e=>!e)}):(0,L.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,Te.length?null:(0,L.jsx)(m.default,{testID:"nb-closed",children:(0,L.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(ke)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,L.jsx)(P.MoreQuestions,{rid:b,r:h,value:ue,onChange:ce,party:Y,date:R,time:J,today:(0,w.ymd)(p),bookings:E,audience:"staff",showTables:!1!==h.settings.tableRequests}),Le&&!(0,O.accessibleSetUp)(pe)?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,Ae&&!fe?(0,L.jsxs)(C.T,{size:14,colour:S.colours.goldLight,testID:"nb-large-group",children:["Large group: tables ",Ae.join(' + ')," joined."]}):null,Re.ok?null:(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,testID:"nb-dog-cap",children:["Online, a dog booking is for up to ",Fe.dogMaxParty," people. You can still book it here: check where they can sit."]}),(0,L.jsx)(C.Field,{label:"Notes (optional)",value:ee,onChangeText:te,placeholder:Fe.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"nb-notes"}),We.preorders?(0,L.jsxs)(C.Muted,{testID:"nb-preorder-deposit",children:["Pre-order deposit: ",(0,a.gbp)(We.preorders),We.adults?`, plus the group deposit: ${(0,a.gbp)(We.total)} in total`:'',". Staff can waive it."]}):null,(0,n.depositDue)((0,n.depositOf)(h.settings),Y,X)?(0,L.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(h.settings),Y,X))," (",(0,a.gbp)((0,n.depositOf)(h.settings).perPersonPence)," per adult for tables of ",(0,n.depositOf)(h.settings).fromParty,"+ adults",X?`; ${X} ${1===X?'child':'children'} free`:'; children free, and they do not count towards the number that needs a deposit',"). Staff can waive it. Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,L.jsx)(C.Muted,{children:"CoverCharge confirms the guest by email automatically (preview mode: shown in the Outbox, not sent)."}),Me?(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",J,". Try another time: dogs are very welcome then."]}):null,(0,L.jsx)(C.Button,{label:be.length?be[0]:'Save booking',testID:"nb-save",disabled:!Ne,onPress:()=>{if(R<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,P.needsPatch)(ue),s=ue.tableReq.find(e=>!fe||Se.some(t=>t.table===e)),o=fe?null:(0,B.requestedFreeTable)(ue.tableReq,{date:R,time:J,partySize:Y},pe.tables.map(e=>e.name),je,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:q.trim(),partySize:Y,date:R,time:J,notes:ee.trim(),security:We.total?'deposit':'none',depositPaid:0,...X?{children:X}:{},...We.total?{...(0,$.depositFields)(We),depositPolicy:(0,n.depositWords)((0,n.depositOf)(h.settings),Y,h.name,X).join(' '),depositRefundable:(0,n.depositOf)(h.settings).refundable,depositCutoffHours:(0,n.depositOf)(h.settings).cutoffHours}:{},phone:Ce.pretty,email:le.trim()||void 0,...ne?(0,$.marketingChoice)(le,!0):{},source:re,...e,...Te.find(e=>e.time===J)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...fe?{table:ge??s??Se[0]?.table}:o?{table:o}:{}}).then(e=>(0,z.postNewBookingToKitchen)(e,N)).catch(()=>{}),u?.({date:R,time:J,name:q.trim()}),t()}})]})}},1096,[812,1097,1098,843,851,841,1099,1100,1101,1102,17,842,385,85,856,1055,858,1103,1074,863,804,848,777,996,993,1104,1105,1077,1053,1076,1094,1093,1111,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return R}}),_e.useTableNames=W,_e.resetTableLive=E,_e.seatBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'seated'),E(e,t.table)},_e.finishBookingNow=async function(e,t){const s=(new Date).toISOString();await k.repo.bookings.update(t.id,(0,N.finishClearPatch)(s,t.table)),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=_,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return H}}),_e.TablePicker=U,_e.WalkInSheet=G,_e.AssignTableSheet=V,_e.undoNotice=Y,_e.NewBookingSheet=K,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[n,i]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>i({b:e}),combineTables:e=>i({b:e,combine:!0}),elements:(0,A.jsxs)(A.Fragment,{children:[s?(0,A.jsx)(G,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,A.jsx)(K,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,A.jsx)(V,{booking:n.b,combine:n.combine,onClose:()=>i(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),z=_r(_d[29]),B=_r(_d[30]),M=_r(_d[31]),N=_r(_d[32]),L=_r(_d[33]),A=_r(_d[34]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),R=Array.from({length:12},(e,t)=>String(t+1));function W(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function E(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function _(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=W(e),a=(0,v.useFloor)(t=>t.live[e])??{},n=(0,v.usePlan)(e),i=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(i,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const H=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function U({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=n?6:8,f=n?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(i??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,A.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],i=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!i,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,A.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:i?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,A.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,A.jsx)(C.T,{weight:"bold",size:22,colour:i?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,A.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,A.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,A.jsx)(C.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const q=[1,2,3,4,5,6,7,8];function G({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:r,r:d,now:u}=(0,y.useCtx)(15e3),x=_(r,u),[T,I]=(0,c.useState)(2),[P,$]=(0,c.useState)(!1),[O,z]=(0,c.useState)(i??null),B=(0,v.usePlan)(r),N=(0,k.useBookings)(r),L=(0,D.useBlocks)(e=>e.blocks),R=(0,D.closedAreasAt)(L,r,(0,w.ymd)(u),(0,w.hm)(u)),W=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(x).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(B,N.filter(e=>e.date===(0,w.ymd)(u)),e,T,u,(0,j.turnFor)(T,d.settings.turnMins),90,void 0,{closed:R})?.table??null},[B,N,x,T,R.size,u.getTime()]);(0,c.useEffect)(()=>{O&&(0,v.tablesOf)(O).some(e=>'Closed'===x[e]?.label)&&z(null)},[O,R.size]);const[H,G]=(0,c.useState)(!1),[V,Y]=(0,c.useState)(''),K=(e,t=String(e),s=()=>{$(!1),I(e)})=>{const o='9+'===t?P:!P&&T===e;return(0,A.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,A.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},Q=(0,A.jsx)(s.PartySizeInput,{value:T,onChange:I,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),X=(0,A.jsxs)(m.default,{style:{gap:8,width:n?256:void 0},children:[(0,A.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,A.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[q.map(e=>K(e)),K(9,'9+',()=>{$(!0),I(e=>e>=9?e:9)})]}),P?Q:null]}),[J,Z]=(0,c.useState)(!1),ee=async(t=O)=>{if(!J&&(0,M.guardBookingChange)(F)){Z(!0);try{const s=await k.repo.bookings.seatWalkIn(r,T,t??void 0,V);E(r,t??void 0),a(s),e()}finally{Z(!1)}}},te=(0,A.jsxs)(m.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,A.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,A.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),O?(0,A.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>z(null)}):null]}),(0,A.jsx)(U,{use:x,value:O,onPick:e=>{x[e]&&!x[e].busy?ee(e):z(O===e?null:e)},big:n,dense:n,best:W,bestSet:(0,h.bestTables)(B)}),(0,A.jsxs)(C.Muted,{children:["Tap a free table to seat them there",W&&!O?` (suggested for ${T}: ${(0,l.tableNumbers)(W)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(u)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,A.jsx)(C.Button,{label:`Seat walk-in \xb7 ${T} ${1===T?'person':'people'}${O?` \xb7 ${(0,l.tableNumbers)(O)}`:''}`,disabled:J,onPress:()=>{ee()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,A.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[X,te]}):(0,A.jsxs)(A.Fragment,{children:[X,te]}),(0,A.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[H?(0,A.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:V,onChangeText:Y,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,A.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,A.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,A.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function V({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,y.useCtx)(15e3),i=_(o,n),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(n)),t,e.partySize,n,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,n.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),P=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,$=D.reduce((e,t)=>e+P(t),0),O=D.length>0&&${if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&E(o,l),t()},B=x?(0,A.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,A.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,A.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${$} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,A.jsx)(m.default,{testID:"combine-short",children:(0,A.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-$," more needed. Add another table."]})}):null,(0,A.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,A.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,A.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,A.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,A.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,A.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${H(e)}`,testID:"assign-table-sheet",footer:B,children:[f&&!x?(0,A.jsx)(m.default,{testID:"assign-suggested",children:(0,A.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,A.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,A.jsx)(U,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function Y(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${H(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function K({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:N}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const R=(0,w.ymd)(p),[W,E]=(0,c.useState)(ee.blocks),[U,q]=(0,c.useState)(!1),[G,V]=(0,c.useState)(''),[Y,K]=(0,c.useState)(2),[Q,X]=(0,c.useState)(0),J=Math.min(Q,Math.max(0,Y-1)),[Z,ee]=(0,c.useState)(null),[te,se]=(0,c.useState)(''),[oe,le]=(0,c.useState)(''),[ae,ne]=(0,c.useState)(''),[ie,re]=(0,c.useState)(!1),[de,ue]=(0,c.useState)('phone'),[ce,be]=(0,c.useState)([]),[ge,he]=(0,c.useState)(''),[pe,me]=(0,c.useState)((0,P.emptyNeeds)()),fe=(0,P.needsMissing)(pe),[ye,ke]=(0,c.useState)(null),xe=(0,v.usePlan)(b),je=(0,O.dogSetUp)(xe),we=!0===pe.dog&&je,Se=pe.dog?pe.dogs:0,Te=(0,w.parseYmd)(W),Ce=(0,j.turnFor)(Y,h.settings.turnMins),ve=_.filter(e=>e.date===W),De=e=>(0,j.dogTablesAt)(xe,ve,Y,(0,j.slotStart)(W,e),Ce,h.settings.turnMins,(0,D.closedAreasAt)(H,b,W,e)),Ie=we&&Z?De(Z):[];(0,c.useEffect)(()=>{ke(null)},[we,Z,Y]);const Pe=(0,x.bookingSlots)(h,Te,e=>_.filter(t=>t.date===W&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Y,W===(0,w.ymd)(p)?p:(0,w.addMins)(Te,0),e=>_.filter(t=>t.date===W&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),$e=(0,T.guestPhone)(oe),[Oe,ze]=(0,c.useState)(!1),Be=Z?Pe.find(e=>e.time===Z):void 0,Me=Be&&Be.left=2&&!!Z&&(!Le||Oe)&&(0,o.validParty)(Y)&&$e.ok&&(0,T.emailOk)(ae)&&(!Ae||Fe&&U)&&(!we||Ie.length>0)&&!Re,Ee=pe.wheelchair>0||pe.stepFree,He=(0,$.bookingRulesOf)(h),Ue=(0,$.largeGroupTables)(He,Y),qe=(0,$.dogPartyCheck)(He,Y,!0===pe.dog,pe.assistDog),Ge=(0,$.bookingDepositSplit)((0,n.depositOf)(h.settings),Y,J,(0,P.needsPatch)(pe),(0,O.reservablesOf)(h));return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(Te)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,A.jsx)(P.FirstQuestions,{rid:b,value:pe,onChange:me,party:Y,audience:"staff"}),pe.dog&&!je?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,A.jsx)(I.BookingDatePicker,{r:h,today:p,value:W,onChange:e=>{e!==W&&(E(e),ee(null),q(!1))}}),(0,A.jsxs)(C.Row,{gap:6,children:[(0,A.jsx)(C.Chip,{label:"Phone",selected:'phone'===de,onPress:()=>ue('phone')}),(0,A.jsx)(C.Chip,{label:"In person",selected:'in-person'===de,onPress:()=>ue('in-person')})]}),(0,A.jsx)(C.Field,{label:"Name",value:G,onChangeText:V,placeholder:"e.g. Reid",testID:"nb-name"}),(0,A.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:oe,onChangeText:le,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!$e.ok&&oe?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:$e.error}):null,(0,A.jsx)(C.Field,{label:"Email (optional)",value:ae,onChangeText:ne,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email",testID:"nb-email"}),(0,T.emailOk)(ae)?null:(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),ae.trim()&&He.marketingOptIn?(0,A.jsx)(C.Toggle,{label:He.marketingWords,value:ie,onChange:re,testID:"nb-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,A.jsx)(i.AdultsChildren,{value:(0,r.peopleOf)(Y,J),onChange:e=>{K(e.partySize),X(e.children),ze(!1)},depositsOn:(0,n.depositOf)(h.settings).on&&(0,n.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,children:Pe.map(e=>{const t=we&&e.available&&!De(e.time).length||!(0,P.dogTimeOk)(h,_,W,e.time,Se);return(0,A.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(H,b,W,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:Z===e.time,onPress:()=>{ee(e.time),q(!1),ze(!1)}},e.time)})}),Le?(0,A.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[Me?(0,A.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Y,Me.left,Me.time)}):null,Ne?(0,A.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)(Ne.time,Ne.cap)}):null,(0,A.jsx)(C.Chip,{label:Oe?'Booking over the limit: on':'Book anyway (over the limit)',selected:Oe,onPress:()=>ze(e=>!e),testID:"nb-over-ok"})]}):null,we&&Z?(0,A.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,A.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,A.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",xe.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),Ie.length?xe.areas.filter(e=>Ie.some(t=>t.area===e.name)).map(e=>(0,A.jsxs)(m.default,{style:{gap:6},accessibilityLabel:e.name,children:[(0,A.jsxs)(C.T,{size:13,center:!0,colour:S.colours.muted,children:[e.name,e.outdoor?' (outdoor)':'']}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,children:Ie.filter(t=>t.area===e.name).map(e=>{const t=Ie[0]?.table===e.table;return(0,A.jsx)(C.Chip,{testID:`nb-dog-table-${(0,l.tableNumbers)(e.table)}`,label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.seats} seats${t?' \xb7 best':''}${Ee&&(0,O.accessibleSetUp)(xe)&&!(0,O.isAccessible)(xe,e.table)?' \xb7 not step-free':''}`,selected:(ye??Ie[0].table)===e.table,onPress:()=>ke(e.table)},e.table)})})]},e.id)):(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Y," at ",Z,". Try another time."]})]}):null,Ae?(0,A.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,A.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",Ae.from,"\u2013",Ae.to,Ae.reason?` (${Ae.reason})`:'']}),Fe?(0,A.jsx)(C.Chip,{label:U?'Manager override on':'Override and book anyway',selected:U,onPress:()=>q(e=>!e)}):(0,A.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,Pe.length?null:(0,A.jsx)(m.default,{testID:"nb-closed",children:(0,A.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(Te)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,A.jsx)(P.MoreQuestions,{rid:b,r:h,value:pe,onChange:me,party:Y,date:W,time:Z,today:(0,w.ymd)(p),bookings:_,audience:"staff",showTables:!1!==h.settings.tableRequests}),Ee&&!(0,O.accessibleSetUp)(xe)?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,Ue&&!we?(0,A.jsxs)(C.T,{size:14,colour:S.colours.goldLight,testID:"nb-large-group",children:["Large group: tables ",Ue.join(' + ')," joined."]}):null,qe.ok?null:(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,testID:"nb-dog-cap",children:["Online, a dog booking is for up to ",He.dogMaxParty," people. You can still book it here: check where they can sit."]}),(0,A.jsx)(C.T,{size:16,center:!0,children:"VIP or regular"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:L.TAGS.map(e=>{const t=ce.includes(e);return(0,A.jsx)(C.Chip,{label:e,selected:t,testID:`nb-tag-${e}`,onPress:()=>be(t?ce.filter(t=>t!==e):[...ce,e].sort())},e)})}),(0,A.jsx)(C.T,{size:16,center:!0,children:"Occasion"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:L.OCCASIONS.map(e=>(0,A.jsx)(C.Chip,{label:e.label,selected:ge===e.id,testID:`nb-occasion-${e.id||'none'}`,onPress:()=>he(e.id)},e.id||'none'))}),(0,A.jsx)(C.Field,{label:"Notes (optional)",value:te,onChangeText:se,placeholder:He.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"nb-notes"}),Ge.preorders?(0,A.jsxs)(C.Muted,{testID:"nb-preorder-deposit",children:["Pre-order deposit: ",(0,a.gbp)(Ge.preorders),Ge.adults?`, plus the group deposit: ${(0,a.gbp)(Ge.total)} in total`:'',". Staff can waive it."]}):null,(0,n.depositDue)((0,n.depositOf)(h.settings),Y,J)?(0,A.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(h.settings),Y,J))," (",(0,a.gbp)((0,n.depositOf)(h.settings).perPersonPence)," per adult for tables of ",(0,n.depositOf)(h.settings).fromParty,"+ adults",J?`; ${J} ${1===J?'child':'children'} free`:'; children free, and they do not count towards the number that needs a deposit',"). Staff can waive it. Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,A.jsx)(C.Muted,{children:"CoverCharge confirms the guest by email automatically (preview mode: shown in the Outbox, not sent)."}),Re?(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",Z,". Try another time: dogs are very welcome then."]}):null,(0,A.jsx)(C.Button,{label:fe.length?fe[0]:'Save booking',testID:"nb-save",disabled:!We,onPress:()=>{if(W<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,P.needsPatch)(pe),s=pe.tableReq.find(e=>!we||Ie.some(t=>t.table===e)),o=we?null:(0,B.requestedFreeTable)(pe.tableReq,{date:W,time:Z,partySize:Y},xe.tables.map(e=>e.name),ve,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:G.trim(),partySize:Y,date:W,time:Z,notes:te.trim(),security:Ge.total?'deposit':'none',depositPaid:0,...J?{children:J}:{},...Ge.total?{...(0,$.depositFields)(Ge),depositPolicy:(0,n.depositWords)((0,n.depositOf)(h.settings),Y,h.name,J).join(' '),depositRefundable:(0,n.depositOf)(h.settings).refundable,depositCutoffHours:(0,n.depositOf)(h.settings).cutoffHours}:{},phone:$e.pretty,email:ae.trim()||void 0,...ie?(0,$.marketingChoice)(ae,!0):{},source:de,...e,...Pe.find(e=>e.time===Z)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...ce.length?{tags:ce}:{},...ge?{occasion:ge}:{},...we?{table:ye??s??Ie[0]?.table}:o?{table:o}:{}}).then(e=>(0,z.postNewBookingToKitchen)(e,N)).catch(()=>{}),u?.({date:W,time:Z,name:G.trim()}),t()}})]})}},1096,[812,1097,1098,843,851,841,1099,1100,1101,1102,17,842,385,85,856,1055,858,1103,1074,863,804,848,777,996,993,1104,1105,1077,1053,1076,1094,1093,1111,1112,8]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,S]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{S(String(e))},[e]);const T=e=>p((0,s.clampParty)(e,b,y)),$=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>T(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:u.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(c.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:u.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?$(-10,'\u221210',"10 fewer people"):null,$(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{S(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&T((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);S(String(e)),T(e)},returnKeyType:"done",blurOnSubmit:!0,onSubmitEditing:e=>{e?.target?.blur?.()},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:u.colours.border,color:u.colours.text,backgroundColor:u.colours.surface,textAlign:'center',fontSize:20,fontFamily:u.fonts.semibold}}),$(1,'+','One more person'),y-b>=20?$(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),u=r(_d[5]),c=r(_d[6]),d=r(_d[7])},1097,[17,385,395,85,1098,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"overCapacityNote",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"overPartiesNote",{enumerable:!0,get:function(){return b}});const t=100,n=1,o=`Bookings are for ${n} to ${t} people.`,u=o=>'number'==typeof o&&Number.isInteger(o)&&o>=n&&o<=t,c=(o,u=n,c=t)=>{const s=parseInt(String(o??'').replace(/\D/g,'').slice(0,4),10);return Math.max(u,Math.min(c,Number.isFinite(s)?s:u))},s=(o,u=n,c=t)=>Math.max(u,Math.min(c,Math.round(Number(o)||u))),f=(t,n,o)=>n<=0?`${o} is already full for booked Covers. Booking ${t} more goes over the venue\u2019s limit: check tables and staffing.`:`${t} is more than the ${n} Covers left at ${o}. Booking goes over the venue\u2019s limit by ${t-n}: check tables and staffing.`,b=(t,n)=>`${t} already has the most bookings we take at one start time (${n}). Booking another goes over the venue\u2019s limit: check tables and staffing.`},1098,[]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdultsChildren=function({value:e,onChange:t,depositsOn:h,testID:x="people"}){const p=e=>t((0,s.storedPeople)(e)),b=(0,s.totalLine)(e);return(0,o.jsxs)(l.default,{testID:x,style:{gap:8,alignItems:'center',width:'100%'},children:[(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",children:"Adults"}),(0,o.jsx)(n.PartySizeInput,{value:e.adults,min:1,max:(0,s.maxAdults)(e.children),onChange:t=>p({adults:t,children:e.children}),label:"Adults",testID:`${x}-adults`}),(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",children:"Children"}),(0,o.jsx)(n.PartySizeInput,{value:e.children,min:0,max:(0,s.maxKids)(e.adults),onChange:t=>p({adults:e.adults,children:t}),label:"Children",testID:`${x}-children`}),(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",colour:c.colours.goldLight,testID:`${x}-total`,accessibilityLabel:b,children:b}),h?(0,o.jsx)(u.Muted,{center:!0,children:"Children never pay a deposit."}):null]})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4]),c=r(d[5]),o=r(d[6])},1099,[17,85,1100,1097,777,804,8]); @@ -1192,18 +1192,18 @@ __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,"ARM_MS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SELECT_HINT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SELECTED_A11Y",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"TABLE_SELECT_HINT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isArmed",{enumerable:!0,get:function(){return l}}),e.releaseOn=function(n,o,c,u){const b=l(n,o,u);return c?b?{arm:null,action:'move'}:{arm:n&&u-n.at!!n&&n.id===o&&c-n.at!e.signOff),S=k.filter(e=>e.signOff),_=j.map(o.allergenLabel).join(', '),C=e=>e.map(e=>e.name).join(', ')||'none';return(0,f.jsxs)(l.default,{testID:"menu-allergy-check",style:{gap:6,borderWidth:1,borderColor:p.length?h.colours.red:h.colours.border,borderRadius:12,padding:10,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(u.T,{weight:"semibold",children:["Allergy check against the menu (",_,")"]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.red,children:["Contains: ",p.length," dish",1===p.length?'':'es']}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.amber,children:["May contain: ",M.length]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.ok,children:["Free from ",1===j.length?'it':'them'," (signed off): ",S.length]}),w.length?(0,f.jsxs)(u.Muted,{children:[w.length," more awaiting the head chef's sign-off, so not shown as safe."]}):null,(0,f.jsx)(n.default,{testID:"menu-allergy-details",accessibilityRole:"button",onPress:()=>y(!x),hitSlop:6,children:(0,f.jsx)(u.T,{size:14,colour:h.colours.gold,children:x?'Hide dishes':'Show dishes'})}),x?(0,f.jsxs)(l.default,{style:{gap:4},children:[(0,f.jsxs)(u.Muted,{children:["Contains: ",C(p)]}),(0,f.jsxs)(u.Muted,{children:["May contain: ",C(M)]}),(0,f.jsxs)(u.Muted,{children:["Free from: ",C(S)]})]}):null,(0,f.jsx)(u.Muted,{children:'guest'===m?'From the kitchen\u2019s signed-off recipe cards. Specials on the board are checked by staff on the day.':'From the signed-off recipe cards. Specials on the board have their own allergens. Still check with the guest and the kitchen.'})]})};var s=r(d[0]),n=e(r(d[1])),l=e(r(d[2])),t=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8])},1110,[17,385,85,858,845,847,804,777,8]); __d(function(g,r,i,_a,m,_e,d){"use strict";function t(t){return String(t??'').split('+').map(t=>t.trim()).filter(Boolean)}function e(t){return t.length<=1?t[0]??'':2===t.length?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`}function n(n){const o=t(n);return o.length>1?`tables ${e(o)}`:o.length?`table ${o[0]}`:''}Object.defineProperty(_e,'__esModule',{value:!0}),_e.tableWords=n,Object.defineProperty(_e,"RECENT_SEATED_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"FINISH_UNDO_MS",{enumerable:!0,get:function(){return a}}),_e.seatedAgoMs=s,_e.seatedAgoWords=u,_e.needsRecentSeatedWarning=c,_e.finishConfirmPrompt=function(t){const e=t.name.trim()||'This party',n=t.parties&&t.parties>1?t.parties:1,o=t.seated&&c({seatedAt:t.seatedAt},t.now),a=o?u(s({seatedAt:t.seatedAt},t.now)):'',l=f(t.table);if(!t.seated)return`Mark ${e} finished without seating?`;if(n>1){return`${n} parties seated here${o?`, including ${e} seated ${a}`:''}. Mark all finished${l}?`}return o?`${e} seated ${a}. Mark finished${l}?`:`Mark ${e} finished${l}?`},_e.restoreSeatedPrompt=function(t,e){return`${t.trim()||'This party'} is finished. Seat them at ${n(e)}?`},_e.lastTableFromAudit=l,_e.tableForUndo=function(t,e){const n=String(t.table??'').trim();if(n)return n;const o=String(t.lastTable??'').trim();return o||l(e)},_e.finishClearPatch=function(t,e){const n=String(e??'').trim();return{status:'finished',finishedAt:t,table:void 0,...n?{lastTable:n}:{}}},_e.finishUndoPatch=function(t){const e=String(t??'').trim();return{status:'seated',finishedAt:void 0,lastTable:void 0,...e?{table:e}:{table:void 0}}};const o=15,a=15e3;function s(t,e){if(!t.seatedAt)return null;const n=new Date(t.seatedAt).getTime();return Number.isFinite(n)?Math.max(0,e.getTime()-n):null}function u(t){const e=Math.round(t/1e3);if(e<1)return'just now';if(e<60)return`${e} second${1===e?'':'s'} ago`;const n=Math.round(e/60);if(n<60)return`${n} minute${1===n?'':'s'} ago`;const o=Math.round(n/60);return`${o} hour${1===o?'':'s'} ago`}function c(t,e){const n=s(t,e);return null!=n&&n<9e5}function f(t){const e=t?n(t):'';return e?` and set ${e} to needs clearing`:''}function l(t){if(!t?.length)return;const e=[...t].sort((t,e)=>String(e.at??'').localeCompare(String(t.at??'')));for(const t of e){if(t.action&&'tables'!==t.action)continue;const e=String(t.from_value??'').trim(),n=String(t.to_value??'').trim();if(e&&!n)return e.replace(/\+/g,'+')}for(const t of e){if(t.action&&'tables'!==t.action)continue;const e=String(t.to_value??'').trim();if(e)return e;const n=String(t.from_value??'').trim();if(n)return n}}},1111,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FinishConfirm=I,_e.RestoreSeatedConfirm=function({prompt:e,onYes:t,onNo:n}){return(0,k.jsxs)(s.default,{testID:"restore-seated-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:"Yes, seat them",testID:"restore-seated-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"restore-seated-no",onPress:n,style:w})]})},Object.defineProperty(_e,"finishBookingNow",{enumerable:!0,get:function(){return p.finishBookingNow}}),_e.undoFinishedNow=D,_e.restoreFinishedToTable=async function(e,t,s){const o=(0,b.tableKey)(s);await n.repo.bookings.update(t.id,{...(0,f.tablePatch)(o||null),status:'seated',finishedAt:void 0,lastTable:void 0}),o&&(0,p.resetTableLive)(e,o)},_e.offerFinishUndo=F,_e.finishAndOfferUndo=v,_e.finishUnseatedAndOfferUndo=N,_e.FinishButton=function({rid:e,b:s,name:n,allowed:o=!0,hint:c,small:b,bigToast:f,testID:u,label:h="Finished",a11y:p,kind:D="secondary"}){const[F,j]=t.default.useState(!1);if(!o)return null;const x=(0,l.finishConfirmPrompt)({name:n,table:s.table,seatedAt:s.seatedAt,now:new Date,seated:'seated'===s.status});if(F)return(0,k.jsx)(I,{prompt:x,onNo:()=>j(!1),onYes:()=>{j(!1),'seated'===s.status?v(e,[s],n,{big:f,table:s.table}):N(e,s,n,{big:f})}});return(0,k.jsx)(y.Button,{small:b,kind:D,label:h,testID:u,accessibilityLabel:p??`${h}: ${n}`,accessibilityHint:c,disabled:!o,onPress:()=>j(!0),style:b?void 0:w})};var t=e(r(d[0])),s=e(r(d[1])),n=r(d[2]),o=r(d[3]),l=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),u=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]);const w={minHeight:64};function I({prompt:e,onYes:t,onNo:n,yesLabel:o="Yes, finish"}){return(0,k.jsxs)(s.default,{testID:"finish-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:o,testID:"finish-confirm-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"finish-confirm-no",onPress:n,style:w})]})}async function D(e,t,s){const c=(0,l.tableForUndo)(t,s);await n.repo.bookings.update(t.id,(0,l.finishUndoPatch)(c)),c&&(0,o.tablesOf)(c).forEach(t=>o.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function F(e){const t=e.bookings[0];if(!t)return;const s=e.bookings.length>1?`${e.bookings.length} parties finished.`:`${e.name} finished.`,n=e.table?`${(0,c.tableWords)(e.table).replace(/^t/,'T')} needs clearing.`:void 0,o=`finish-undo-${t.id}`;(0,u.notify)({id:o,title:s,body:n,timeoutMs:l.FINISH_UNDO_MS,big:e.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{for(const t of e.bookings)await D(e.rid,{...t,table:void 0,lastTable:t.table||t.lastTable});(0,u.dismissNotice)(o)})()}}]})}async function v(e,t,s,n){const o=n?.table??t.find(e=>e.table)?.table;for(const s of t)await(0,p.finishBookingNow)(e,s);F({rid:e,bookings:t,name:s,table:o,big:n?.big})}async function N(e,t,s,o){await n.repo.bookings.setStatus(t.id,'finished');const c=`finish-undo-${t.id}`;(0,u.notify)({id:c,title:`${s} finished.`,timeoutMs:l.FINISH_UNDO_MS,big:o?.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{await n.repo.bookings.setStatus(t.id,t.walkIn?'cancelled':'confirmed'),(0,u.dismissNotice)(c)})()}}]})}},1112,[17,85,858,996,1111,1113,1094,1090,916,804,777,1096,8]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return s.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return c}}),e.freeTablesNow=function(t,a,s=!1){const l=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),n=l.filter(([,t])=>t.table.maxSeats>=a),o=t=>t.map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}));return s?[...o(n),...o(l.filter(([,t])=>t.table.maxSeatsh[t]&&(l.includes(h[t].status)||'dirty'===h[t].status||'blocked'===h[t].status));if(p.length&&p.every(t=>h[t])&&!t.length)f.push({id:'seat',label:`Seat at ${b(s.table).replace(/^t/,'T')}`,a11y:`Seat ${n}, ${u(s.partySize)}, at ${b(s.table)}`,table:s.table});else if(c(s,$)){const a=p.length?t.length?`${b(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===h[t[0]].status?'waiting to be cleared':'blocked'===h[t[0]].status?'blocked':'in use'}`:`${b(s.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';f.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${n}, ${u(s.partySize)}. ${a}.`,note:a})}c(s,$)&&f.push({id:'finished',label:'Finished',a11y:`Finished, ${n}, ${s.time} booking, without seating at a table`}),o($,s)<=0&&f.push({id:'noshow',label:'No-show',a11y:`No-show, ${n}, ${s.time} booking`})}return f.push({id:'details',label:'Guest details',a11y:`Guest details, ${n}`}),f};var t=r(d[0]),a=r(d[1]),s=r(d[2]);const l=['seated','mains','dessert','bill'],n=t=>new Date(`${t.date}T${t.time}:00`),o=(t,a)=>(n(a).getTime()-t.getTime())/6e4,b=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},u=t=>`${t} ${1===t?'person':'people'}`,c=(t,a)=>o(a,t)<=45},1113,[996,863,1074]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return x}}),_e.cancelWalkInWords=I,_e.reinstateWalkInWords=$,_e.cancelWalkInNow=j,_e.reinstateWalkInNow=C,_e.CancelWalkInButton=function({rid:e,b:t,onDone:o,small:c,big:u}){const[b,f]=(0,n.useState)(!1),k=(0,l.useInStaffApp)(),x=(0,s.useSeatClearFinish)();return p(t)?k&&!x.ok?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(w.Button,{kind:"secondary",small:c,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>f(!0),style:u?{minHeight:64}:c?{minHeight:44}:h}),b?(0,y.jsx)(W,{rid:e,b:t,onClose:()=>f(!1),onDone:o}):null]}):null},_e.CancelWalkInConfirm=W,_e.ReinstateWalkInButton=function({rid:e,b:t,today:o,onDone:u,small:b}){const[f,p]=(0,n.useState)(!1),I=(0,l.useInStaffApp)(),j=(0,s.useSeatClearFinish)();if(!x(t,o))return null;if(I&&!j.ok)return null;const W=$(t);if(!f)return(0,y.jsx)(w.Button,{kind:"ghost",small:b,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>p(!0),style:b?{minHeight:44}:h});return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:()=>p(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:W,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:W})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[h,{flexGrow:1}],onPress:async()=>{await C(e,t),p(!1),u?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>p(!1),style:h})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]),o=r(d[4]),c=(e=o)&&e.__esModule?e:{default:e},u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]),w=r(d[9]),y=r(d[10]);const h={minHeight:56},p=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),x=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function I(e){const t=(0,b.tablesOf)(e.table),n=(0,f.tablesWords)(t);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${t.length?` at ${n}`:''}, arrived ${e.time}? It comes off the Covers${t.length?` and ${n} ${t.length>1?'go':'goes'} back to Free`:''}.`}function $(e){return`Put walk-in ${e.ref} back to seated? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`}async function j(e,n){await u.repo.bookings.setStatus(n.id,'cancelled'),await u.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,b.tablesOf)(n.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function C(e,t){await u.repo.bookings.setStatus(t.id,'seated'),(0,b.tablesOf)(t.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function W({rid:e,b:t,onClose:n,onDone:l}){const s=I(t);return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:s,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:s})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[h,{flexGrow:1}],onPress:async()=>{await j(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,b.tablesOf)(t.table).length?` ${(0,f.tablesWords)((0,b.tablesOf)(t.table))} free.`:''}`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:h})]})]})}},1114,[1115,17,1055,1117,85,858,996,1094,804,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.cancelStamp=C,_e.cancelBookingNow=w,_e.reinstateBookingNow=$,_e.CancelBookingButton=function({rid:e,b:n,name:o,onDone:s,big:l,small:c}){const[u,f]=(0,t.useState)(!1);return(0,b.canCancelBooking)(n)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(x.Button,{kind:"secondary",small:c,label:"Cancel booking",testID:`cancel-booking-${n.id}`,accessibilityLabel:`Cancel booking for ${o}, ${n.time}, ${n.partySize} Covers`,onPress:()=>f(!0),style:l?{minHeight:64}:c?{minHeight:44}:j}),u?(0,h.jsx)(D,{rid:e,b:n,name:o,onClose:()=>f(!1),onDone:s}):null]}):null},_e.CancelBookingConfirm=D,_e.ReinstateBookingButton=function({b:e,name:n,today:s,onDone:l}){const[c,u]=(0,t.useState)(!1);if(!(0,b.canReinstateBooking)(e,s))return null;const y=(0,b.reinstateBookingWords)(e,n);if(!c)return(0,h.jsx)(x.Button,{kind:"ghost",label:"Undo cancel",testID:`reinstate-booking-${e.id}`,accessibilityLabel:`Undo cancel for ${n}`,onPress:()=>u(!0),style:j});return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:()=>u(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center'},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, put back to booked",testID:"reinstate-booking-yes",accessibilityLabel:`Yes, put ${n} back to booked`,style:[j,{flexGrow:1}],onPress:async()=>{await $(e),u(!1),l?.(`${n} put back to booked.`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-booking-no",onPress:()=>u(!1),style:j})]})]})};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]),c=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]),y=r(d[8]),k=r(d[9]),p=r(d[10]),x=r(d[11]),h=r(d[12]);const j={minHeight:56},B={display:'Display',owner:'Managers app',staff:'Staff app',chef:'Kitchen app',customer:'Customer page'};function C(e){const t=y.useSession.getState().meId,n=t?k.useOwner.getState().staff.find(e=>e.id===t):void 0,o=B[p.APP_VARIANT]??'CoverCharge';return{by:n?`${n.name.replace(' (example)','')} (${o})`:o,at:(new Date).toISOString(),app:o,...e.table?{table:e.table}:{}}}async function w(e,t){const n=(0,l.tablesOf)(t.table);await s.repo.bookings.update(t.id,{status:'cancelled',cancelled:C(t),...(0,c.tablePatch)(null)}),n.forEach(t=>l.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function $(e){await s.repo.bookings.setStatus(e.id,'confirmed')}function D({rid:e,b:t,name:n,onClose:s,onDone:c}){const y=(0,b.cancelBookingWords)(t,n),k=(0,l.tablesOf)(t.table);return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:s,title:"Cancel booking?",maxWidth:560,testID:"cancel-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center',gap:8},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, cancel booking",testID:"cancel-booking-yes",accessibilityLabel:`Yes, cancel booking for ${n}`,style:[j,{flexGrow:1}],onPress:async()=>{await w(e,t),s(),c?.(`${n} cancelled.${k.length?` ${(0,u.tablesWords)(k)} free.`:''}`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep booking",testID:"cancel-booking-no",accessibilityLabel:`Keep booking for ${n}`,onPress:s,style:j})]})]})}},1115,[17,85,858,996,1090,1116,1094,804,920,876,856,777,8]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canCancelBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canReinstateBooking",{enumerable:!0,get:function(){return t}}),e.cancelBookingWords=function(n,t){const o=`${n.partySize} Cover${1===n.partySize?'':'s'}`;return`Cancel booking for ${t}, ${n.time}, ${o}? The table is freed. Website bookings will cancel it on the website and may email the guest.`},e.reinstateBookingWords=function(n,t){return`Put ${t} back to booked for ${n.time}? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`},e.cancelledOnDay=o,e.cancelledDayTally=function(n,t){const a=o(n,t),l=a.filter(n=>!!n.walkIn),c=a.filter(n=>!n.walkIn);return{count:a.length,covers:a.reduce((n,t)=>n+t.partySize,0),bookings:c.length,bookingCovers:c.reduce((n,t)=>n+t.partySize,0),walkIns:l.length,walkInCovers:l.reduce((n,t)=>n+t.partySize,0),list:a}},e.cancelledTallyWords=function(n,t="today"){if(!n.count)return`No cancellations ${t}`;const o=[],a=n.bookings??0,l=n.walkIns??0;a&&o.push(`${a} booking${1===a?'':'s'} (${n.bookingCovers??0} Cover${1===(n.bookingCovers??0)?'':'s'})`);l&&o.push(`${l} walk-in${1===l?'':'s'} (${n.walkInCovers??0} Cover${1===(n.walkInCovers??0)?'':'s'})`);if(!o.length)return`Cancelled ${t}: ${n.count} \xb7 ${n.covers} Cover${1===n.covers?'':'s'}`;return`Cancelled ${t}: ${o.join(' \xb7 ')}`};const n=n=>!n.walkIn&&('confirmed'===n.status||'pending'===n.status||'seated'===n.status),t=(n,t)=>!n.walkIn&&'cancelled'===n.status&&n.date>=t;function o(n,t){return n.filter(n=>n.date===t&&'cancelled'===n.status).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name))}},1116,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSeatClearFinish=function(){const t=(0,A.useSignedIn)(),o=(0,A.useInStaffApp)(),_='staff'===s.APP_VARIANT||'chef'===s.APP_VARIANT||o,l=(0,c.canSeatClearFinish)({device:s.IS_CAR||'display'===s.APP_VARIANT||!_&&!t,viaDisplay:(0,n.isKitchenViaDisplay)(),role:t?.role,ownerAccess:t?.ownerAccess,managerAccess:t?.managerAccess});return{ok:l,hint:l?void 0:c.SEAT_CLEAR_HINT}};var s=r(d[0]),n=r(d[1]),c=r(d[2]),A=r(d[3])},1117,[856,922,1118,1055]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEAT_CLEAR_HINT",{enumerable:!0,get:function(){return n}}),e.canSeatClearFinish=function(n){return!(!n.device&&!n.viaDisplay)||('owner'===n.role||'manager'===n.role||!(!n.ownerAccess&&!n.managerAccess))};const n='Ask a manager to seat, finish or clear a table.'},1118,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:s,who:i,role:n,inStaffApp:l,shiftManager:a,big:o,testID:d}){const[h,u]=(0,t.useState)(!1),p=(0,b.useSession)(e=>e.meId),y=(0,m.useOwner)(e=>e.staff.find(e=>e.id===p&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:l,role:n,shiftManager:a})||p&&!(0,x.canChangeBookings)(y)?null:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:d??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),h?(0,N.jsx)(V,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:n,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,l.useBookings)(e).filter(e=>!e.walkIn&&e.date>=s&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,200);return o?(0,N.jsx)(V,{rid:e,id:o,who:i,hidePrivate:a,onClose:n}):(0,N.jsxs)(z.Sheet,{visible:!0,onClose:n,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,N.jsx)(z.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${L(e.date,s)} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${L(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,N.jsx)(z.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,N.jsx)(z.Button,{kind:"ghost",label:"Close",onPress:n,style:{minHeight:44}})]})},_e.EditBookingSheet=V;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=(e=i)&&e.__esModule?e:{default:e},l=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),f=_r(_d[19]),C=_r(_d[20]),I=_r(_d[21]),k=_r(_d[22]),w=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),O=_r(_d[28]),W=_r(_d[29]),z=_r(_d[30]),B=_r(_d[31]),N=_r(_d[32]);const E=/^([01]\d|2[0-3]):[0-5]\d$/,R=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const L=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,D.ymd)(s)?'Tomorrow':F(e)};const A=e=>e?(e/100).toFixed(e%100?2:0):'',M=e=>{const t=(0,B.parseMoneyInput)(e);return null!=t&&t>=0?Math.round(100*t):NaN},F=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',H=e=>{const t=e.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);return t?`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`:''},_=e=>e.charAt(0).toUpperCase()+e.slice(1);function Y({title:e,children:t,testID:s}){return(0,N.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,N.jsx)(z.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const G=({label:e,value:t,onChange:s,max:i=20,testID:n})=>(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:e}),(0,N.jsx)(z.Stepper,{testID:n,value:t,min:0,max:i,onChange:s,label:e})]});function V({rid:e,id:i,who:b,onClose:m,hidePrivate:x=!1}){(0,$.useBlurOutside)();const B=(0,l.useBookings)(e),L=B.find(e=>e.id===i),V=(0,d.useRestaurant)(e),K=(0,a.usePlan)(e),U=(0,o.useBlocks)(e=>e.blocks),[q,X]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Q,J]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Z,ee]=(0,t.useState)(!1),[te,se]=(0,t.useState)(null),[ie,ne]=(0,t.useState)(null),[le,ae]=(0,t.useState)(!1),[oe,de]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositDue:0)),[re,ce]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositAmount:0)),[he,ue]=(0,t.useState)(F(L?(0,c.draftOf)(L).depositDate:''));if(!L||!q||!V)return null;const pe=e=>{se(null),ne(null),X({...q,...e})},ge=(0,O.depositOf)(V.settings),be=e=>{const t=e.partySize??q.partySize,s=Math.min(e.children??q.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(L)&&q.depositOn&&!q.depositPaid&&M(oe||'0')===(0,O.depositDue)(ge,q.partySize,q.children??0)){const e=(0,O.depositDue)(ge,t,s);e>0&&de(A(e))}pe({...e,children:s})},me=(0,v.bookingSlotMinutesOf)(V),xe=R(q.time),ye=E.test(xe),je=q.area?K.areas.filter(e=>e.name===q.area).map(e=>e.id):null,De=e=>!je||e.split('+').every(e=>je.includes(K.tables.find(t=>t.name===e)?.areaId??'')),ve=(0,y.tableOptions)(K,B.filter(e=>e.date===q.date),q.table).filter(e=>De(e)||e===q.table),fe=!(q.depositOn&&(Number.isNaN(M(oe||'0'))||q.depositPaid&&(Number.isNaN(M(re||'0'))||he.trim()&&!H(he)))),Ce={...q,time:xe,depositDue:M(oe||'0')||0,depositAmount:M(re||'0')||0,depositDate:H(he)},Ie=(0,c.changedDraftFields)(Q??(0,c.draftOf)(L),Ce),ke=V.settings.turnMins??90,we=!!q?.email?.trim()&&q.email.trim()!==(L?.email??'').trim(),Te=(0,u.bookingRulesOf)(V),Se=async()=>{const t=(0,c.editPatch)(L,Ce,{by:b||'Team member',app:r.APP_VARIANT});if(le&&we&&Object.assign(t,(0,u.marketingChoice)(Ce.email,!0)),Object.keys(t).length&&await l.repo.bookings.update(L.id,t),'seated'===L.status&&'table'in t&&t.table!==L.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(L.table),n=s(t.table),l=a.useFloor.getState(),o=i.map(t=>l.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!n.includes(e)).forEach(t=>l.setLive(e,t,{stage:void 0,dirty:!0})),n.forEach(t=>l.setLive(e,t,{stage:o,dirty:!1}))}ne(`Saved. Changed: ${(0,c.editedWords)(Ie)}.`),se(null),m()},$e=()=>{const t=ye?(0,o.blockAt)(U,e,q.date,xe):void 0,s=(0,c.editWarnings)(L,Ce,B,t,ke,K);!s.length||te?Se():se(s)},Pe=q.allergies??[],Oe=e=>pe({allergyNone:!1,allergies:Pe.some(t=>t.allergen===e)?Pe.filter(t=>t.allergen!==e):[...Pe,{allergen:e,severity:'allergy'}]}),We=(0,c.historyLines)(L);return(0,N.jsxs)(z.Sheet,{visible:!0,onClose:()=>{Ie.length?ee(!0):(ee(!1),m())},title:`Edit booking \xb7 ${L.name} \xb7 ${L.ref}`,maxWidth:760,testID:"edit-booking-sheet",onTypingDone:()=>{(0,C.hideKeyboard)(),Ie.length&&ye&&fe&&q.name.trim().length>=1&&$e()},typingDoneLabel:Ie.length?'Done, save changes':'Done, hide the keyboard',footer:(0,N.jsx)(z.Button,{label:te?'Save anyway':'Save changes',testID:"edit-save",disabled:!ye||!fe||q.name.trim().length<1||!Ie.length,onPress:$e,style:{minHeight:56,width:'100%'}}),children:[(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(w.DepositChip,{b:L,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(L)?(0,N.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,N.jsxs)(Y,{title:"Deposit",testID:"edit-section-deposit",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No deposit",selected:!q.depositOn,testID:"edit-deposit-none",onPress:()=>pe({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit due",selected:!!q.depositOn&&!q.depositPaid&&!q.depositWaived,testID:"edit-deposit-due",onPress:()=>pe({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit paid",selected:!!q.depositOn&&!!q.depositPaid,testID:"edit-deposit-paid",onPress:()=>{re||ce(oe),he||ue(F((0,D.ymd)(new Date))),pe({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsx)(z.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsxs)(z.T,{size:15,center:!0,colour:j.colours.goldLight,testID:"edit-deposit-waived-by",children:[L.depositWaived?.by?(0,O.waiverText)(L.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,q.depositWaived||Ie.includes('deposit')?null:(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(P.WaiveDepositButton,{b:L,who:b,onDone:e=>{const t={...q,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e};X(t),J(s=>s?{...s,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e}:t)}})}),q.depositOn?(0,N.jsx)(z.Field,{money:!0,label:"Deposit due (\xa3)",value:oe,onChangeText:e=>{de(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,q.depositOn&&q.depositPaid?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Field,{money:!0,label:"Amount paid (\xa3)",value:re,onChangeText:e=>{ce(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"How was it paid?"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,N.jsx)(z.Chip,{label:_(e),selected:q.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>pe({depositMethod:e})},e))}),(0,N.jsx)(z.Field,{label:"Date paid (DD/MM/YYYY)",value:he,onChangeText:e=>{ue((0,s.slashDate)(e,he)),pe({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),he.trim()&&!H(he)?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,fe?null:(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,N.jsx)(z.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,N.jsxs)(Y,{title:"When",testID:"edit-section-when",children:[(0,N.jsx)(k.BookingDatePicker,{r:V,today:new Date,value:q.date,onChange:e=>pe({date:e})}),(0,N.jsx)(I.TimeRoller,{testID:"edit-time",value:(0,f.snapTime)(q.time,me),onChange:e=>pe({time:e}),step:me}),ye?null:(0,N.jsx)(z.T,{size:15,colour:j.colours.amber,center:!0,children:"Choose a time on the roller."}),(0,N.jsx)(T.AdultsChildren,{value:(0,S.peopleOf)(q.partySize,q.children),onChange:e=>be(e),depositsOn:ge.on&&ge.perPersonPence>0,testID:"edit-people"}),(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:"Table time"}),(0,N.jsx)(z.Stepper,{testID:"edit-duration",value:q.duration||0,min:0,max:360,step:15,onChange:e=>pe({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,N.jsxs)(Y,{title:"Where",testID:"edit-section-where",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"Any area",selected:!q.area,testID:"edit-area-any",onPress:()=>pe({area:''})}),K.areas.map(e=>(0,N.jsx)(z.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:q.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>pe({area:e.name})},e.id))]}),(0,N.jsx)(z.T,{size:18,weight:"semibold",center:!0,children:(0,y.tableButtonLabel)(q.table)}),(0,y.splitChoices)(q.table).length?(0,N.jsxs)(n.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:"Split the joined tables"}),(0,N.jsx)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,y.splitChoices)(q.table).map(e=>(0,N.jsx)(z.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>pe({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:q.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(q.table?'':', chosen'),onPress:()=>pe({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),ve.map(e=>(0,N.jsx)(z.Button,{kind:e===q.table?'primary':'secondary',label:(0,y.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,y.tableButtonLabel)(e)}${e===q.table?', chosen':''}`,onPress:()=>pe({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,N.jsxs)(Y,{title:"Guest",testID:"edit-section-guest",children:[(0,N.jsx)(z.Field,{label:"Name",value:q.name,onChangeText:e=>pe({name:e}),testID:"edit-name"}),(0,N.jsx)(z.Field,{label:"Phone",value:q.phone,onChangeText:e=>pe({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,N.jsx)(z.Field,{label:"Email",value:q.email,onChangeText:e=>pe({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),we&&Te.marketingOptIn?(0,N.jsx)(z.Toggle,{label:Te.marketingWords,value:le,onChange:ae,testID:"edit-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,N.jsx)(z.T,{size:16,center:!0,children:"Booked by"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>pe({source:e.id})},e.id))}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(q.tags??[]).includes(e);return(0,N.jsx)(z.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>pe({tags:t?(q.tags??[]).filter(t=>t!==e):[...q.tags??[],e].sort()})},e)})})]}),(0,N.jsxs)(Y,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,N.jsx)(G,{label:"Dogs",value:q.dogs??0,max:6,onChange:e=>pe({dogs:e}),testID:"edit-dogs"}),(0,N.jsx)(G,{label:"High chairs",value:q.highChairs??0,max:10,onChange:e=>pe({highChairs:e}),testID:"edit-high-chairs"}),(0,N.jsx)(G,{label:"Wheelchair users",value:q.wheelchair??0,max:10,onChange:e=>pe({wheelchair:e}),testID:"edit-wheelchair"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"Occasion"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:(q.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>pe({occasion:e.id})},e.id||'none'))})]}),(0,N.jsxs)(Y,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No allergies",selected:!!q.allergyNone&&!Pe.length,testID:"edit-allergy-none",onPress:()=>pe({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,N.jsx)(z.Chip,{label:e.short,selected:Pe.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>Oe(e.id)},e.id))]}),Pe.map(e=>(0,N.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,N.jsxs)(z.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,N.jsx)(z.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>pe({allergies:Pe.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,N.jsx)(z.Field,{label:"Anything else about allergies",value:q.allergyNote,onChangeText:e=>pe({allergyNote:e}),testID:"edit-allergy-note"}),Ie.includes('allergies')&&Pe.length?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,N.jsx)(G,{label:"Vegan",value:q.vegan??0,max:q.partySize,onChange:e=>pe({vegan:e}),testID:"edit-vegan"}),(0,N.jsx)(G,{label:"Vegetarian",value:q.vegetarian??0,max:q.partySize,onChange:e=>pe({vegetarian:e}),testID:"edit-vegetarian"})]}),(q.holds??[]).length||(L.holds??[]).some(e=>e.qty>0&&!e.served)?(0,N.jsxs)(Y,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,N.jsx)(z.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(q.holds??[]).map(e=>{const t=(0,h.reservablesOf)(V),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),l=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,N.jsxs)(n.default,{testID:l,style:{gap:6,width:'100%'},children:[(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,N.jsx)(z.Stepper,{testID:l,value:e.qty,min:0,max:20,onChange:t=>pe({holds:(0,c.setEditableHoldQty)(q.holds??[],e.kind,e.id,t)}),label:i})]}),(0,N.jsx)(z.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${l}-remove`,onPress:()=>pe({holds:(0,c.removeEditableHold)(q.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(q.holds??[]).length?null:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==L.status?(0,N.jsxs)(Y,{title:"Status",testID:"edit-section-status",children:[(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>pe({status:e.id})},e.id))}),(0,N.jsx)(z.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,N.jsx)(Y,{title:"Notes",testID:"edit-section-notes",children:(0,N.jsx)(z.Field,{label:"Notes",value:q.notes,onChangeText:e=>pe({notes:e}),placeholder:Te.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),te?(0,N.jsxs)(n.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[te.map(e=>(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,ie?(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:ie}):null,Z?(0,N.jsxs)(n.default,{testID:"edit-discard-warn",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:j.colours.gold,backgroundColor:j.colours.surface2},children:[(0,N.jsx)(z.T,{size:20,weight:"bold",center:!0,children:"Discard unsaved changes?"}),(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.muted,children:"Your changes have not been saved."}),(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:"secondary",label:"Keep editing",testID:"edit-discard-keep",onPress:()=>ee(!1),style:{minHeight:52,flex:1}}),(0,N.jsx)(z.Button,{kind:"danger",label:"Discard changes",testID:"edit-discard-discard",onPress:()=>{ee(!1),m()},style:{minHeight:52,flex:1}})]})]}):null,We.length?(0,N.jsx)(Y,{title:"Changes",testID:"edit-history",children:We.slice(0,12).map((e,t)=>(0,N.jsx)(z.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,N.jsx)(W.CancelBookingButton,{rid:e,b:L,name:L.name,big:!0,onDone:()=>m()}),(0,N.jsx)(W.ReinstateBookingButton,{b:L,name:L.name,today:(0,D.ymd)(new Date),onDone:()=>m()})]})}},1119,[17,1031,85,858,996,993,860,856,1120,1053,1077,845,920,876,994,1090,804,863,1103,1121,815,1122,1104,1087,1099,1100,1101,1123,841,1115,777,840,8]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedDraftFields=W,_e.changedFields=j,_e.historyText=E,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=j(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:E(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${D(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!j(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return x}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: high chair, birthday, quiet table',o='This booking is on the website too. Saving here updates the website booking. The website may email the guest about a new date, time or status.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],u=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],h=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],k=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),w=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return w(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){return l.filter(i=>M(i,e)!==M(i,t))}function j(e,t){return W(y(e),t)}const A=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,D=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function E(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${A(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=k(o.holds),i=k(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${D(s)}`}const x=e=>e.map(e=>f[e]).join(', ')},1120,[1053,1098,1090,1094]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedDraftFields=W,_e.changedFields=j,_e.historyText=E,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=j(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:E(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${D(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!j(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return x}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: high chair, birthday, quiet table',o='This booking is on the website too. Saving here updates the website booking. The website may email the guest about a new date, time or status.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],u=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],h=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],k=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),w=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return w(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){return l.filter(i=>M(i,e)!==M(i,t))}function j(e,t){return W(y(e),t)}const A=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,D=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function E(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${A(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=k(o.holds),i=k(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${D(s)}`}const x=e=>e.map(e=>f[e]).join(', ')},1112,[1053,1098,1090,1094]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FinishConfirm=I,_e.RestoreSeatedConfirm=function({prompt:e,onYes:t,onNo:n}){return(0,k.jsxs)(s.default,{testID:"restore-seated-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:"Yes, seat them",testID:"restore-seated-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"restore-seated-no",onPress:n,style:w})]})},Object.defineProperty(_e,"finishBookingNow",{enumerable:!0,get:function(){return p.finishBookingNow}}),_e.undoFinishedNow=D,_e.restoreFinishedToTable=async function(e,t,s){const o=(0,b.tableKey)(s);await n.repo.bookings.update(t.id,{...(0,f.tablePatch)(o||null),status:'seated',finishedAt:void 0,lastTable:void 0}),o&&(0,p.resetTableLive)(e,o)},_e.offerFinishUndo=F,_e.finishAndOfferUndo=v,_e.finishUnseatedAndOfferUndo=N,_e.FinishButton=function({rid:e,b:s,name:n,allowed:o=!0,hint:c,small:b,bigToast:f,testID:u,label:h="Finished",a11y:p,kind:D="secondary"}){const[F,j]=t.default.useState(!1);if(!o)return null;const x=(0,l.finishConfirmPrompt)({name:n,table:s.table,seatedAt:s.seatedAt,now:new Date,seated:'seated'===s.status});if(F)return(0,k.jsx)(I,{prompt:x,onNo:()=>j(!1),onYes:()=>{j(!1),'seated'===s.status?v(e,[s],n,{big:f,table:s.table}):N(e,s,n,{big:f})}});return(0,k.jsx)(y.Button,{small:b,kind:D,label:h,testID:u,accessibilityLabel:p??`${h}: ${n}`,accessibilityHint:c,disabled:!o,onPress:()=>j(!0),style:b?void 0:w})};var t=e(r(d[0])),s=e(r(d[1])),n=r(d[2]),o=r(d[3]),l=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),u=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]);const w={minHeight:64};function I({prompt:e,onYes:t,onNo:n,yesLabel:o="Yes, finish"}){return(0,k.jsxs)(s.default,{testID:"finish-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:o,testID:"finish-confirm-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"finish-confirm-no",onPress:n,style:w})]})}async function D(e,t,s){const c=(0,l.tableForUndo)(t,s);await n.repo.bookings.update(t.id,(0,l.finishUndoPatch)(c)),c&&(0,o.tablesOf)(c).forEach(t=>o.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function F(e){const t=e.bookings[0];if(!t)return;const s=e.bookings.length>1?`${e.bookings.length} parties finished.`:`${e.name} finished.`,n=e.table?`${(0,c.tableWords)(e.table).replace(/^t/,'T')} needs clearing.`:void 0,o=`finish-undo-${t.id}`;(0,u.notify)({id:o,title:s,body:n,timeoutMs:l.FINISH_UNDO_MS,big:e.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{for(const t of e.bookings)await D(e.rid,{...t,table:void 0,lastTable:t.table||t.lastTable});(0,u.dismissNotice)(o)})()}}]})}async function v(e,t,s,n){const o=n?.table??t.find(e=>e.table)?.table;for(const s of t)await(0,p.finishBookingNow)(e,s);F({rid:e,bookings:t,name:s,table:o,big:n?.big})}async function N(e,t,s,o){await n.repo.bookings.setStatus(t.id,'finished');const c=`finish-undo-${t.id}`;(0,u.notify)({id:c,title:`${s} finished.`,timeoutMs:l.FINISH_UNDO_MS,big:o?.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{await n.repo.bookings.setStatus(t.id,t.walkIn?'cancelled':'confirmed'),(0,u.dismissNotice)(c)})()}}]})}},1113,[17,85,858,996,1111,1114,1094,1090,916,804,777,1096,8]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return s.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return c}}),e.freeTablesNow=function(t,a,s=!1){const l=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),n=l.filter(([,t])=>t.table.maxSeats>=a),o=t=>t.map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}));return s?[...o(n),...o(l.filter(([,t])=>t.table.maxSeatsh[t]&&(l.includes(h[t].status)||'dirty'===h[t].status||'blocked'===h[t].status));if(p.length&&p.every(t=>h[t])&&!t.length)f.push({id:'seat',label:`Seat at ${b(s.table).replace(/^t/,'T')}`,a11y:`Seat ${n}, ${u(s.partySize)}, at ${b(s.table)}`,table:s.table});else if(c(s,$)){const a=p.length?t.length?`${b(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===h[t[0]].status?'waiting to be cleared':'blocked'===h[t[0]].status?'blocked':'in use'}`:`${b(s.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';f.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${n}, ${u(s.partySize)}. ${a}.`,note:a})}c(s,$)&&f.push({id:'finished',label:'Finished',a11y:`Finished, ${n}, ${s.time} booking, without seating at a table`}),o($,s)<=0&&f.push({id:'noshow',label:'No-show',a11y:`No-show, ${n}, ${s.time} booking`})}return f.push({id:'details',label:'Guest details',a11y:`Guest details, ${n}`}),f};var t=r(d[0]),a=r(d[1]),s=r(d[2]);const l=['seated','mains','dessert','bill'],n=t=>new Date(`${t.date}T${t.time}:00`),o=(t,a)=>(n(a).getTime()-t.getTime())/6e4,b=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},u=t=>`${t} ${1===t?'person':'people'}`,c=(t,a)=>o(a,t)<=45},1114,[996,863,1074]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return x}}),_e.cancelWalkInWords=I,_e.reinstateWalkInWords=$,_e.cancelWalkInNow=j,_e.reinstateWalkInNow=C,_e.CancelWalkInButton=function({rid:e,b:t,onDone:o,small:c,big:u}){const[b,f]=(0,n.useState)(!1),k=(0,l.useInStaffApp)(),x=(0,s.useSeatClearFinish)();return p(t)?k&&!x.ok?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(w.Button,{kind:"secondary",small:c,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>f(!0),style:u?{minHeight:64}:c?{minHeight:44}:h}),b?(0,y.jsx)(W,{rid:e,b:t,onClose:()=>f(!1),onDone:o}):null]}):null},_e.CancelWalkInConfirm=W,_e.ReinstateWalkInButton=function({rid:e,b:t,today:o,onDone:u,small:b}){const[f,p]=(0,n.useState)(!1),I=(0,l.useInStaffApp)(),j=(0,s.useSeatClearFinish)();if(!x(t,o))return null;if(I&&!j.ok)return null;const W=$(t);if(!f)return(0,y.jsx)(w.Button,{kind:"ghost",small:b,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>p(!0),style:b?{minHeight:44}:h});return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:()=>p(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:W,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:W})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[h,{flexGrow:1}],onPress:async()=>{await C(e,t),p(!1),u?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>p(!1),style:h})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]),o=r(d[4]),c=(e=o)&&e.__esModule?e:{default:e},u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]),w=r(d[9]),y=r(d[10]);const h={minHeight:56},p=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),x=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function I(e){const t=(0,b.tablesOf)(e.table),n=(0,f.tablesWords)(t);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${t.length?` at ${n}`:''}, arrived ${e.time}? It comes off the Covers${t.length?` and ${n} ${t.length>1?'go':'goes'} back to Free`:''}.`}function $(e){return`Put walk-in ${e.ref} back to seated? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`}async function j(e,n){await u.repo.bookings.setStatus(n.id,'cancelled'),await u.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,b.tablesOf)(n.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function C(e,t){await u.repo.bookings.setStatus(t.id,'seated'),(0,b.tablesOf)(t.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function W({rid:e,b:t,onClose:n,onDone:l}){const s=I(t);return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:s,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:s})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[h,{flexGrow:1}],onPress:async()=>{await j(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,b.tablesOf)(t.table).length?` ${(0,f.tablesWords)((0,b.tablesOf)(t.table))} free.`:''}`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:h})]})]})}},1115,[1116,17,1055,1118,85,858,996,1094,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.cancelStamp=C,_e.cancelBookingNow=w,_e.reinstateBookingNow=$,_e.CancelBookingButton=function({rid:e,b:n,name:o,onDone:s,big:l,small:c}){const[u,f]=(0,t.useState)(!1);return(0,b.canCancelBooking)(n)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(x.Button,{kind:"secondary",small:c,label:"Cancel booking",testID:`cancel-booking-${n.id}`,accessibilityLabel:`Cancel booking for ${o}, ${n.time}, ${n.partySize} Covers`,onPress:()=>f(!0),style:l?{minHeight:64}:c?{minHeight:44}:j}),u?(0,h.jsx)(D,{rid:e,b:n,name:o,onClose:()=>f(!1),onDone:s}):null]}):null},_e.CancelBookingConfirm=D,_e.ReinstateBookingButton=function({b:e,name:n,today:s,onDone:l}){const[c,u]=(0,t.useState)(!1);if(!(0,b.canReinstateBooking)(e,s))return null;const y=(0,b.reinstateBookingWords)(e,n);if(!c)return(0,h.jsx)(x.Button,{kind:"ghost",label:"Undo cancel",testID:`reinstate-booking-${e.id}`,accessibilityLabel:`Undo cancel for ${n}`,onPress:()=>u(!0),style:j});return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:()=>u(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center'},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, put back to booked",testID:"reinstate-booking-yes",accessibilityLabel:`Yes, put ${n} back to booked`,style:[j,{flexGrow:1}],onPress:async()=>{await $(e),u(!1),l?.(`${n} put back to booked.`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-booking-no",onPress:()=>u(!1),style:j})]})]})};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]),c=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]),y=r(d[8]),k=r(d[9]),p=r(d[10]),x=r(d[11]),h=r(d[12]);const j={minHeight:56},B={display:'Display',owner:'Managers app',staff:'Staff app',chef:'Kitchen app',customer:'Customer page'};function C(e){const t=y.useSession.getState().meId,n=t?k.useOwner.getState().staff.find(e=>e.id===t):void 0,o=B[p.APP_VARIANT]??'CoverCharge';return{by:n?`${n.name.replace(' (example)','')} (${o})`:o,at:(new Date).toISOString(),app:o,...e.table?{table:e.table}:{}}}async function w(e,t){const n=(0,l.tablesOf)(t.table);await s.repo.bookings.update(t.id,{status:'cancelled',cancelled:C(t),...(0,c.tablePatch)(null)}),n.forEach(t=>l.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function $(e){await s.repo.bookings.setStatus(e.id,'confirmed')}function D({rid:e,b:t,name:n,onClose:s,onDone:c}){const y=(0,b.cancelBookingWords)(t,n),k=(0,l.tablesOf)(t.table);return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:s,title:"Cancel booking?",maxWidth:560,testID:"cancel-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center',gap:8},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, cancel booking",testID:"cancel-booking-yes",accessibilityLabel:`Yes, cancel booking for ${n}`,style:[j,{flexGrow:1}],onPress:async()=>{await w(e,t),s(),c?.(`${n} cancelled.${k.length?` ${(0,u.tablesWords)(k)} free.`:''}`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep booking",testID:"cancel-booking-no",accessibilityLabel:`Keep booking for ${n}`,onPress:s,style:j})]})]})}},1116,[17,85,858,996,1090,1117,1094,804,920,876,856,777,8]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canCancelBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canReinstateBooking",{enumerable:!0,get:function(){return t}}),e.cancelBookingWords=function(n,t){const o=`${n.partySize} Cover${1===n.partySize?'':'s'}`;return`Cancel booking for ${t}, ${n.time}, ${o}? The table is freed. Website bookings will cancel it on the website and may email the guest.`},e.reinstateBookingWords=function(n,t){return`Put ${t} back to booked for ${n.time}? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`},e.cancelledOnDay=o,e.cancelledDayTally=function(n,t){const a=o(n,t),l=a.filter(n=>!!n.walkIn),c=a.filter(n=>!n.walkIn);return{count:a.length,covers:a.reduce((n,t)=>n+t.partySize,0),bookings:c.length,bookingCovers:c.reduce((n,t)=>n+t.partySize,0),walkIns:l.length,walkInCovers:l.reduce((n,t)=>n+t.partySize,0),list:a}},e.cancelledTallyWords=function(n,t="today"){if(!n.count)return`No cancellations ${t}`;const o=[],a=n.bookings??0,l=n.walkIns??0;a&&o.push(`${a} booking${1===a?'':'s'} (${n.bookingCovers??0} Cover${1===(n.bookingCovers??0)?'':'s'})`);l&&o.push(`${l} walk-in${1===l?'':'s'} (${n.walkInCovers??0} Cover${1===(n.walkInCovers??0)?'':'s'})`);if(!o.length)return`Cancelled ${t}: ${n.count} \xb7 ${n.covers} Cover${1===n.covers?'':'s'}`;return`Cancelled ${t}: ${o.join(' \xb7 ')}`};const n=n=>!n.walkIn&&('confirmed'===n.status||'pending'===n.status||'seated'===n.status),t=(n,t)=>!n.walkIn&&'cancelled'===n.status&&n.date>=t;function o(n,t){return n.filter(n=>n.date===t&&'cancelled'===n.status).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name))}},1117,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSeatClearFinish=function(){const t=(0,A.useSignedIn)(),o=(0,A.useInStaffApp)(),_='staff'===s.APP_VARIANT||'chef'===s.APP_VARIANT||o,l=(0,c.canSeatClearFinish)({device:s.IS_CAR||'display'===s.APP_VARIANT||!_&&!t,viaDisplay:(0,n.isKitchenViaDisplay)(),role:t?.role,ownerAccess:t?.ownerAccess,managerAccess:t?.managerAccess});return{ok:l,hint:l?void 0:c.SEAT_CLEAR_HINT}};var s=r(d[0]),n=r(d[1]),c=r(d[2]),A=r(d[3])},1118,[856,922,1119,1055]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEAT_CLEAR_HINT",{enumerable:!0,get:function(){return n}}),e.canSeatClearFinish=function(n){return!(!n.device&&!n.viaDisplay)||('owner'===n.role||'manager'===n.role||!(!n.ownerAccess&&!n.managerAccess))};const n='Ask a manager to seat, finish or clear a table.'},1119,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:s,who:i,role:n,inStaffApp:l,shiftManager:a,big:o,testID:d}){const[h,u]=(0,t.useState)(!1),p=(0,b.useSession)(e=>e.meId),y=(0,m.useOwner)(e=>e.staff.find(e=>e.id===p&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:l,role:n,shiftManager:a})||p&&!(0,x.canChangeBookings)(y)?null:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:d??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),h?(0,N.jsx)(V,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:n,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,l.useBookings)(e).filter(e=>!e.walkIn&&e.date>=s&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,200);return o?(0,N.jsx)(V,{rid:e,id:o,who:i,hidePrivate:a,onClose:n}):(0,N.jsxs)(z.Sheet,{visible:!0,onClose:n,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,N.jsx)(z.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${L(e.date,s)} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${L(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,N.jsx)(z.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,N.jsx)(z.Button,{kind:"ghost",label:"Close",onPress:n,style:{minHeight:44}})]})},_e.EditBookingSheet=V;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=(e=i)&&e.__esModule?e:{default:e},l=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),f=_r(_d[19]),C=_r(_d[20]),I=_r(_d[21]),k=_r(_d[22]),w=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),O=_r(_d[28]),W=_r(_d[29]),z=_r(_d[30]),B=_r(_d[31]),N=_r(_d[32]);const E=/^([01]\d|2[0-3]):[0-5]\d$/,R=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const L=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,D.ymd)(s)?'Tomorrow':F(e)};const A=e=>e?(e/100).toFixed(e%100?2:0):'',M=e=>{const t=(0,B.parseMoneyInput)(e);return null!=t&&t>=0?Math.round(100*t):NaN},F=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',H=e=>{const t=e.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);return t?`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`:''},_=e=>e.charAt(0).toUpperCase()+e.slice(1);function Y({title:e,children:t,testID:s}){return(0,N.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,N.jsx)(z.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const G=({label:e,value:t,onChange:s,max:i=20,testID:n})=>(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:e}),(0,N.jsx)(z.Stepper,{testID:n,value:t,min:0,max:i,onChange:s,label:e})]});function V({rid:e,id:i,who:b,onClose:m,hidePrivate:x=!1}){(0,$.useBlurOutside)();const B=(0,l.useBookings)(e),L=B.find(e=>e.id===i),V=(0,d.useRestaurant)(e),K=(0,a.usePlan)(e),U=(0,o.useBlocks)(e=>e.blocks),[q,X]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Q,J]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Z,ee]=(0,t.useState)(!1),[te,se]=(0,t.useState)(null),[ie,ne]=(0,t.useState)(null),[le,ae]=(0,t.useState)(!1),[oe,de]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositDue:0)),[re,ce]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositAmount:0)),[he,ue]=(0,t.useState)(F(L?(0,c.draftOf)(L).depositDate:''));if(!L||!q||!V)return null;const pe=e=>{se(null),ne(null),X({...q,...e})},ge=(0,O.depositOf)(V.settings),be=e=>{const t=e.partySize??q.partySize,s=Math.min(e.children??q.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(L)&&q.depositOn&&!q.depositPaid&&M(oe||'0')===(0,O.depositDue)(ge,q.partySize,q.children??0)){const e=(0,O.depositDue)(ge,t,s);e>0&&de(A(e))}pe({...e,children:s})},me=(0,v.bookingSlotMinutesOf)(V),xe=R(q.time),ye=E.test(xe),je=q.area?K.areas.filter(e=>e.name===q.area).map(e=>e.id):null,De=e=>!je||e.split('+').every(e=>je.includes(K.tables.find(t=>t.name===e)?.areaId??'')),ve=(0,y.tableOptions)(K,B.filter(e=>e.date===q.date),q.table).filter(e=>De(e)||e===q.table),fe=!(q.depositOn&&(Number.isNaN(M(oe||'0'))||q.depositPaid&&(Number.isNaN(M(re||'0'))||he.trim()&&!H(he)))),Ce={...q,time:xe,depositDue:M(oe||'0')||0,depositAmount:M(re||'0')||0,depositDate:H(he)},Ie=(0,c.changedDraftFields)(Q??(0,c.draftOf)(L),Ce),ke=V.settings.turnMins??90,we=!!q?.email?.trim()&&q.email.trim()!==(L?.email??'').trim(),Te=(0,u.bookingRulesOf)(V),Se=async()=>{const t=(0,c.editPatch)(L,Ce,{by:b||'Team member',app:r.APP_VARIANT});if(le&&we&&Object.assign(t,(0,u.marketingChoice)(Ce.email,!0)),Object.keys(t).length&&await l.repo.bookings.update(L.id,t),'seated'===L.status&&'table'in t&&t.table!==L.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(L.table),n=s(t.table),l=a.useFloor.getState(),o=i.map(t=>l.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!n.includes(e)).forEach(t=>l.setLive(e,t,{stage:void 0,dirty:!0})),n.forEach(t=>l.setLive(e,t,{stage:o,dirty:!1}))}ne(`Saved. Changed: ${(0,c.editedWords)(Ie)}.`),se(null),m()},$e=()=>{const t=ye?(0,o.blockAt)(U,e,q.date,xe):void 0,s=(0,c.editWarnings)(L,Ce,B,t,ke,K);!s.length||te?Se():se(s)},Pe=q.allergies??[],Oe=e=>pe({allergyNone:!1,allergies:Pe.some(t=>t.allergen===e)?Pe.filter(t=>t.allergen!==e):[...Pe,{allergen:e,severity:'allergy'}]}),We=(0,c.historyLines)(L);return(0,N.jsxs)(z.Sheet,{visible:!0,onClose:()=>{Ie.length?ee(!0):(ee(!1),m())},title:`Edit booking \xb7 ${L.name} \xb7 ${L.ref}`,maxWidth:760,testID:"edit-booking-sheet",onTypingDone:()=>{(0,C.hideKeyboard)(),Ie.length&&ye&&fe&&q.name.trim().length>=1&&$e()},typingDoneLabel:Ie.length?'Done, save changes':'Done, hide the keyboard',footer:(0,N.jsx)(z.Button,{label:te?'Save anyway':'Save changes',testID:"edit-save",disabled:!ye||!fe||q.name.trim().length<1||!Ie.length,onPress:$e,style:{minHeight:56,width:'100%'}}),children:[(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(w.DepositChip,{b:L,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(L)?(0,N.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,N.jsxs)(Y,{title:"Deposit",testID:"edit-section-deposit",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No deposit",selected:!q.depositOn,testID:"edit-deposit-none",onPress:()=>pe({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit due",selected:!!q.depositOn&&!q.depositPaid&&!q.depositWaived,testID:"edit-deposit-due",onPress:()=>pe({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit paid",selected:!!q.depositOn&&!!q.depositPaid,testID:"edit-deposit-paid",onPress:()=>{re||ce(oe),he||ue(F((0,D.ymd)(new Date))),pe({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsx)(z.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsxs)(z.T,{size:15,center:!0,colour:j.colours.goldLight,testID:"edit-deposit-waived-by",children:[L.depositWaived?.by?(0,O.waiverText)(L.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,q.depositWaived||Ie.includes('deposit')?null:(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(P.WaiveDepositButton,{b:L,who:b,onDone:e=>{const t={...q,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e};X(t),J(s=>s?{...s,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e}:t)}})}),q.depositOn?(0,N.jsx)(z.Field,{money:!0,label:"Deposit due (\xa3)",value:oe,onChangeText:e=>{de(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,q.depositOn&&q.depositPaid?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Field,{money:!0,label:"Amount paid (\xa3)",value:re,onChangeText:e=>{ce(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"How was it paid?"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,N.jsx)(z.Chip,{label:_(e),selected:q.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>pe({depositMethod:e})},e))}),(0,N.jsx)(z.Field,{label:"Date paid (DD/MM/YYYY)",value:he,onChangeText:e=>{ue((0,s.slashDate)(e,he)),pe({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),he.trim()&&!H(he)?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,fe?null:(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,N.jsx)(z.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,N.jsxs)(Y,{title:"When",testID:"edit-section-when",children:[(0,N.jsx)(k.BookingDatePicker,{r:V,today:new Date,value:q.date,onChange:e=>pe({date:e})}),(0,N.jsx)(I.TimeRoller,{testID:"edit-time",value:(0,f.snapTime)(q.time,me),onChange:e=>pe({time:e}),step:me}),ye?null:(0,N.jsx)(z.T,{size:15,colour:j.colours.amber,center:!0,children:"Choose a time on the roller."}),(0,N.jsx)(T.AdultsChildren,{value:(0,S.peopleOf)(q.partySize,q.children),onChange:e=>be(e),depositsOn:ge.on&&ge.perPersonPence>0,testID:"edit-people"}),(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:"Table time"}),(0,N.jsx)(z.Stepper,{testID:"edit-duration",value:q.duration||0,min:0,max:360,step:15,onChange:e=>pe({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,N.jsxs)(Y,{title:"Where",testID:"edit-section-where",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"Any area",selected:!q.area,testID:"edit-area-any",onPress:()=>pe({area:''})}),K.areas.map(e=>(0,N.jsx)(z.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:q.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>pe({area:e.name})},e.id))]}),(0,N.jsx)(z.T,{size:18,weight:"semibold",center:!0,children:(0,y.tableButtonLabel)(q.table)}),(0,y.splitChoices)(q.table).length?(0,N.jsxs)(n.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:"Split the joined tables"}),(0,N.jsx)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,y.splitChoices)(q.table).map(e=>(0,N.jsx)(z.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>pe({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:q.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(q.table?'':', chosen'),onPress:()=>pe({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),ve.map(e=>(0,N.jsx)(z.Button,{kind:e===q.table?'primary':'secondary',label:(0,y.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,y.tableButtonLabel)(e)}${e===q.table?', chosen':''}`,onPress:()=>pe({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,N.jsxs)(Y,{title:"Guest",testID:"edit-section-guest",children:[(0,N.jsx)(z.Field,{label:"Name",value:q.name,onChangeText:e=>pe({name:e}),testID:"edit-name"}),(0,N.jsx)(z.Field,{label:"Phone",value:q.phone,onChangeText:e=>pe({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,N.jsx)(z.Field,{label:"Email",value:q.email,onChangeText:e=>pe({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),we&&Te.marketingOptIn?(0,N.jsx)(z.Toggle,{label:Te.marketingWords,value:le,onChange:ae,testID:"edit-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,N.jsx)(z.T,{size:16,center:!0,children:"Booked by"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>pe({source:e.id})},e.id))}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(q.tags??[]).includes(e);return(0,N.jsx)(z.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>pe({tags:t?(q.tags??[]).filter(t=>t!==e):[...q.tags??[],e].sort()})},e)})})]}),(0,N.jsxs)(Y,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,N.jsx)(G,{label:"Dogs",value:q.dogs??0,max:6,onChange:e=>pe({dogs:e}),testID:"edit-dogs"}),(0,N.jsx)(G,{label:"High chairs",value:q.highChairs??0,max:10,onChange:e=>pe({highChairs:e}),testID:"edit-high-chairs"}),(0,N.jsx)(G,{label:"Wheelchair users",value:q.wheelchair??0,max:10,onChange:e=>pe({wheelchair:e}),testID:"edit-wheelchair"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"Occasion"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:(q.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>pe({occasion:e.id})},e.id||'none'))})]}),(0,N.jsxs)(Y,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No allergies",selected:!!q.allergyNone&&!Pe.length,testID:"edit-allergy-none",onPress:()=>pe({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,N.jsx)(z.Chip,{label:e.short,selected:Pe.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>Oe(e.id)},e.id))]}),Pe.map(e=>(0,N.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,N.jsxs)(z.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,N.jsx)(z.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>pe({allergies:Pe.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,N.jsx)(z.Field,{label:"Anything else about allergies",value:q.allergyNote,onChangeText:e=>pe({allergyNote:e}),testID:"edit-allergy-note"}),Ie.includes('allergies')&&Pe.length?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,N.jsx)(G,{label:"Vegan",value:q.vegan??0,max:q.partySize,onChange:e=>pe({vegan:e}),testID:"edit-vegan"}),(0,N.jsx)(G,{label:"Vegetarian",value:q.vegetarian??0,max:q.partySize,onChange:e=>pe({vegetarian:e}),testID:"edit-vegetarian"})]}),(q.holds??[]).length||(L.holds??[]).some(e=>e.qty>0&&!e.served)?(0,N.jsxs)(Y,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,N.jsx)(z.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(q.holds??[]).map(e=>{const t=(0,h.reservablesOf)(V),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),l=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,N.jsxs)(n.default,{testID:l,style:{gap:6,width:'100%'},children:[(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,N.jsx)(z.Stepper,{testID:l,value:e.qty,min:0,max:20,onChange:t=>pe({holds:(0,c.setEditableHoldQty)(q.holds??[],e.kind,e.id,t)}),label:i})]}),(0,N.jsx)(z.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${l}-remove`,onPress:()=>pe({holds:(0,c.removeEditableHold)(q.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(q.holds??[]).length?null:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==L.status?(0,N.jsxs)(Y,{title:"Status",testID:"edit-section-status",children:[(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>pe({status:e.id})},e.id))}),(0,N.jsx)(z.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,N.jsx)(Y,{title:"Notes",testID:"edit-section-notes",children:(0,N.jsx)(z.Field,{label:"Notes",value:q.notes,onChangeText:e=>pe({notes:e}),placeholder:Te.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),te?(0,N.jsxs)(n.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[te.map(e=>(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,ie?(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:ie}):null,Z?(0,N.jsxs)(n.default,{testID:"edit-discard-warn",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:j.colours.gold,backgroundColor:j.colours.surface2},children:[(0,N.jsx)(z.T,{size:20,weight:"bold",center:!0,children:"Discard unsaved changes?"}),(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.muted,children:"Your changes have not been saved."}),(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:"secondary",label:"Keep editing",testID:"edit-discard-keep",onPress:()=>ee(!1),style:{minHeight:52,flex:1}}),(0,N.jsx)(z.Button,{kind:"danger",label:"Discard changes",testID:"edit-discard-discard",onPress:()=>{ee(!1),m()},style:{minHeight:52,flex:1}})]})]}):null,We.length?(0,N.jsx)(Y,{title:"Changes",testID:"edit-history",children:We.slice(0,12).map((e,t)=>(0,N.jsx)(z.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,N.jsx)(W.CancelBookingButton,{rid:e,b:L,name:L.name,big:!0,onDone:()=>m()}),(0,N.jsx)(W.ReinstateBookingButton,{b:L,name:L.name,today:(0,D.ymd)(new Date),onDone:()=>m()})]})}},1120,[17,1031,85,858,996,993,860,856,1112,1053,1077,845,920,876,994,1090,804,863,1103,1121,815,1122,1104,1087,1099,1100,1101,1123,841,1116,777,840,8]); __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.hmToMins=n,e.minsToHm=o,e.snapTime=u,e.hourValues=function(){return Array.from({length:24},(t,n)=>n)},e.minuteValues=function(t){const n=t>0&&t<=60&&60%t==0?t:15,o=[];for(let t=0;t<60;t+=n)o.push(t);return o},e.splitHm=function(o){const i=n(t.test(o)?o:u(o,15));return Number.isFinite(i)?{hour:Math.floor(i/60),minute:i%60}:{hour:12,minute:0}},e.joinHm=function(t,n){const o=(n%60+60)%60;return`${String((t%24+24)%24).padStart(2,'0')}:${String(o).padStart(2,'0')}`},e.timeRollerHint=function(t){return`24-hour. Times are every ${t>0?t:15} minutes. Roll or swipe each wheel. No typing.`};const t=/^([01]\d|2[0-3]):[0-5]\d$/;function n(t){const n=t.trim().match(/^(\d{1,2}):(\d{2})$/);if(!n)return NaN;const o=Number(n[1]),u=Number(n[2]);return o>23||u>59?NaN:60*o+u}function o(t){const n=(Math.round(t)%1440+1440)%1440,o=Math.floor(n/60),u=n%60;return`${String(o).padStart(2,'0')}:${String(u).padStart(2,'0')}`}function u(t,u){const i=u>0&&u<=60&&60%u==0?u:15,s=n(t),c=Number.isFinite(s)?s:720;return o(Math.round(c/i)*i)}},1121,[]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TimeRoller=function({value:e,onChange:t,step:n=15,testID:u="time-roller"}){const{hour:h,minute:m}=(0,s.splitHm)(e),f=(0,s.hourValues)(),x=(0,s.minuteValues)(n),p=f.indexOf(h),y=x.reduce((e,t)=>Math.abs(t-m)t((0,s.joinHm)(f[e],y)),label:"Hours",format:e=>String(e).padStart(2,'0'),testID:`${u}-hours`}),(0,c.jsx)(b,{values:x,index:j<0?0:j,onChange:e=>t((0,s.joinHm)(h,x[e])),label:"Minutes",format:e=>String(e).padStart(2,'0'),testID:`${u}-minutes`})]})]}),(0,c.jsx)(l.T,{size:13,center:!0,colour:o.colours.muted,children:(0,s.timeRollerHint)(n)})]})};var t=r(_d[0]),n=e(r(_d[1])),i=e(r(_d[2])),o=r(_d[3]),s=r(_d[4]),l=r(_d[5]),c=r(_d[6]);const d=48,u=5,h=2;function m(e,t){return(e%t+t)%t}function b({values:e,index:s,onChange:b,label:f,format:x,testID:p}){const y=(0,t.useRef)(null),j=(0,t.useRef)(0),v=e.length,w=e[m(s,v)],R=`${x(w)} ${f.toLowerCase()}`,S=e=>b(m(s+e,v)),T=()=>{y.current=null,j.current=0};return(0,c.jsx)(i.default,{testID:p,accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:f,accessibilityValue:{min:e[0],max:e[v-1],now:w,text:R},accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{'increment'===e.nativeEvent.actionName&&S(1),'decrement'===e.nativeEvent.actionName&&S(-1)},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{y.current=e.nativeEvent.pageY,j.current=0},onResponderMove:e=>{if(null==y.current)return;const t=e.nativeEvent.pageY-y.current;for(y.current=e.nativeEvent.pageY,j.current+=t;j.current<=-24;)S(1),j.current+=d;for(;j.current>=24;)S(-1),j.current-=d},onResponderRelease:T,onResponderTerminate:T,style:{width:120,height:240,alignItems:'center'},children:Array.from({length:u},(t,i)=>{const u=i-h,b=e[m(s+u,v)],f=0===u,p=2===Math.abs(u);return(0,c.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",onPress:()=>{u&&S(u)},style:{height:d,width:'100%',alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:f?28:p?18:22,weight:f?'bold':'medium',colour:f?o.colours.goldLight:o.colours.muted,center:!0,style:{opacity:f?1:p?.35:.7},children:x(b)})},`${i}-${b}`)})})}},1122,[17,385,85,804,1121,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1123,[17,85,858,856,1120,841,1095,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1123,[17,85,858,856,1112,841,1095,804,777,8]); __d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingHistory=function({rid:e,today:t}){const[b,k]=(0,s.useState)((0,n.addDaysIso)(t,-1)),[w,v]=(0,s.useState)('day'),[p,f]=(0,s.useState)((0,n.ddmmyyyy)((0,n.addDaysIso)(t,-1))),[D,$]=(0,s.useState)(!1),[_,I]=(0,s.useState)(0),T=(0,n.historyRange)(w,b,t),C=(0,c.useKitchenHistory)(e,T.from,T.to,t,_),P=(0,d.parseHistoryInput)(p),B=!!P&&(0,d.validPastDate)(P,t),L=e=>{(0,d.validPastDate)(e,t)&&(k(e),f((0,n.ddmmyyyy)(e)))};if(!C.allowed)return(0,h.jsx)(l.Card,{children:(0,h.jsx)(l.T,{size:20,center:!0,children:"Booking history is for the Head Chef and managers. Sign in to the Head Chef app to see it."})});const z='day'===w?1:7,S=(0,n.addDaysIso)('day'===w?b:(0,n.mondayOf)(b),-z),R='day'===w?(0,n.addDaysIso)(b,1):(0,n.addDaysIso)((0,n.mondayOf)(b),7),W='day'===w?'day':'week';return(0,h.jsxs)(o.default,{style:{gap:14},testID:"booking-history",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:12,alignItems:'stretch'},children:[(0,h.jsx)(l.T,{size:18,center:!0,children:"Bookings, covers and walk-ins on past days. Read-only; nothing is changed."}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:'day'===w?'primary':'secondary',testID:"bh-mode-day",label:"One day",accessibilityLabel:"Show one day"+('day'===w?', selected':''),onPress:()=>v('day')}),(0,h.jsx)(l.Button,{kind:'week'===w?'primary':'secondary',testID:"bh-mode-week",label:"Whole week",accessibilityLabel:"Show the whole week, Monday to Sunday"+('week'===w?', selected':''),onPress:()=>v('week')})]}),(0,h.jsx)(l.Field,{label:"Past date (DD/MM/YYYY)",value:p,onChangeText:e=>f((0,i.slashDate)(e,p)),placeholder:"09/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Past date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"bh-date",style:{textAlign:'center'}}),B?null:(0,h.jsx)(l.T,{size:16,center:!0,testID:"bh-date-hint",children:"Enter a past date as DD/MM/YYYY, for example 09/11/2026."}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:"secondary",label:"Pick a date",testID:"bh-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${u(b)}`,onPress:()=>$(!0)}),(0,h.jsx)(l.Button,{label:"Show",testID:"bh-show",accessibilityLabel:`Show booking history for ${B&&P?u(P):'a valid past date'}`,disabled:!B,onPress:()=>{P&&L(P),I(_+1)}})]}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:"secondary",testID:"bh-prev",label:`Previous ${W}`,accessibilityLabel:`Previous ${W}, ${u(S)}`,onPress:()=>L(S)}),(0,h.jsx)(l.Button,{kind:"secondary",testID:"bh-next",label:`Next ${W}`,accessibilityLabel:(0,d.validPastDate)(R,t)?`Next ${W}, ${u(R)}`:`Next ${W}, not available. Booking history is for past days only`,disabled:!(0,d.validPastDate)(R,t),onPress:()=>L(R)})]}),'day'===w?(0,h.jsx)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:(0,h.jsx)(l.Button,{small:!0,kind:"secondary",testID:"bh-prev-week",label:"Same day last week",accessibilityLabel:`Same day last week, ${u((0,n.addDaysIso)(b,-7))}`,onPress:()=>L((0,n.addDaysIso)(b,-7))})}):null]})}),(0,h.jsx)(y.LookBackCalendar,{visible:D,today:t,selected:b,purpose:"Booking history",idPrefix:"bh",onClose:()=>$(!1),onPick:e=>{L(e),$(!1)}}),C.data?'day'===w?C.data.days[0]?(0,h.jsx)(x,{d:C.data.days[0]}):null:(0,h.jsx)(j,{days:C.data.days,onDay:e=>{L(e),v('day')}}):(0,h.jsx)(l.Card,{children:(0,h.jsx)(o.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(l.T,{size:20,center:!0,testID:"bh-status",children:C.error||'Loading booking history\u2026'})})})]})};var e,s=r(_d[0]),t=r(_d[1]),o=(e=t)&&e.__esModule?e:{default:e},l=r(_d[2]),i=r(_d[3]),d=r(_d[4]),n=r(_d[5]),c=r(_d[6]),y=r(_d[7]),b=r(_d[8]),h=r(_d[9]);const u=e=>`${(0,n.dayName)(e)} ${(0,n.ddmmyyyy)(e)}`,k=({label:e,value:s,id:t})=>(0,h.jsxs)(o.default,{testID:`bh-stat-${t}`,accessible:!0,accessibilityLabel:`${e}: ${s}`,style:{alignItems:'center',minWidth:96,padding:8,borderRadius:12,borderWidth:1,borderColor:b.colours.border},children:[(0,h.jsx)(l.T,{size:28,weight:"bold",colour:b.colours.gold,center:!0,children:String(s)}),(0,h.jsx)(l.T,{size:16,center:!0,children:e})]});function x({d:e}){return(0,h.jsxs)(o.default,{style:{gap:12},testID:"bh-day",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:10,alignItems:'center'},accessible:!0,accessibilityLabel:(0,n.dayText)(e)+`. Done: ${e.done_covers+e.walk_in_covers} covers.`,children:[(0,h.jsx)(l.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:u(e.date)}),(0,h.jsx)(o.default,{testID:"bh-stats",style:{alignSelf:'stretch'},children:(0,h.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(k,{id:"bookings",label:"Bookings",value:e.bookings}),(0,h.jsx)(k,{id:"booked",label:"Booked covers",value:e.booked_covers}),(0,h.jsx)(k,{id:"walkins",label:"Walk-ins",value:e.walk_ins}),(0,h.jsx)(k,{id:"walkin-covers",label:"Walk-in covers",value:e.walk_in_covers}),(0,h.jsx)(k,{id:"done",label:"Done",value:e.done_covers+e.walk_in_covers}),(0,h.jsx)(k,{id:"total",label:"Total",value:e.total_covers})]})}),e.not_counted?(0,h.jsxs)(l.T,{size:16,center:!0,children:[e.not_counted," cancelled or no-show ",1===e.not_counted?'booking is':'bookings are'," listed but not counted."]}):null,e.old_records?(0,h.jsx)(l.T,{size:16,center:!0,colour:b.colours.muted,children:"Includes records from the previous booking system, which may be incomplete."}):null]})}),(e.lines??[]).length||e.walk_ins?null:(0,h.jsx)(l.Card,{children:(0,h.jsx)(l.T,{size:18,center:!0,children:"No bookings or walk-ins recorded for this day."})}),(e.lines??[]).map((e,s)=>(0,h.jsx)(o.default,{testID:"bh-line",accessible:!0,accessibilityLabel:(0,n.lineText)(e),style:{padding:10,borderRadius:12,borderWidth:1,borderColor:b.colours.border,alignItems:'center',opacity:e.counted?1:.7},children:(0,h.jsxs)(l.Row,{wrap:!0,gap:14,style:{justifyContent:'center'},children:[(0,h.jsx)(l.T,{size:20,weight:"bold",colour:b.colours.gold,children:e.time??'No time'}),(0,h.jsx)(l.T,{size:18,children:null==e.covers?'Covers not recorded':`${e.covers} ${1===e.covers?'cover':'covers'}`}),(0,h.jsx)(l.T,{size:18,children:e.table?`Table ${e.table}`:'No table'}),(0,h.jsx)(l.T,{size:18,children:(0,n.statusWord)(e.status)})]})},s))]})}function j({days:e,onDay:s}){const t=(0,n.sumDays)(e);return(0,h.jsxs)(o.default,{style:{gap:12},testID:"bh-week",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:10,alignItems:'center'},accessible:!0,accessibilityLabel:`Week ${(0,n.ddmmyyyy)(e[0].date)} to ${(0,n.ddmmyyyy)(e[e.length-1].date)}: ${t.bookings} bookings, ${t.booked_covers} booked covers, ${t.walk_ins} walk-ins with ${t.walk_in_covers} covers, ${t.total_covers} covers in total`,children:[(0,h.jsxs)(l.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:["Week ",(0,n.ddmmyyyy)(e[0].date)," to ",(0,n.ddmmyyyy)(e[e.length-1].date)]}),(0,h.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(k,{id:"week-bookings",label:"Bookings",value:t.bookings}),(0,h.jsx)(k,{id:"week-walkins",label:"Walk-ins",value:t.walk_ins}),(0,h.jsx)(k,{id:"week-total",label:"Total",value:t.total_covers})]})]})}),e.map(e=>(0,h.jsx)(l.Button,{kind:"secondary",testID:`bh-week-day-${e.date}`,label:`${(0,n.day3)(e.date)} ${(0,n.ddmmyyyy)(e.date)} \xb7 ${e.bookings} booked (${e.booked_covers}) \xb7 ${e.walk_ins} walk-in (${e.walk_in_covers}) \xb7 Total ${e.total_covers}`,accessibilityLabel:`${(0,n.dayText)(e)}. Double tap to see this day's bookings.`,onPress:()=>s(e.date)},e.date))]})}},1124,[17,85,777,1031,1062,1125,1061,1048,804,8]); __d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"addDaysIso",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ddmmyyyy",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"day3",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"dayName",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"mondayOf",{enumerable:!0,get:function(){return l}}),e.historyRange=function(o,t,s){if('day'===o)return{from:t,to:t};const a=l(t),c=n(a,6),d=n(s,-1);return{from:a,to:c({bookings:o.bookings+t.bookings,booked_covers:o.booked_covers+t.booked_covers,walk_ins:o.walk_ins+t.walk_ins,walk_in_covers:o.walk_in_covers+t.walk_in_covers,total_covers:o.total_covers+t.total_covers}),{bookings:0,booked_covers:0,walk_ins:0,walk_in_covers:0,total_covers:0})};const o=o=>o.toISOString().slice(0,10),t=o=>new Date(o+'T12:00:00Z'),n=(n,s)=>{const a=t(n);return a.setUTCDate(a.getUTCDate()+s),o(a)},s=o=>`${o.slice(8,10)}/${o.slice(5,7)}/${o.slice(0,4)}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],c=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=o=>a[t(o).getUTCDay()],u=o=>c[t(o).getUTCDay()],l=o=>n(o,-(t(o).getUTCDay()+6)%7);function b(o){switch((o??'').toLowerCase()){case'finished':case'seated':return'Done';case'confirmed':case'booked':case'amended':return'Booked';case'cancelled':return'Cancelled';case'noshow':return'No-show';default:return o||'Not recorded'}}const y=(o,t,n)=>`${o} ${1===o?t:n}`},1125,[]); __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TempUnitsSetup=function(){const e=(0,f.useSync)(e=>e.mode),s='live'===e||'offline'===e||'connecting'===e,o=(0,c.useSafety)(e=>e.points),b=(0,d.useOwner)(e=>e.site),[k,j]=(0,t.useState)(()=>(0,u.draftsFrom)(c.useSafety.getState().points)),[$,S]=(0,t.useState)(null),[I,w]=(0,t.useState)(!1),[T,D]=(0,t.useState)(''),[C,L]=(0,t.useState)(1),B=(0,t.useMemo)(()=>(0,u.changesOf)(k,o),[k,o]),z=e=>(0,h.chefCanSee)(b,e),A=Object.fromEntries(k.map(e=>[e.key,(0,u.problemOf)(e,k,z)])),P=Object.values(A).some(Boolean),R=e=>{j(t=>t.map(t=>t.key===e.key?e:t)),D(''),w(!1)},_=k.filter(e=>!e.archived),O=k.filter(e=>e.archived&&e.id),F=_.filter(e=>'fridge'===e.kind).length,H=_.length-F,M=e=>{const t=`new${C}`;L(C+1),D(''),w(!1),j(s=>[...s,{key:t,name:'',kind:e,location:'',max:String(u.DEFAULT_MAX[e]),due:'09:00, 16:00',archived:!1}])},W=P?'Fix the unit marked in red first.':B.length?`${B.length} change${1===B.length?'':'s'} not saved yet.`:'No changes yet.';return(0,x.jsxs)(n.default,{testID:"tu-setup",style:{gap:12,alignSelf:'center',width:'100%',maxWidth:560,alignItems:'stretch'},children:[(0,x.jsx)(l.T,{weight:"semibold",size:18,center:!0,accessibilityRole:"header",children:"Temperature units"}),(0,x.jsx)(l.T,{testID:"tu-count",size:15,center:!0,children:`${F} fridge${1===F?'':'s'} and ${H} freezer${1===H?'':'s'} checked`}),(0,x.jsx)(p.TempSaveBanner,{testID:"tu-save-banner"}),(0,x.jsx)(l.Banner,{kind:"info",title:s?'Shared with every device':'Not connected yet',children:s?'These units and their readings are on the shared food safety log, so every phone, tablet and screen at the venue shows the same units.':'These units are saved on this device until it connects. Then they are shared with every device at the venue.'}),_.map(e=>(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsx)(v,{d:e,problem:A[e.key],onChange:R,onArchive:()=>e.id?S(e.key):j(t=>t.filter(t=>t.key!==e.key))}),$===e.key?(0,x.jsxs)(n.default,{testID:"tu-archive-ask",style:{gap:8,padding:12,borderRadius:12,backgroundColor:y.colours.amberBg,alignItems:'center'},children:[(0,x.jsx)(l.T,{size:15,center:!0,children:`Archive ${e.name.trim()||'this unit'}? It will no longer be checked. Its past readings stay in History and the EHO report. Nothing is deleted.`}),(0,x.jsxs)(l.Row,{gap:8,children:[(0,x.jsx)(l.Button,{small:!0,testID:"tu-archive-confirm",label:"Archive",accessibilityLabel:`Yes, archive ${e.name}`,onPress:()=>{R({...e,archived:!0}),S(null)}}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-archive-cancel",label:"Keep it",accessibilityLabel:`No, keep ${e.name}`,onPress:()=>S(null)})]})]}):null]},e.key)),(0,x.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-add-fridge",label:"Add a fridge",onPress:()=>M('fridge')}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-add-freezer",label:"Add a freezer",onPress:()=>M('freezer')})]}),O.length?(0,x.jsxs)(n.default,{testID:"tu-archived",style:{gap:6,alignItems:'center'},children:[(0,x.jsx)(l.T,{weight:"medium",center:!0,children:"Archived (not checked, history kept)"}),O.map(e=>(0,x.jsxs)(l.Row,{gap:8,style:{justifyContent:'center'},children:[(0,x.jsx)(l.T,{size:14,center:!0,children:e.name}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:`tu-restore-${e.key}`,label:"Bring back",accessibilityLabel:`Bring back ${e.name}`,onPress:()=>R({...e,archived:!1,due:e.due||'09:00, 16:00'})})]},e.key))]}):null,I?(0,x.jsxs)(n.default,{testID:"tu-save-ask",style:{gap:8,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold,alignItems:'center'},children:[(0,x.jsx)(l.T,{weight:"medium",center:!0,children:`Save ${B.length} change${1===B.length?'':'s'}?`}),B.map(e=>(0,x.jsx)(l.T,{size:14,center:!0,children:e.text},e.key)),(0,x.jsxs)(l.Row,{gap:8,children:[(0,x.jsx)(l.Button,{small:!0,testID:"tu-save-confirm",label:"Save",accessibilityLabel:"Yes, save the changes",onPress:()=>{const e=c.useSafety.getState(),t=new Set(e.points.map(e=>e.id));for(const t of B)t.add?e.addPoint(t.add):t.id&&t.patch&&e.setPoint(t.id,t.patch);j((0,u.draftsFrom)(c.useSafety.getState().points)),w(!1);const n=[...B.filter(e=>e.id).map(e=>e.id),...c.useSafety.getState().points.filter(e=>!t.has(e.id)).map(e=>e.id)],l=`Saved ${B.length} change${1===B.length?'':'s'}.`;D(s?`${l} Sending to every device\u2026`:`${l} (on this device until it connects).`),s&&(0,p.reportTempSave)('temp_units',n,l,D)}}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-save-cancel",label:"Back",accessibilityLabel:"Go back without saving",onPress:()=>w(!1)})]})]}):null,(0,x.jsx)(l.Button,{testID:"tu-save",label:"Save changes",disabled:!B.length||P,accessibilityHint:W,onPress:()=>w(!0),style:{alignSelf:'center',minWidth:200}}),T?(0,x.jsx)(l.T,{testID:"tu-saved",size:15,colour:y.colours.ok,center:!0,accessibilityRole:"text",children:T}):(0,x.jsx)(l.Muted,{style:{textAlign:'center'},children:W})]})};var e,t=r(_d[0]),s=r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),h=r(_d[6]),u=r(_d[7]),y=r(_d[8]),p=r(_d[9]),f=r(_d[10]),x=r(_d[11]);const b=['Downstairs','Upstairs'],k={fridge:'Fridge',freezer:'Freezer'};function v({d:e,problem:t,onChange:s,onArchive:c}){const d=e.name.trim()||'new unit';return(0,x.jsxs)(n.default,{testID:`tu-unit-${e.key}`,style:{gap:8,padding:12,borderRadius:12,borderWidth:1,borderColor:t?y.colours.red:y.colours.border,alignSelf:'stretch'},children:[(0,x.jsx)(o.TextInput,{testID:`tu-name-${e.key}`,accessibilityLabel:`Name of ${d}`,value:e.name,onChangeText:t=>s({...e,name:t}),placeholder:"e.g. Upstairs fridge 5",placeholderTextColor:"#7D776C",style:[l.styles.input,{alignSelf:'stretch',width:'100%'}]}),(0,x.jsxs)(l.Row,{wrap:!0,gap:6,children:[['fridge','freezer'].map(t=>(0,x.jsx)(l.Chip,{testID:`tu-kind-${e.key}-${t}`,label:k[t],selected:e.kind===t,accessibilityLabel:`${d}: ${k[t]}${e.kind===t?', selected':''}`,onPress:()=>s((0,u.withKind)(e,t))},t)),b.map(t=>(0,x.jsx)(l.Chip,{testID:`tu-loc-${e.key}-${t.toLowerCase()}`,label:t,selected:e.location.trim().toLowerCase()===t.toLowerCase(),accessibilityLabel:`${d}: location ${t}`,onPress:()=>s({...e,location:t})},t))]}),(0,x.jsxs)(l.Row,{wrap:!0,gap:8,children:[(0,x.jsx)(o.TextInput,{testID:`tu-loc-${e.key}`,accessibilityLabel:`Location of ${d}`,value:e.location,onChangeText:t=>s({...e,location:t}),placeholder:"Location",placeholderTextColor:"#7D776C",style:[l.styles.input,{flexGrow:1,flexBasis:120,minWidth:0,width:40}]}),(0,x.jsxs)(l.Row,{gap:6,style:{flexWrap:'nowrap'},children:[(0,x.jsx)(o.TextInput,{testID:`tu-max-${e.key}`,accessibilityLabel:`Safe limit for ${d}, degrees or colder`,value:e.max,onChangeText:t=>s({...e,max:t}),placeholder:String(u.DEFAULT_MAX[e.kind]),placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[l.styles.input,{width:72,textAlign:'center'}]}),(0,x.jsx)(l.T,{size:14,children:"\xb0C or colder"})]})]}),(0,x.jsx)(o.TextInput,{testID:`tu-due-${e.key}`,accessibilityLabel:`Check times for ${d}, 24 hour, comma separated`,value:e.due,onChangeText:t=>s({...e,due:t}),placeholder:"Check times, e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[l.styles.input,{alignSelf:'stretch',width:'100%'}]}),t?(0,x.jsx)(l.T,{testID:`tu-problem-${e.key}`,size:14,colour:y.colours.red,center:!0,accessibilityRole:"text",children:t}):null,(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:`tu-archive-${e.key}`,label:"Archive",accessibilityLabel:`Archive ${d}`,accessibilityHint:"Stops the checks. Its past readings stay in History and the EHO report",onPress:c,style:{alignSelf:'center'}})]})}},1126,[17,85,777,812,1001,876,820,1127,804,1128,899,8]); @@ -1285,7 +1285,7 @@ __d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.AccidentBook=function(n){return null}},1202,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MissedBanner=function(n){return null},e.HaccpLog=function(n){return null}},1203,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SpecialsEditor=function(t){return null}},1204,[]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},1205,[843,1026,17,219,385,85,780,858,804,777,1206,1102,1207,8]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by email",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},1205,[843,1026,17,219,385,85,780,858,804,777,1206,1102,1207,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,"BANNER_MS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return I}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:b}){const g=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!h||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=p,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,I),x=e.length-y.length,R=(0,f.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:h?'fixed':'absolute',left:10,right:n?10:76,top:8+g.top,zIndex:2147483001,gap:8,alignItems:'center',...h?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,f.jsx)(C,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>b(e)},e.id+':'+e.at)),x>0?(0,f.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:u.SLIDER.bg,borderWidth:1,borderColor:u.SLIDER.border},children:(0,f.jsxs)(c.T,{size:13,colour:u.SLIDER.quiet,children:[x," more new ",1===x?'booking':'bookings']})}):null]});if(h)try{const e=r(_d[13],"react-dom");if(e?.createPortal)return e.createPortal(R,document.body)}catch{}return R};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]),f=r(_d[12]);const h='undefined'!=typeof document,p="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",y=e=>h?{dataSet:{ccbn:e}}:{},x=7e3,I=3;function C({a:e,big:a,managers:p,me:I,onOpen:C,onClose:R}){const j='pending'===e.kind,[k,D]=(0,o.useState)(null),L=j&&p&&!k;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(R,k?1800:x);return()=>clearTimeout(e)},[L,k]);const S=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&R()}})).current,E=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',z=[e.when,E,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),v=j?'Booking request':'New booking',w=[e.when,E,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),T=`${v}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${C?' Tap to open bookings.':''}`,$=n=>{e.refId&&!e.test&&g.repo.bookings.decide(e.refId,n,I??'Manager'),D('confirmed'===n?'Confirmed.':'Declined.')};return(0,f.jsxs)(s.default,{...S.panHandlers,...y('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:u.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':u.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:j?d.colours.amber:d.colours.gold,...h?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,f.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:T,disabled:!C,onPress:()=>{R(),C?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,f.jsx)(c.T,{size:a?14:12,weight:"bold",colour:j?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:k??v.toUpperCase()}),(0,f.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:u.SLIDER.text,numberOfLines:1,children:e.name}),z?(0,f.jsx)(c.T,{size:a?18:15,colour:u.SLIDER.quiet,numberOfLines:1,children:z}):null,e.allergy?(0,f.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,f.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,f.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>$('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:u.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(c.T,{size:15,weight:"bold",colour:u.SLIDER.ink,children:"Confirm"})}),(0,f.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>$('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,f.jsx)(b.ToastClose,{testID:"booking-banner-close",label:`Close ${v.toLowerCase()} for ${e.name}`,onPress:R,size:a?'lg':'md',colour:u.SLIDER.quiet,style:{minWidth:56,minHeight:56,marginRight:4}})]})}},1206,[843,17,363,219,385,85,19,804,777,779,1102,858,8,260]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},1207,[1208,1209,1211,1210,1212,1016,1213]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1208,[]); @@ -1399,7 +1399,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1316,[812,843,17,85,777,845,851,1151,1317,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})},1317,[928,899,1151]); __d(function(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]})}},1318,[13,17,856,1319,1391,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 Je}}),_e2.DisplayBoard=function(e={}){const t=(0,ie.useOwner)(e=>e.site);return(0,te.useRestaurant)(t)?(0,qe.jsx)(at,{...e}):(0,qe.jsx)(U.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Y.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]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=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=_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]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]);const Ye='#221C12',Qe='#2E2618',Je=12e4,Xe={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},Ze={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},et={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},tt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),lt=e=>e.slotTime?(0,ee.hm)(new Date(e.slotTime)):'ASAP';function it({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,qe.jsxs)(U.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)(U.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)(U.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)(Y.T,{size:s?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,qe.jsx)(Y.T,{size:s?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,qe.jsx)(F.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)(U.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)(Y.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,qe.jsxs)(U.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,qe.jsx)(U.default,{style:{width:`${l.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,qe.jsx)(U.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,qe.jsxs)(F.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)(U.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,qe.jsx)(Y.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Y.T,{size:12,colour:se.colours.muted,children:s}):null]})}function ot({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ve.statusBlock)(e,t,(0,Ve.linkedBooking)(e,l));return e.length?(0,qe.jsx)(U.default,{style:{gap:8},children:e.map(e=>(0,qe.jsxs)(U.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:s?16:18,weight:"bold",children:[lt(e)," \xb7 ",tt(e.customerName)]}),(0,qe.jsx)(Y.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)(Y.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)(Y.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,Z.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Fe.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Y.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Y.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>te.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Y.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Y.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Ce.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Y.Muted,{children:"No takeaway orders right now."})}function at({embedded:e=!1,boardW:b,headerExtra:Z,subHeader:Fe,noVoice:Ve=!1}={}){const lt=(0,K.default)(),at=b??lt.width,dt=lt.height,ct=at<700,ut=at>=dt,ht=!ct&&ut&&at>=600,gt=ht,bt=Math.round(Math.min(520,Math.max(at>=1e3?448:280,.3*at))),yt=P.default.useRef(null),pt=P.default.useRef(0),[ft,xt]=(0,H.useState)({w:0,h:0}),mt=(0,ie.useOwner)(e=>e.site),jt=(0,te.useRestaurant)(mt);(0,Re.useAlertWatcher)(mt,{enabled:!e});const wt=(0,te.useOrders)(mt),kt=(0,te.useBookings)(mt),It=(0,te.useEvents)(mt),Dt=(0,te.useStore)(e=>e.skipMinutes),vt=(0,te.useStore)(e=>e.clock.mode),St=(0,te.useNow)(5e3),Ct=(0,ie.useOwner)(e=>e.staff),Tt=(0,ie.useOwner)(e=>e.attendance),Rt=(0,ie.useOwner)(e=>e.shifts),$t=(0,ie.useOwner)(e=>e.leave),Bt=P.default.useMemo(()=>(0,Oe.workingShifts)(Rt,$t),[Rt,$t]);P.default.useEffect(()=>{(0,oe.ensureAttendance)((0,ee.ymd)(St),St)},[(0,ee.ymd)(St)]);const Wt=(0,R.useSession)(e=>e.meId),Lt=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:tt(Ct.find(e=>e.id===Wt)?.name)}),zt=I.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Ht=(0,ee.ymd)(St),Pt=(0,A.useTravelDay)('display',Ht),Mt=(0,ne.useFrontDoor)(Ht,ut),At=(0,ae.useDisplaySettings)(mt),Et=At.privacy,Ot=(0,pe.useSaverSync)(),Nt=(0,ae.usePlan)(mt),_t=(0,ae.useFloor)(e=>e.live[mt]),Gt=(0,$e.useBlocks)(e=>e.blocks),[Ft,Vt]=(0,H.useState)('plan'),[Ut,Kt]=(0,H.useState)(!1),[qt,Yt]=(0,H.useState)('all'),[Qt,Jt]=(0,H.useState)(null),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(!1),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(null),[rs,ds]=(0,H.useState)(!1),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(null),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[ks,Is]=(0,H.useState)(!1),Ds=P.default.useRef(0),vs=e=>{Ds.current=Date.now(),ws(e)};P.default.useEffect(()=>{if(!js)return;const e=setInterval(()=>{Date.now()-Ds.current>=ze.DAY_IDLE_MS&&ws(null)},5e3);return()=>clearInterval(e)},[js]);const Ss=(0,te.useWaitlist)(mt),Cs=(0,te.useStore)(e=>e.walkIns[mt]??0),[Ts,Rs]=(0,H.useState)(!1),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1);(0,J.useReviewAlerts)(mt);const[Ps,Ms]=(0,H.useState)({view:0,content:0}),[As,Es]=(0,H.useState)(null);P.default.useEffect(()=>{As&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:As,timeoutMs:4500,big:!0,testID:'floor-toast'}),Es(null))},[As]),P.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Os,Ns]=(0,H.useState)(null),_s=P.default.useRef(0),[Gs,Fs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Os)return;_s.current=Date.now();const e=setInterval(()=>{const e=Date.now()-_s.current;if(e>=Je)return Ns(null),void Es('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Fs(e>=105e3?Math.ceil((Je-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Os]);const Vs=e=>e.date!==Ht?ts({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Ht)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Ht?(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Ht)}, ${e.time}`,disabled:!wi.ok,accessibilityHint:wi.hint,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}):null,(0,ve.bookingDetails)(e)]})}):ts({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(rt,{rid:mt,id:e.id,turnBase:jt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(we.CancelWalkInButton,{rid:mt,b:e,big:!0,onDone:e=>{ts(null),Es(e)}}):null,e.walkIn?(0,qe.jsx)(we.ReinstateWalkInButton,{rid:mt,b:e,today:Ht,onDone:e=>{ts(null),Es(e)}}):null,(0,ve.bookingDetails)(e)]})}),Us=kt.filter(e=>e.date===Ht).sort((e,t)=>e.time.localeCompare(t.time)),Ks=Us.filter(e=>!['cancelled','noshow'].includes(e.status)),qs=wt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,H.useMemo)(()=>(0,c.forecastToday)(jt,kt,wt,It,St),[jt,kt,wt,It,St.getTime()/6e4|0]),Qs=(0,$e.closedAreasAt)(Gt,mt,Ht,(0,ee.hm)(St)),Js=[...Qs].join(','),Xs=(0,H.useMemo)(()=>(0,re.floorView)(Nt,kt,wt,_t??{},St,jt.settings.turnMins,Qs),[Nt,kt,wt,_t,St.getTime(),Js]),Zs=(0,De.hoursFor)(jt,St),el=Zs?.open??new Date(`${Ht}T12:00:00`),tl=Zs?.close??new Date(`${Ht}T21:00:00`),sl=(0,ee.addMins)(el,-el.getMinutes()),ll=(0,ee.addMins)(tl,30),il=e=>new Date(`${Ht}T${e}:00`),nl=(0,$e.blocksOn)(Gt,mt,Ht).map(e=>({from:il(e.from),to:il(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(jt,St,Ht)),ol=Object.keys(Xs).filter(e=>'blocked'===Xs[e]?.status),al=js&&js!==Ht?js:Ht,rl=al!==Ht,dl=(0,ze.dayWord)(al,Ht),cl=/^(Today|Yesterday|Tomorrow)$/.test(dl),ul=rl?(0,ze.bookingsForDay)(kt,al,Ht).sort((e,t)=>e.time.localeCompare(t.time)):Us,hl=(0,ee.parseYmd)(al);hl.setHours(12);const gl=rl?(0,De.hoursFor)(jt,hl):Zs,bl=gl?.open??new Date(`${al}T12:00:00`),yl=gl?.close??new Date(`${al}T21:00:00`),pl=e=>new Date(`${al}T${e}:00`),fl=[...rl?(0,$e.blocksOn)(Gt,mt,al).map(e=>({from:pl(e.from),to:pl(e.to),label:e.reason??'Paused'})):nl,...rl?(0,n.queuedServicePauses)(jt,hl,al):[]],xl=(0,n.queuedServiceSessions)(jt,hl),ml=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),jl=(0,qe.jsxs)(U.default,{testID:"queued-hours-gate",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Y.Muted,{children:i.queuedVenues[mt]?.hours.note})]}),wl=rl?gl||ul.length?alrl?(0,re.dayFloorView)(Nt,ul,al):Xs,[rl,Nt,ul,al,Xs]),[Il,Dl]=(0,H.useState)(null),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(!1),[Rl,$l]=(0,H.useState)(null),Bl=rl?ul.filter(e=>!['cancelled','noshow'].includes(e.status)):Ks,Wl=Bl.reduce((e,t)=>e+t.partySize,0),Ll=(0,u.coversSplit)(Bl,al),zl=(0,Pe.cancelledDayTally)(kt,al),Hl=(0,Me.cancellationsFor)(kt,al,e=>e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)','')),Pl=(0,Pe.cancelledTallyWords)(zl,cl?dl.toLowerCase():rl?`on ${dl}`:'today'),Ml=Gt.filter(e=>e.rid===mt&&e.date===al&&!e.removedAt),Al=60*bl.getHours()+bl.getMinutes(),El=60*yl.getHours()+yl.getMinutes(),Ol=(0,Le.chartBands)(Ml,Al,El),Nl=(0,Le.seasonClosedAreaIds)(Ml,Al,El),_l=Nl.size?{...Nt,areas:Nt.areas.filter(e=>!Nl.has(e.id)),tables:Nt.tables.filter(e=>!Nl.has(e.areaId))}:Nt,Gl=rl?[]:ol.filter(e=>!Nl.has(Nt.tables.find(t=>t.name===e)?.areaId??'')),Fl=new Set((0,Le.blockedHours)(Ol)),Vl=St.getHours()+(St.getMinutes()>=30?1:0),Ul=Ys.hours.filter(e=>e.hour>=Vl&&!Fl.has(e.hour)),Kl=Ul.reduce((e,t)=>e+t.coversHigh,0),ql=Ul.reduce((e,t)=>e+t.coversLow,0),Yl=Math.round((ql+Kl)/2),Ql=!Ys.example&&Ys.open&&Ys.enough&&Kl>0?`Usually ${(0,c.coversRange)(Yl,Yl)} more`:void 0,Jl=async(e,t)=>{const s=Xs[e]?.booking;if(!s||e===t)return;const l=Xs[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 ${re.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,ke.guardBookingChange)(Es,{b:s,tables:[t]}))return;await te.repo.bookings.update(s.id,{table:t});const i=_t?.[e]?.stage;ae.useFloor.getState().setLive(mt,t,{stage:i??'seated',dirty:!1}),ae.useFloor.getState().setLive(mt,e,{stage:void 0,dirty:!0}),Es(`Saving: ${(0,fe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,ke.reportBookingSave)(s.id,`${(0,fe.privName)(s,Et)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}`,Es)},Xl=e=>{if(xs)return Sl(null),void ms(t=>t?{...t,tables:(0,Ie.toggleTable)(t.tables,e)}:t);rl?Dl(e):Xt?(e!==Xt&&Jl(Xt,e),Zt(null)):Jt(e)},Zl=xs?kt.find(e=>e.id===xs.id):void 0,ei=xs&&Zl?(()=>{const e=Zl.walkIn?(0,fe.privName)(Zl,Et):tt(Zl.name),t=(0,Ie.seatsOf)(Nt,xs.tables).total,s=(0,Ie.seatLine)(t,Zl.partySize),l=(0,Ie.pickClashes)(Zl,xs.tables,kt.filter(e=>e.date===Zl.date),jt.settings.turnMins),i=(0,Ie.tableKey)(xs.tables)!==(0,Ie.tableKey)((0,ae.tablesOf)(Zl.table));return(0,qe.jsxs)(U.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,qe.jsxs)(U.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Zl.date,Ht)} ${Zl.time}. Tap tables on the plan to add or take them off. ${(0,Ie.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Zl.date,Ht)," ",Zl.time]}),(0,qe.jsxs)(Y.T,{size:16,colour:se.colours.text,children:[(0,Ie.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),vl?(0,qe.jsx)(U.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:vl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,qe.jsx)(Y.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:vl})}):null,Cl&&Zl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Tl(!1),(async()=>{if(!(0,ke.guardBookingChange)(Es,{b:Zl,tables:xs.tables}))return Sl(null),void ms(null);const s=xs.tables;ms(null),await(0,ke.saveTablesReported)(mt,Zl,s,e,t,Es)})()},onNo:()=>Tl(!1)}):null,(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:vl?'plan-pick-overcap-yes':'plan-pick-save',label:vl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${vl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,Ie.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Zl)return void ms(null);if(!(0,ke.guardBookingChange)(Es,{b:Zl,tables:xs.tables}))return Sl(null),void ms(null);const s=(0,Ie.overCapacityAsk)(xs.tables,t,Zl.partySize);if(s&&!vl)return void Sl(s);if('finished'===Zl.status&&xs.tables.length&&!Cl)return void Tl(!0);Sl(null),Tl(!1);const l=xs.tables;ms(null),await(0,ke.saveTablesReported)(mt,Zl,l,e,t,Es)}}),(0,qe.jsx)(Y.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Sl(null),ms(null)}})]})]})})():null,ti=_l.areas.filter(e=>_l.tables.some(t=>t.areaId===e.id)),si=e=>{const t=Nt.tables.filter(t=>t.areaId===e);return rl?`${t.filter(e=>!kl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Xs[e.name]?.status??'free')).length}/${t.length} free`},li='all'===qt||ti.some(e=>e.id===qt)?qt:'all',ii=e=>(0,qe.jsx)(de.FloorCanvas,{plan:_l,areaId:e,mode:"live",fit:"contain",crop:!0,fill:ht,big:!0,view:kl,privacy:Et,turnBase:jt.settings.turnMins,highlight:xs?xs.tables:Xt?[Xt]:void 0,onTap:e=>Xl(e.name),onDrop:(e,t)=>xs||rl?void 0:Jl(e.name,t.name)}),ni=ct?1:ut||ti.length>2?2:1,oi=e=>{const t=Nt.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},ai=[];for(let e=0;e{const t=(0,de.areaBounds)(Nt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,de.minReadableScale)(Nt,e.id)}}),ft.w,ft.h):null,di=e=>(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',height:ce.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:si(e.id)})]}),ci=(0,qe.jsx)(U.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-ft.w)>1||Math.abs(s-ft.h)>1)&&xt({w:t,h:s})},children:ri?(0,qe.jsx)(V.default,{style:{flex:1},scrollEnabled:ri.scroll,showsVerticalScrollIndicator:ri.scroll,contentContainerStyle:{gap:ce.GRID_GAP},children:ri.rows.map((e,t)=>(0,qe.jsx)(U.default,{style:{height:ri.rowHeights[t],flexDirection:'row',gap:ce.GRID_GAP},children:e.map(e=>{const t=ti.find(t=>t.id===e);return(0,qe.jsxs)(U.default,{testID:`area-cell-${e}`,style:{width:ri.cellW,gap:2},children:[di(t),(0,qe.jsx)(U.default,{style:{flex:1},children:ii(e)})]},e)})},t))}):null}),ui=(0,qe.jsxs)(U.default,{testID:"venue-plan",style:{flex:ct?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:Nt}),Nt.tables.length?null:(0,qe.jsxs)(U.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,qe.jsx)(Y.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Y.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)(Y.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,qe.jsx)(nt,{chipId:"all",compact:!ct,label:"Whole venue",selected:'all'===li,onPress:()=>Yt('all')},"__all"),...ti.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ct,label:`${e.name}${(0,ue.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ct?Qs.has(e.id)?'closed':li===e.id?si(e.id):void 0:void 0,selected:li===e.id,onPress:()=>Yt(e.id)},e.id))];return ct?(0,qe.jsx)(U.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,qe.jsx)(V.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:Ps.view>0&&Ps.content>0&&Ps.content<=Ps.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ps.view>0&&Ps.content<=Ps.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),ei,Xt?(0,qe.jsxs)(Y.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Y.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Xt),": tap the new table."]}),(0,qe.jsx)(Y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Zt(null)})]}):null,'all'===li&&ht?ci:'all'===li?(0,qe.jsx)(U.default,{style:{flex:ct?void 0:1,gap:12,minHeight:gt?void 0:360},children:ai.map((e,t)=>(0,qe.jsxs)(U.default,{style:{flex:ct?void 0:Math.max(.3,...e.map(e=>oi(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(U.default,{style:{flex:1,gap:2},children:[ct?(0,qe.jsxs)(U.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Y.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{center:!0,children:si(e.id)})]}):(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{children:si(e.id)})]}),(0,qe.jsx)(U.default,{style:ct?{height:Math.max(280,Math.round((at-40)*oi(e.id)))}:{flex:1},children:ii(e.id)})]},e.id)),e.length{if(rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},al)}),gi='timeline'===Ft,bi=Ut?(0,qe.jsx)(_.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Kt(!1),supportedOrientations:['landscape','portrait'],children:(0,qe.jsxs)(U.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,qe.jsx)(F.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Kt(!1),style:{minHeight:64,minWidth:at<600?120:180,paddingHorizontal:at<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,qe.jsx)(U.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,qe.jsx)(Y.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${rl?(0,ze.dayLong)(al):'Today'}`})}),at<600?null:(0,qe.jsx)(U.default,{style:{minWidth:180}})]}),ml?jl:(0,qe.jsx)(U.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(be.Timeline,{hideNow:!0,fit:!0,plan:_l,bookings:rl?ul:Us,now:rl?bl:St,privacy:Et,turnBase:jt.settings.turnMins,t0:rl?(0,ee.addMins)(bl,-bl.getMinutes()):sl,t1:rl?(0,ee.addMins)(yl,30):ll,pauses:rl?fl:nl,blockedTables:Gl,onOpen:e=>{if(Kt(!1),rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},`full-${al}`)})]})}):null,yi=rl?(0,qe.jsxs)(U.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:cl?`Showing ${dl} \xb7 ${(0,ee.niceDate)((0,ee.parseYmd)(al))}`:`Showing ${(0,ze.dayWord)(al,Ht)}`}),(0,qe.jsx)(U.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Pl}. Showing ${(0,ze.dayLong)(al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Y.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ms(null),vs(null)},style:{minHeight:44}})]}):null,pi=(0,qe.jsx)(U.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:ct?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(gi||Ut);return(0,qe.jsx)(F.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?(Vt('plan'),Kt(!0)):(Kt(!1),Vt('plan'))},style:{flex:ct?1:void 0,minHeight:ct?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',...Ne.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)(Y.T,{size:ct?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),fi='display'===I.APP_VARIANT&&!e,xi='display'===I.APP_VARIANT&&!e,mi=!e&&!I.IS_CAR&&!ct,ji=fi?(0,qe.jsxs)(U.default,{testID:"display-view-row",style:{flexDirection:ct?'column':'row',flexWrap:ct||mi?'nowrap':'wrap',gap:6,alignItems:ct||mi?'stretch':'center'},children:[pi,(0,qe.jsx)(k.DisplayRotaKitchenButtons,{phone:ct,fill:mi,shifts:Rt,staff:Ct,today:Ht,leave:$t})]}):pi,wi=(0,h.useBookingWrite)(),ki=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Walk-in",onPress:Mt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"New booking",onPress:Mt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint})]});(0,Ke.useDisplayNotices)(mt,!e);const Ii=!e&&!I.IS_CAR&&!ct,Di=ct?180:202,[vi,Si]=(0,H.useState)(ct?180:168),Ci=P.default.useRef(ct?180:168),Ti=P.default.useRef(null),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(!1),[Wi,Li]=(0,H.useState)(!1),zi=!ct&&dt<=800,Hi=We.DAY_GRAPH_CHROME+(zi?24:8),Pi=P.default.useRef(0),[Mi,Ai]=(0,H.useState)(Hi),[Ei,Oi]=(0,H.useState)(!0),[Ni,Gi]=(0,H.useState)(!1);P.default.useEffect(()=>{Gi(!1)},[at,dt]);const Fi=P.default.useRef(()=>{}),Vi=P.default.useCallback(e=>{Math.abs(e-Pi.current)>=2&&(Pi.current=e,setTimeout(()=>Fi.current(),0))},[]),Ui=()=>{const e=Ti.current,t=Ri.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=t>Ci.current?Math.ceil(t-Ci.current):0,o=Ii?Math.max(Hi,Pi.current):Math.max(Hi,n);Ii&&o!==Mi&&Ai(o);const a=!ct&&dt>=700?140:70,r=Math.floor(s-4-e)-o-l,d=i>0&&r-i>=a;Ii&&d!==Ei&&Oi(d),Ii&&!Ni&&r<48&&Gi(!0);const c=r-(d?i:0),u=Math.min(Di,c>=a?Math.max(a,c):Math.max(0,c));Math.abs(Ci.current-u)>=2&&(Ci.current=u,Si(u))},l=44+(dt<820?4:8),i=46+(dt<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=$i.current;Ii&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=dt<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Bi.current?44+d:0)}):s(n,a,t,Ii?i:l)})})};Fi.current=Ui,P.default.useEffect(()=>{const e=setTimeout(()=>Fi.current(),60),t=setTimeout(()=>Fi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[at,dt,al]);const Ki=(0,qe.jsxs)(U.default,{ref:Ri,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ui()},style:{flexDirection:'row',flexWrap:at>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ct?12:zi?2:6,justifyContent:ct?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ue.DisplayClockButton,{}),(0,qe.jsx)(ge.HoldToEdit,{quiet:!0,onUnlock:()=>{Fs(null),Ns({at:Date.now()})},onHint:()=>Es('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(Be.BlockBookingsButton,{rid:mt,r:jt,now:St,by:Lt,quiet:!0,display:!0,day:al}),Nt.areas.some(e=>e.outdoor)?(0,qe.jsx)(Be.CloseGardenButton,{rid:mt,r:jt,now:St,by:Lt,quiet:!0,short:!0}):null,(0,qe.jsx)(F.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Hs(!0),style:({pressed:e})=>({...Ne.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,qe.jsx)(f.GiftQrButton,{rid:mt,venue:jt.name})]}),qi=qs.length?(0,qe.jsxs)(U.default,{testID:"takeaway-panel",style:[Ne.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Y.T,{size:12,colour:se.colours.muted,children:[qs.length," live"]})]}),(0,qe.jsx)(U.default,{style:{padding:10},children:(0,qe.jsx)(ot,{list:qs,me:Lt,compact:!0,bookings:kt})})]}):null,Yi=(Ee.DueToday,jt.settings.turnMins||90),Qi=rl?ul:(0,v.todaysGuestList)(Us,St,Yi),Ji=rl?[]:(0,v.todaysFinishedList)(Us,St,Yi),Xi=rl?cl?`${dl}\u2019s guests`:`Guests ${dl}`:'Today\u2019s guests',Zi=(0,qe.jsxs)(qe.Fragment,{children:[0===Qi.length?(0,qe.jsx)(Y.Muted,{children:rl?al{const t=(0,v.isLeftEarly)(e,St,Yi),s=(0,le.isSeatedHighlight)(e.status,{otherDay:rl})&&!t,l=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=se.colours.text,n=s?se.colours.goldLight:se.colours.muted,o=se.colours.gold,a=l.depositWarn?se.colours.amber:se.colours.goldLight;return(0,qe.jsxs)(F.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:rl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,le.seatedHighlightStyle)({backgroundColor:e?Qe:Ye,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,qe.jsx)(Y.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)(U.default,{style:{paddingTop:2},children:(0,qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,qe.jsxs)(Y.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Y.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}),(0,qe.jsx)(Y.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,qe.jsx)(Y.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(U.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(me.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,qe.jsx)(Y.T,{size:15,colour:se.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),Ji.length?(0,qe.jsxs)(U.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(F.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ji.length}${bs?', expanded':', collapsed'}`,accessibilityState:{expanded:bs},onPress:()=>ys(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Y.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ji.length,")"]}),(0,qe.jsx)(Y.T,{size:16,colour:se.colours.muted,children:bs?'\u25be':'\u25b8'})]}),bs?Ji.map(e=>{const t=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,qe.jsxs)(F.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Y.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Y.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,qe.jsx)(U.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,qe.jsx)(S.BookingUndo,{b:e,rid:mt,today:Ht,who:t.name,allowed:wi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ae.CancellationsSection,{items:Hl,dayWord:rl?cl?dl.toLowerCase():`on ${dl}`:'today'})]}),en=(0,qe.jsx)(V.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Zi}),tn=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&gs(!1)}}),sn=(0,qe.jsxs)(F.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Xi}, ${Qi.length}`,accessibilityState:{expanded:hs},'aria-expanded':hs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>gs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:hs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:hs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Y.T,{size:16,weight:"bold",colour:se.colours.gold,children:Qi.length}),(0,qe.jsx)(U.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(U.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,qe.jsxs)(Y.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Xi," ",hs?'\u2039':'\u203a']})})})]}),ln=hs?(0,qe.jsxs)(U.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,qe.jsxs)(U.default,{testID:"guests-drawer",...tn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*at)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,...Ne.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,qe.jsxs)(U.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Xi.toUpperCase()," (",Qi.length,")"]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Xi}`,onPress:()=>gs(!1),style:{marginRight:-6}})]}),zl.count?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Pl}):null,(0,qe.jsx)(U.default,{testID:"guests-tools",style:{flexDirection:'row',gap:8,marginTop:6,justifyContent:'center'},children:(0,qe.jsx)(F.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:cs},'aria-expanded':cs,onPress:()=>us(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:14,borderRadius:12,borderWidth:1,borderColor:cs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',backgroundColor:e?se.colours.tilePressed:cs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:se.colours.goldLight,children:["Guest key ",cs?'\u25b4':'\u25be']})})}),cs?(0,qe.jsx)(U.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: warning sign allergy, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:6},children:[['\u26a0','allergy'],['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(Y.T,{size:16,children:e}),(0,qe.jsx)(Y.T,{size:14,children:t})]},t))}):null]}),en]}),(0,qe.jsx)(F.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Xi}`,accessibilityRole:"button",onPress:()=>gs(!1),style:{flex:1}})]}):null,nn=ml?jl:l.IS_KIRKTON&&!Object.values(jt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(U.default,{testID:"kirkton-hours-to-confirm",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Y.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(jt,kt,St).busy,todays:ul,open:bl,close:yl,now:St,turnBase:jt.settings.turnMins,blocks:Ml,pauses:fl,compact:ct,dense:!ct,fit:ht,tight:ht&&dt<=600,height:ht?vi:Di,forecastNote:rl?void 0:Ql,emptyText:wl,past:al{Ds.current=Date.now(),Is(!0)},shortDay:!ct&&at<1100}),rn=(0,qe.jsx)(He.DisplayCalendar,{visible:ks,today:Ht,day:al,bookings:kt,restaurant:jt,now:St,onDay:vs,onClose:()=>Is(!1)}),dn=()=>{rl?gs(!0):Kt(!0)},cn=(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',padding:zi?4:dt<820?8:12,paddingTop:zi?Ii?2:4:dt<820?Ii?4:6:Ii?8:10,gap:zi?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:yi,Pt?(0,qe.jsx)(V.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"})}):gi?hi:ui,bi,ln]}),(0,qe.jsxs)(U.default,{testID:"display-side",style:{width:bt,gap:dt<820?4:8,minHeight:0},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ki(!1)}),(0,qe.jsx)(U.default,{style:{flexShrink:0},children:ji}),Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",onLayout:Ui,style:Ii&&!Ni?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:dt<820,snug:dt<820,tight:dt<800,fill:Ii&&!Ni,sound:(0,E.flapSoundOn)(),onPress:dn})}),Pt?null:(0,qe.jsx)(U.default,{ref:Ti,testID:"day-graph-slot",onLayout:Ui,style:{flexGrow:0,flexShrink:Ii?0:1,flexBasis:(ct?Di:vi)+(Ii?Mi:Hi),height:(ct?Di:vi)+(Ii?Mi:Hi),minHeight:dt<=600?90:Math.min((ct?Di:vi)+We.DAY_GRAPH_CHROME,!ct&&dt>=768?140+We.DAY_GRAPH_CHROME:120),overflow:'visible'},children:on}),Ii&&!Pt?(0,qe.jsx)(U.default,{ref:$i,testID:"display-side-split",onLayout:Ui,style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})}):null,(0,qe.jsxs)(V.default,{testID:"display-side-scroll",style:Ii?{flexGrow:0,flexShrink:1,minHeight:Wi&&Ei?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Bi.current&&(Bi.current=s,Li(s),setTimeout(Ui,0))},children:[Ii||xi?null:(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),qi,(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt})]})]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Ds.current=Date.now()},onMouseDown:()=>{Ds.current=Date.now()},children:[ct?(0,qe.jsx)(U.default,{style:{flex:1},children:(0,qe.jsxs)(V.default,{ref:yt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,qe.jsxs)(U.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,qe.jsx)(U.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,qe.jsx)(j.ExitButton,{})}),(0,qe.jsx)(X.RestaurantLogo,{rid:mt,size:64}),(0,qe.jsx)(Y.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:jt.name}),(0,qe.jsx)(X.PoweredBy,{}),(0,qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(U.default,{accessible:!0,accessibilityLabel:`Current time ${(0,ee.hm)(St)}`,children:(0,qe.jsx)(Y.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,ee.hm)(St)})}),(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:"m"}),(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",size:"m"}),Z]}),Fe,I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(ke.BookingSaveBanner,{rid:mt}),an,(0,qe.jsx)(U.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(it,{phone:!0,split:Ll,items:[{label:`Tables \xb7 ${dl}`,value:Bl.length,testID:'badge-tables'},{label:`Covers \xb7 ${dl}`,value:Wl,testID:'badge-covers'},{label:'Takeaway',value:qs.length,alert:qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ls(!0)}]})}),(0,qe.jsx)(U.default,{testID:"primary-actions",style:{gap:8},children:ki(!0)}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt}),ji,(0,qe.jsxs)(U.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[gi?hi:ui,bi]}),(0,qe.jsxs)(U.default,{onLayout:e=>{pt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ne.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Y.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Xi," (",Qi.length,")"]}),(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{gap:4},children:Zi})]}),qi,on,(0,qe.jsx)(U.default,{testID:"covers-dock",children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>yt.current?.scrollTo({y:pt.current,animated:!0})})}),(0,qe.jsxs)(U.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,qe.jsx)(Y.T,{center:!0,size:14,colour:Et?se.colours.muted:se.colours.amber,children:Et?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Y.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Rs(!0),style:{minHeight:48,alignSelf:'stretch'}}),xi?null:(0,qe.jsx)(Y.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ki]})}):(0,qe.jsxs)(qe.Fragment,{children:[Ii?(0,qe.jsx)(U.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:se.colours.hairline},children:(0,qe.jsx)(U.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)(U.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,paddingVertical:zi?2:dt<820?4:8,gap:8,minHeight:zi&&Ii?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ne.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(U.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:Ii?16:8,minWidth:0,overflow:'hidden',...Ii?{justifyContent:'flex-start'}:null},children:[(0,qe.jsx)(U.default,{testID:"display-header-brand",style:Ii?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(X.RestaurantBrand,{rid:jt.id,size:at<900?32:40,beside:!0,noLogo:Ii})}),(0,qe.jsxs)(U.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Y.T,{size:at<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,ee.hm)(St)}),at>=900?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:(0,ee.niceDate)(St)}):null]})]}),Pt?(0,qe.jsx)(U.default,{style:{width:220}}):(0,qe.jsx)(U.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:an}),(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,qe.jsxs)(U.default,{testID:"display-header-chips",style:{flexDirection:at>=1400||Ii?'row':'column',alignItems:at>=1400||Ii?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:at<1240?'xs':at<1280||dt<700?'s':'m'}),Pt?null:(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",slot:Ii,size:at<1340?'xs':at<1400||dt<700?'s':'m'})]}),'simulated'===vt?(0,qe.jsx)(F.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>Dt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,Z,e?null:(0,qe.jsx)(U.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(j.ExitButton,{size:44})})]})]}),Fe,I.IS_CAR||!Pt||Ii?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(ke.BookingSaveBanner,{rid:mt,margin:{marginHorizontal:12,marginTop:6}}),Pt||Ii?null:(0,qe.jsx)(U.default,{testID:"display-day-stats",style:Xe,children:(0,qe.jsxs)(U.default,{style:Ze,children:[I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(U.default,{style:et,children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})})]})}),ht?cn:(un=(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{testID:"front-door-bar",style:{gap:10},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ki(!1)}),ji]}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt}),Pt?(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"}):(0,qe.jsx)(qe.Fragment,{children:(0,qe.jsxs)(U.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[yi,gi?hi:ui,bi,ln]})]})}),qi,Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,sound:(0,E.flapSoundOn)(),onPress:dn})}),Pt?null:(0,qe.jsx)(U.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Di+We.DAY_GRAPH_CHROME},children:on})]}),(0,qe.jsx)(V.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:un})),Ki]}),(0,qe.jsx)($.SoldOutStrip,{rid:mt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:zs,onClose:()=>Hs(!1),rid:mt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:mt}),Mt.elements,is?(0,qe.jsx)(y.EditBookingPicker,{rid:mt,today:Ht,who:Lt,onClose:()=>ns(!1)}):null,os?(0,qe.jsx)(y.EditBookingSheet,{rid:mt,id:os,who:Lt,onClose:()=>as(null)}):null,Qt?(0,qe.jsx)(ve.TableSheet,{rid:mt,name:Qt,view:Xs,plan:Nt,todays:Us,now:St,privacy:Et,turnBase:jt.settings.turnMins,onClose:()=>Jt(null),onWalkIn:e=>Mt.openWalkInAt(e),onMove:e=>Zt(e),onDetails:Vs}):null,Il?(()=>{const e=kl[Il],t=e?.dayBookings??[];return(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>{$l(null),Dl(null)},title:`${(0,d.tableNumbersA11y)(Il)} \xb7 ${cl?dl:(0,ze.dayLong)(al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Y.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${cl?dl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${cl?dl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Et):tt(e.name);return(0,qe.jsx)(Y.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,Ie.tablesWords)((0,ae.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Dl(null),fs(e.id)},style:{minHeight:56}},e.id)}),al>=Ht?(()=>{const t=e?.table.maxSeats??0,s=kt.filter(e=>e.date===al&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,ae.tablesOf)(e.table).includes(Il)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,qe.jsxs)(U.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(Il)]}),Rl?(0,qe.jsxs)(U.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Rl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Rl.ask}),(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!wi.ok,accessibilityHint:wi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=kt.find(e=>e.id===Rl.id);if($l(null),!e)return;const s=tt(e.name);Dl(null),await(0,ke.saveTablesReported)(mt,e,[Il],s,t,Es)}}),(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>$l(null)})]})]}):null,Rl?null:s.slice(0,12).map(e=>{const s=tt(e.name),l=e.partySize>t;return(0,qe.jsx)(Y.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:!wi.ok,accessibilityHint:wi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(Il)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,ke.guardBookingChange)(Es,{b:e,tables:[Il]}))return;const l=(0,Ie.overCapacityAsk)([Il],t,e.partySize);l?$l({id:e.id,ask:l}):(Dl(null),await(0,ke.saveTablesReported)(mt,e,[Il],s,t,Es))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Y.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{$l(null),Dl(null)},style:{minHeight:56}})]})})():null,ps?(()=>{const e=kt.find(e=>e.id===ps);return e?(0,qe.jsx)(je.GuestActionsSheet,{rid:mt,b:e,name:e.walkIn?(0,fe.privName)(e,Et):tt(e.name),view:Xs,now:St,otherDay:e.date!==Ht,turnBase:jt.settings.turnMins,onClose:()=>fs(null),onDetails:Vs,onDone:Es,onEdit:e=>{fs(null),as(e.id)},onPickOnPlan:(e,t)=>{gs(!1),Vt('plan'),Yt('all'),ms({id:e.id,tables:t})}}):null})():null,es?(0,qe.jsx)(ve.DetailsPanel,{title:es.title,onClose:()=>ts(null),children:es.body}):null,rn,rs?(0,qe.jsx)(ve.ServiceSummary,{r:jt,todays:Us,orders:wt,waitlistAll:Ss,walkInCount:Cs,onClose:()=>ds(!1)}):null,Ts?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Rs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsx)(Y.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Rs(!1)})]}):null,Ws?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ls(!1),Bs(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,$s?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(Q.ReviewsSection,{rid:mt,mode:"read",venueName:jt.name}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,ss?(0,qe.jsxs)(ve.DetailsPanel,{title:"Takeaway",onClose:()=>ls(!1),children:[(0,qe.jsx)(Y.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(ot,{list:qs,me:Lt,bookings:kt})]}):null,Os?(0,qe.jsx)(U.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,qe.jsx)(he.PlanDesigner,{initial:Nt,venue:jt.name,mode:"display",startStep:"arrange",onActivity:()=>{_s.current=Date.now(),null!==Gs&&Fs(null)},notice:null!==Gs?`Locking again in ${Gs} s \xb7 touch to keep editing`:null,onSave:e=>{ae.useFloor.getState().setPlan(mt,e),Ns(null),Es('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{ae.useFloor.getState().setPlan(mt,e),Es('Live seating plan updated on every screen.')},onCancel:()=>{Ns(null),Es('No changes kept. Editing is locked again.')}},Os.at)}):null,e?null:(0,qe.jsx)(ye.Screensaver,{rid:mt,idleMins:At.idleMins,pinOn:At.pinOn,wake:At,tonightCards:At.tonightCards,cfg:Ot}),e?null:(0,qe.jsx)(Ce.PrintHost,{rid:mt}),e?null:(0,qe.jsx)(Se.AlertHost,{variant:"display",rid:mt,skipTakeaway:!0}),e?null:(0,qe.jsx)(O.SeatAllergenReminder,{rid:mt}),e?null:(0,qe.jsx)(Te.TakeawayTakeover,{rid:mt,me:Lt})]});var un}function rt({rid:e,id:t,turnBase:s}){const l=(0,te.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1319,[1051,779,805,806,1320,813,1321,1092,843,1138,1322,1323,1324,1089,1119,1325,1326,1331,1332,1200,1333,856,1338,1339,1340,1112,1111,920,1341,1150,891,1102,1342,17,1070,1176,1016,1085,1343,378,363,385,278,85,409,19,777,1216,1220,857,845,863,858,804,1088,876,1096,1055,996,1074,1107,1344,1106,1345,1352,1354,1357,1362,1356,1363,1366,1367,1114,1093,1094,862,1372,1205,1373,1215,1207,993,1378,1383,1384,1052,1050,1116,1386,1387,1388,1069,1169,1389,1168,1159,853,1334,1390,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 Je}}),_e2.DisplayBoard=function(e={}){const t=(0,ie.useOwner)(e=>e.site);return(0,te.useRestaurant)(t)?(0,qe.jsx)(at,{...e}):(0,qe.jsx)(U.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Y.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]),S=_r(_d[23]),v=_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=_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]),Se=_r(_d[76]),ve=_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]);const Ye='#221C12',Qe='#2E2618',Je=12e4,Xe={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},Ze={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},et={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},tt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),lt=e=>e.slotTime?(0,ee.hm)(new Date(e.slotTime)):'ASAP';function it({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,qe.jsxs)(U.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)(U.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)(U.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)(Y.T,{size:s?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,qe.jsx)(Y.T,{size:s?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,qe.jsx)(F.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)(U.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)(Y.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,qe.jsxs)(U.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,qe.jsx)(U.default,{style:{width:`${l.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,qe.jsx)(U.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,qe.jsxs)(F.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)(U.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,qe.jsx)(Y.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Y.T,{size:12,colour:se.colours.muted,children:s}):null]})}function ot({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ve.statusBlock)(e,t,(0,Ve.linkedBooking)(e,l));return e.length?(0,qe.jsx)(U.default,{style:{gap:8},children:e.map(e=>(0,qe.jsxs)(U.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:s?16:18,weight:"bold",children:[lt(e)," \xb7 ",tt(e.customerName)]}),(0,qe.jsx)(Y.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)(Y.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)(Y.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,Z.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Fe.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Y.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Y.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>te.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Y.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Y.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Ce.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Y.Muted,{children:"No takeaway orders right now."})}function at({embedded:e=!1,boardW:b,headerExtra:Z,subHeader:Fe,noVoice:Ve=!1}={}){const lt=(0,K.default)(),at=b??lt.width,dt=lt.height,ct=at<700,ut=at>=dt,ht=!ct&&ut&&at>=600,gt=ht,bt=Math.round(Math.min(520,Math.max(at>=1e3?448:280,.3*at))),yt=P.default.useRef(null),pt=P.default.useRef(0),[ft,xt]=(0,H.useState)({w:0,h:0}),mt=(0,ie.useOwner)(e=>e.site),jt=(0,te.useRestaurant)(mt);(0,Re.useAlertWatcher)(mt,{enabled:!e});const wt=(0,te.useOrders)(mt),It=(0,te.useBookings)(mt),kt=(0,te.useEvents)(mt),Dt=(0,te.useStore)(e=>e.skipMinutes),St=(0,te.useStore)(e=>e.clock.mode),vt=(0,te.useNow)(5e3),Ct=(0,ie.useOwner)(e=>e.staff),Tt=(0,ie.useOwner)(e=>e.attendance),Rt=(0,ie.useOwner)(e=>e.shifts),$t=(0,ie.useOwner)(e=>e.leave),Bt=P.default.useMemo(()=>(0,Ee.workingShifts)(Rt,$t),[Rt,$t]);P.default.useEffect(()=>{(0,oe.ensureAttendance)((0,ee.ymd)(vt),vt)},[(0,ee.ymd)(vt)]);const Wt=(0,R.useSession)(e=>e.meId),Lt=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:tt(Ct.find(e=>e.id===Wt)?.name)}),zt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Ht=(0,ee.ymd)(vt),Pt=(0,A.useTravelDay)('display',Ht),Mt=(0,ne.useFrontDoor)(Ht,ut),At=(0,ae.useDisplaySettings)(mt),Ot=At.privacy,Et=(0,pe.useSaverSync)(),Nt=(0,ae.usePlan)(mt),_t=(0,ae.useFloor)(e=>e.live[mt]),Gt=(0,$e.useBlocks)(e=>e.blocks),[Ft,Vt]=(0,H.useState)('plan'),[Ut,Kt]=(0,H.useState)(!1),[qt,Yt]=(0,H.useState)('all'),[Qt,Jt]=(0,H.useState)(null),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(!1),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(null),[rs,ds]=(0,H.useState)(!1),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(null),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(!1),Ds=P.default.useRef(0),Ss=e=>{Ds.current=Date.now(),ws(e)};P.default.useEffect(()=>{if(!js)return;const e=setInterval(()=>{Date.now()-Ds.current>=ze.DAY_IDLE_MS&&ws(null)},5e3);return()=>clearInterval(e)},[js]);const vs=(0,te.useWaitlist)(mt),Cs=(0,te.useStore)(e=>e.walkIns[mt]??0),[Ts,Rs]=(0,H.useState)(!1),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1);(0,J.useReviewAlerts)(mt);const[Ps,Ms]=(0,H.useState)({view:0,content:0}),[As,Os]=(0,H.useState)(null);P.default.useEffect(()=>{As&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:As,timeoutMs:4500,big:!0,testID:'floor-toast'}),Os(null))},[As]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[Es,Ns]=(0,H.useState)(null),_s=P.default.useRef(0),[Gs,Fs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Es)return;_s.current=Date.now();const e=setInterval(()=>{const e=Date.now()-_s.current;if(e>=Je)return Ns(null),void Os('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Fs(e>=105e3?Math.ceil((Je-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Es]);const Vs=e=>e.date!==Ht?ts({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Ht)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Ht?(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Ht)}, ${e.time}`,disabled:!wi.ok,accessibilityHint:wi.hint,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ts({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(rt,{rid:mt,id:e.id,turnBase:jt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(we.CancelWalkInButton,{rid:mt,b:e,big:!0,onDone:e=>{ts(null),Os(e)}}):null,e.walkIn?(0,qe.jsx)(we.ReinstateWalkInButton,{rid:mt,b:e,today:Ht,onDone:e=>{ts(null),Os(e)}}):null,(0,Se.bookingDetails)(e)]})}),Us=It.filter(e=>e.date===Ht).sort((e,t)=>e.time.localeCompare(t.time)),Ks=Us.filter(e=>!['cancelled','noshow'].includes(e.status)),qs=wt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,H.useMemo)(()=>(0,c.forecastToday)(jt,It,wt,kt,vt),[jt,It,wt,kt,vt.getTime()/6e4|0]),Qs=(0,$e.closedAreasAt)(Gt,mt,Ht,(0,ee.hm)(vt)),Js=[...Qs].join(','),Xs=(0,H.useMemo)(()=>(0,re.floorView)(Nt,It,wt,_t??{},vt,jt.settings.turnMins,Qs),[Nt,It,wt,_t,vt.getTime(),Js]),Zs=(0,De.hoursFor)(jt,vt),el=Zs?.open??new Date(`${Ht}T12:00:00`),tl=Zs?.close??new Date(`${Ht}T21:00:00`),sl=(0,ee.addMins)(el,-el.getMinutes()),ll=(0,ee.addMins)(tl,30),il=e=>new Date(`${Ht}T${e}:00`),nl=(0,$e.blocksOn)(Gt,mt,Ht).map(e=>({from:il(e.from),to:il(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(jt,vt,Ht)),ol=Object.keys(Xs).filter(e=>'blocked'===Xs[e]?.status),al=js&&js!==Ht?js:Ht,rl=al!==Ht,dl=(0,ze.dayWord)(al,Ht),cl=/^(Today|Yesterday|Tomorrow)$/.test(dl),ul=rl?(0,ze.bookingsForDay)(It,al,Ht).sort((e,t)=>e.time.localeCompare(t.time)):Us,hl=(0,ee.parseYmd)(al);hl.setHours(12);const gl=rl?(0,De.hoursFor)(jt,hl):Zs,bl=gl?.open??new Date(`${al}T12:00:00`),yl=gl?.close??new Date(`${al}T21:00:00`),pl=e=>new Date(`${al}T${e}:00`),fl=[...rl?(0,$e.blocksOn)(Gt,mt,al).map(e=>({from:pl(e.from),to:pl(e.to),label:e.reason??'Paused'})):nl,...rl?(0,n.queuedServicePauses)(jt,hl,al):[]],xl=(0,n.queuedServiceSessions)(jt,hl),ml=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),jl=(0,qe.jsxs)(U.default,{testID:"queued-hours-gate",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Y.Muted,{children:i.queuedVenues[mt]?.hours.note})]}),wl=rl?gl||ul.length?alrl?(0,re.dayFloorView)(Nt,ul,al):Xs,[rl,Nt,ul,al,Xs]),[kl,Dl]=(0,H.useState)(null),[Sl,vl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(!1),[Rl,$l]=(0,H.useState)(null),Bl=rl?ul.filter(e=>!['cancelled','noshow'].includes(e.status)):Ks,Wl=Bl.reduce((e,t)=>e+t.partySize,0),Ll=(0,u.coversSplit)(Bl,al),zl=(0,Pe.cancelledDayTally)(It,al),Hl=(0,Me.cancellationsFor)(It,al,e=>e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)','')),Pl=(0,Pe.cancelledTallyWords)(zl,cl?dl.toLowerCase():rl?`on ${dl}`:'today'),Ml=Gt.filter(e=>e.rid===mt&&e.date===al&&!e.removedAt),Al=60*bl.getHours()+bl.getMinutes(),Ol=60*yl.getHours()+yl.getMinutes(),El=(0,Le.chartBands)(Ml,Al,Ol),Nl=(0,Le.seasonClosedAreaIds)(Ml,Al,Ol),_l=Nl.size?{...Nt,areas:Nt.areas.filter(e=>!Nl.has(e.id)),tables:Nt.tables.filter(e=>!Nl.has(e.areaId))}:Nt,Gl=rl?[]:ol.filter(e=>!Nl.has(Nt.tables.find(t=>t.name===e)?.areaId??'')),Fl=new Set((0,Le.blockedHours)(El)),Vl=vt.getHours()+(vt.getMinutes()>=30?1:0),Ul=Ys.hours.filter(e=>e.hour>=Vl&&!Fl.has(e.hour)),Kl=Ul.reduce((e,t)=>e+t.coversHigh,0),ql=Ul.reduce((e,t)=>e+t.coversLow,0),Yl=Math.round((ql+Kl)/2),Ql=!Ys.example&&Ys.open&&Ys.enough&&Kl>0?`Usually ${(0,c.coversRange)(Yl,Yl)} more`:void 0,Jl=async(e,t)=>{const s=Xs[e]?.booking;if(!s||e===t)return;const l=Xs[t]?.status;if(l&&!['free','soon'].includes(l))return void Os('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${re.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(Os,{b:s,tables:[t]}))return;await te.repo.bookings.update(s.id,{table:t});const i=_t?.[e]?.stage;ae.useFloor.getState().setLive(mt,t,{stage:i??'seated',dirty:!1}),ae.useFloor.getState().setLive(mt,e,{stage:void 0,dirty:!0}),Os(`Saving: ${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(s.id,`${(0,fe.privName)(s,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}`,Os)},Xl=e=>{if(xs)return vl(null),void ms(t=>t?{...t,tables:(0,ke.toggleTable)(t.tables,e)}:t);rl?Dl(e):Xt?(e!==Xt&&Jl(Xt,e),Zt(null)):Jt(e)},Zl=xs?It.find(e=>e.id===xs.id):void 0,ei=xs&&Zl?(()=>{const e=Zl.walkIn?(0,fe.privName)(Zl,Ot):tt(Zl.name),t=(0,ke.seatsOf)(Nt,xs.tables).total,s=(0,ke.seatLine)(t,Zl.partySize),l=(0,ke.pickClashes)(Zl,xs.tables,It.filter(e=>e.date===Zl.date),jt.settings.turnMins),i=(0,ke.tableKey)(xs.tables)!==(0,ke.tableKey)((0,ae.tablesOf)(Zl.table));return(0,qe.jsxs)(U.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,qe.jsxs)(U.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Zl.date,Ht)} ${Zl.time}. Tap tables on the plan to add or take them off. ${(0,ke.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Zl.date,Ht)," ",Zl.time]}),(0,qe.jsxs)(Y.T,{size:16,colour:se.colours.text,children:[(0,ke.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Sl?(0,qe.jsx)(U.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Sl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,qe.jsx)(Y.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Sl})}):null,Cl&&Zl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Tl(!1),(async()=>{if(!(0,Ie.guardBookingChange)(Os,{b:Zl,tables:xs.tables}))return vl(null),void ms(null);const s=xs.tables;ms(null),await(0,Ie.saveTablesReported)(mt,Zl,s,e,t,Os)})()},onNo:()=>Tl(!1)}):null,(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.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,ke.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Zl)return void ms(null);if(!(0,Ie.guardBookingChange)(Os,{b:Zl,tables:xs.tables}))return vl(null),void ms(null);const s=(0,ke.overCapacityAsk)(xs.tables,t,Zl.partySize);if(s&&!Sl)return void vl(s);if('finished'===Zl.status&&xs.tables.length&&!Cl)return void Tl(!0);vl(null),Tl(!1);const l=xs.tables;ms(null),await(0,Ie.saveTablesReported)(mt,Zl,l,e,t,Os)}}),(0,qe.jsx)(Y.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{vl(null),ms(null)}})]})]})})():null,ti=_l.areas.filter(e=>_l.tables.some(t=>t.areaId===e.id)),si=e=>{const t=Nt.tables.filter(t=>t.areaId===e);return rl?`${t.filter(e=>!Il[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Xs[e.name]?.status??'free')).length}/${t.length} free`},li='all'===qt||ti.some(e=>e.id===qt)?qt:'all',ii=e=>(0,qe.jsx)(de.FloorCanvas,{plan:_l,areaId:e,mode:"live",fit:"contain",crop:!0,fill:ht,big:!0,view:Il,privacy:Ot,turnBase:jt.settings.turnMins,highlight:xs?xs.tables:Xt?[Xt]:void 0,onTap:e=>Xl(e.name),onDrop:(e,t)=>xs||rl?void 0:Jl(e.name,t.name)}),ni=ct?1:ut||ti.length>2?2:1,oi=e=>{const t=Nt.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},ai=[];for(let e=0;e{const t=(0,de.areaBounds)(Nt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,de.minReadableScale)(Nt,e.id)}}),ft.w,ft.h):null,di=e=>(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',height:ce.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:si(e.id)})]}),ci=(0,qe.jsx)(U.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-ft.w)>1||Math.abs(s-ft.h)>1)&&xt({w:t,h:s})},children:ri?(0,qe.jsx)(V.default,{style:{flex:1},scrollEnabled:ri.scroll,showsVerticalScrollIndicator:ri.scroll,contentContainerStyle:{gap:ce.GRID_GAP},children:ri.rows.map((e,t)=>(0,qe.jsx)(U.default,{style:{height:ri.rowHeights[t],flexDirection:'row',gap:ce.GRID_GAP},children:e.map(e=>{const t=ti.find(t=>t.id===e);return(0,qe.jsxs)(U.default,{testID:`area-cell-${e}`,style:{width:ri.cellW,gap:2},children:[di(t),(0,qe.jsx)(U.default,{style:{flex:1},children:ii(e)})]},e)})},t))}):null}),ui=(0,qe.jsxs)(U.default,{testID:"venue-plan",style:{flex:ct?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:Nt}),Nt.tables.length?null:(0,qe.jsxs)(U.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,qe.jsx)(Y.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Y.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)(Y.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,qe.jsx)(nt,{chipId:"all",compact:!ct,label:"Whole venue",selected:'all'===li,onPress:()=>Yt('all')},"__all"),...ti.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ct,label:`${e.name}${(0,ue.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ct?Qs.has(e.id)?'closed':li===e.id?si(e.id):void 0:void 0,selected:li===e.id,onPress:()=>Yt(e.id)},e.id))];return ct?(0,qe.jsx)(U.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,qe.jsx)(V.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:Ps.view>0&&Ps.content>0&&Ps.content<=Ps.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ps.view>0&&Ps.content<=Ps.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),ei,Xt?(0,qe.jsxs)(Y.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Y.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Xt),": tap the new table."]}),(0,qe.jsx)(Y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Zt(null)})]}):null,'all'===li&&ht?ci:'all'===li?(0,qe.jsx)(U.default,{style:{flex:ct?void 0:1,gap:12,minHeight:gt?void 0:360},children:ai.map((e,t)=>(0,qe.jsxs)(U.default,{style:{flex:ct?void 0:Math.max(.3,...e.map(e=>oi(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(U.default,{style:{flex:1,gap:2},children:[ct?(0,qe.jsxs)(U.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Y.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{center:!0,children:si(e.id)})]}):(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{children:si(e.id)})]}),(0,qe.jsx)(U.default,{style:ct?{height:Math.max(280,Math.round((at-40)*oi(e.id)))}:{flex:1},children:ii(e.id)})]},e.id)),e.length{if(rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},al)}),gi='timeline'===Ft,bi=Ut?(0,qe.jsx)(_.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Kt(!1),supportedOrientations:['landscape','portrait'],children:(0,qe.jsxs)(U.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,qe.jsx)(F.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Kt(!1),style:{minHeight:64,minWidth:at<600?120:180,paddingHorizontal:at<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,qe.jsx)(U.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,qe.jsx)(Y.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${rl?(0,ze.dayLong)(al):'Today'}`})}),at<600?null:(0,qe.jsx)(U.default,{style:{minWidth:180}})]}),ml?jl:(0,qe.jsx)(U.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(be.Timeline,{hideNow:!0,fit:!0,plan:_l,bookings:rl?ul:Us,now:rl?bl:vt,privacy:Ot,turnBase:jt.settings.turnMins,t0:rl?(0,ee.addMins)(bl,-bl.getMinutes()):sl,t1:rl?(0,ee.addMins)(yl,30):ll,pauses:rl?fl:nl,blockedTables:Gl,onOpen:e=>{if(Kt(!1),rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},`full-${al}`)})]})}):null,yi=rl?(0,qe.jsxs)(U.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:cl?`Showing ${dl} \xb7 ${(0,ee.niceDate)((0,ee.parseYmd)(al))}`:`Showing ${(0,ze.dayWord)(al,Ht)}`}),(0,qe.jsx)(U.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Pl}. Showing ${(0,ze.dayLong)(al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Y.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ms(null),Ss(null)},style:{minHeight:44}})]}):null,pi=(0,qe.jsx)(U.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:ct?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(gi||Ut);return(0,qe.jsx)(F.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?(Vt('plan'),Kt(!0)):(Kt(!1),Vt('plan'))},style:{flex:ct?1:void 0,minHeight:ct?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',...Ne.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)(Y.T,{size:ct?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),fi='display'===k.APP_VARIANT&&!e,xi='display'===k.APP_VARIANT&&!e,mi=!e&&!k.IS_CAR&&!ct,ji=fi?(0,qe.jsxs)(U.default,{testID:"display-view-row",style:{flexDirection:ct?'column':'row',flexWrap:ct||mi?'nowrap':'wrap',gap:6,alignItems:ct||mi?'stretch':'center'},children:[pi,(0,qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ct,fill:mi,shifts:Rt,staff:Ct,today:Ht,leave:$t})]}):pi,wi=(0,h.useBookingWrite)(),Ii=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Walk-in",onPress:Mt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"New booking",onPress:Mt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint})]});(0,Ke.useDisplayNotices)(mt,!e);const ki=!e&&!k.IS_CAR&&!ct,Di=ct?180:202,[Si,vi]=(0,H.useState)(ct?180:168),Ci=P.default.useRef(ct?180:168),Ti=P.default.useRef(null),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(!1),[Wi,Li]=(0,H.useState)(!1),zi=!ct&&dt<=800,Hi=We.DAY_GRAPH_CHROME+(zi?24:8),Pi=P.default.useRef(0),[Mi,Ai]=(0,H.useState)(Hi),[Oi,Ei]=(0,H.useState)(!0),[Ni,Gi]=(0,H.useState)(!1);P.default.useEffect(()=>{Gi(!1)},[at,dt]);const Fi=P.default.useRef(()=>{}),Vi=P.default.useCallback(e=>{Math.abs(e-Pi.current)>=2&&(Pi.current=e,setTimeout(()=>Fi.current(),0))},[]),Ui=()=>{const e=Ti.current,t=Ri.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=t>Ci.current?Math.ceil(t-Ci.current):0,o=ki?Math.max(Hi,Pi.current):Math.max(Hi,n);ki&&o!==Mi&&Ai(o);const a=!ct&&dt>=700?140:70,r=Math.floor(s-4-e)-o-l,d=i>0&&r-i>=a;ki&&d!==Oi&&Ei(d),ki&&!Ni&&r<48&&Gi(!0);const c=r-(d?i:0),u=Math.min(Di,c>=a?Math.max(a,c):Math.max(0,c));Math.abs(Ci.current-u)>=2&&(Ci.current=u,vi(u))},l=44+(dt<820?4:8),i=46+(dt<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=$i.current;ki&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=dt<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Bi.current?44+d:0)}):s(n,a,t,ki?i:l)})})};Fi.current=Ui,P.default.useEffect(()=>{const e=setTimeout(()=>Fi.current(),60),t=setTimeout(()=>Fi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[at,dt,al]);const Ki=(0,qe.jsxs)(U.default,{ref:Ri,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ui()},style:{flexDirection:'row',flexWrap:at>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ct?12:zi?2:6,justifyContent:ct?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ue.DisplayClockButton,{}),(0,qe.jsx)(ge.HoldToEdit,{quiet:!0,onUnlock:()=>{Fs(null),Ns({at:Date.now()})},onHint:()=>Os('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(Be.BlockBookingsButton,{rid:mt,r:jt,now:vt,by:Lt,quiet:!0,display:!0,day:al}),Nt.areas.some(e=>e.outdoor)?(0,qe.jsx)(Be.CloseGardenButton,{rid:mt,r:jt,now:vt,by:Lt,quiet:!0,short:!0}):null,(0,qe.jsx)(F.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Hs(!0),style:({pressed:e})=>({...Ne.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,qe.jsx)(f.GiftQrButton,{rid:mt,venue:jt.name})]}),qi=qs.length?(0,qe.jsxs)(U.default,{testID:"takeaway-panel",style:[Ne.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Y.T,{size:12,colour:se.colours.muted,children:[qs.length," live"]})]}),(0,qe.jsx)(U.default,{style:{padding:10},children:(0,qe.jsx)(ot,{list:qs,me:Lt,compact:!0,bookings:It})})]}):null,Yi=(Oe.DueToday,jt.settings.turnMins||90),Qi=rl?ul:(0,S.todaysGuestList)(Us,vt,Yi),Ji=rl?[]:(0,S.todaysFinishedList)(Us,vt,Yi),Xi=rl?cl?`${dl}\u2019s guests`:`Guests ${dl}`:'Today\u2019s guests',Zi=(0,qe.jsxs)(qe.Fragment,{children:[0===Qi.length?(0,qe.jsx)(Y.Muted,{children:rl?al{const t=(0,S.isLeftEarly)(e,vt,Yi),s=(0,le.isSeatedHighlight)(e.status,{otherDay:rl})&&!t,l=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=se.colours.text,n=s?se.colours.goldLight:se.colours.muted,o=se.colours.gold,a=l.depositWarn?se.colours.amber:se.colours.goldLight;return(0,qe.jsxs)(F.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:rl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,le.seatedHighlightStyle)({backgroundColor:e?Qe:Ye,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,qe.jsx)(Y.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)(U.default,{style:{paddingTop:2},children:(0,qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,qe.jsx)(Y.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,qe.jsx)(Y.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&re.OCCASION_ICON[l.occasion]?(0,qe.jsx)(Y.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:re.OCCASION_ICON[l.occasion]}):null]}),(0,qe.jsxs)(Y.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Y.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}),(0,qe.jsx)(Y.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,qe.jsx)(Y.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(U.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(me.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,qe.jsx)(Y.T,{size:15,colour:se.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),Ji.length?(0,qe.jsxs)(U.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(F.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ji.length}${bs?', expanded':', collapsed'}`,accessibilityState:{expanded:bs},onPress:()=>ys(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Y.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ji.length,")"]}),(0,qe.jsx)(Y.T,{size:16,colour:se.colours.muted,children:bs?'\u25be':'\u25b8'})]}),bs?Ji.map(e=>{const t=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,qe.jsxs)(F.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Y.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Y.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,qe.jsx)(U.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,qe.jsx)(v.BookingUndo,{b:e,rid:mt,today:Ht,who:t.name,allowed:wi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ae.CancellationsSection,{items:Hl,dayWord:rl?cl?dl.toLowerCase():`on ${dl}`:'today'})]}),en=(0,qe.jsx)(V.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Zi}),tn=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&gs(!1)}}),sn=(0,qe.jsxs)(F.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Xi}, ${Qi.length}`,accessibilityState:{expanded:hs},'aria-expanded':hs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>gs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:hs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:hs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Y.T,{size:16,weight:"bold",colour:se.colours.gold,children:Qi.length}),(0,qe.jsx)(U.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(U.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,qe.jsxs)(Y.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Xi," ",hs?'\u2039':'\u203a']})})})]}),ln=Math.min(560,Math.max(320,.44*at))<400,nn=hs?(0,qe.jsxs)(U.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,qe.jsxs)(U.default,{testID:"guests-drawer",...tn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*at)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,...Ne.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,qe.jsxs)(U.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,qe.jsxs)(U.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsxs)(U.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,qe.jsxs)(Y.T,{testID:"guests-heading",size:ln?14:17,weight:"semibold",colour:se.colours.gold,style:{flexShrink:1,minWidth:0},children:[Xi.toUpperCase()," (",Qi.length,")"]}),(0,qe.jsx)(F.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:cs},'aria-expanded':cs,onPress:()=>us(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:ln?8:12,borderRadius:12,borderWidth:1,borderColor:cs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?se.colours.tilePressed:cs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:se.colours.goldLight,children:[ln?'Key':'Guest key'," ",cs?'\u25b4':'\u25be']})})]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Xi}`,onPress:()=>gs(!1),style:{marginRight:-6,flexShrink:0}})]}),zl.count?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Pl}):null,cs?(0,qe.jsxs)(U.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:se.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,qe.jsxs)(U.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:se.colours.amber,ink:se.colours.bg}),(0,qe.jsx)(Y.T,{size:14,children:"allergy"})]}),(0,qe.jsxs)(U.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(me.DogIcon,{size:18}),(0,qe.jsx)(Y.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,qe.jsxs)(U.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(Y.T,{size:16,children:e}),(0,qe.jsx)(Y.T,{size:14,children:t})]},t))]}):null]}),en]}),(0,qe.jsx)(F.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Xi}`,accessibilityRole:"button",onPress:()=>gs(!1),style:{flex:1}})]}):null,on=ml?jl:l.IS_KIRKTON&&!Object.values(jt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(U.default,{testID:"kirkton-hours-to-confirm",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Y.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(jt,It,vt).busy,todays:ul,open:bl,close:yl,now:vt,turnBase:jt.settings.turnMins,blocks:Ml,pauses:fl,compact:ct,dense:!ct,fit:ht,tight:ht&&dt<=600,height:ht?Si:Di,forecastNote:rl?void 0:Ql,emptyText:wl,past:al{Ds.current=Date.now(),ks(!0)},shortDay:!ct&&at<1100}),dn=(0,qe.jsx)(He.DisplayCalendar,{visible:Is,today:Ht,day:al,bookings:It,restaurant:jt,now:vt,onDay:Ss,onClose:()=>ks(!1)}),cn=()=>{rl?gs(!0):Kt(!0)},un=(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',padding:zi?4:dt<820?8:12,paddingTop:zi?ki?2:4:dt<820?ki?4:6:ki?8:10,gap:zi?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:yi,Pt?(0,qe.jsx)(V.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"})}):gi?hi:ui,bi,nn]}),(0,qe.jsxs)(U.default,{testID:"display-side",style:{width:bt,gap:dt<820?4:8,minHeight:0},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Ii(!1)}),(0,qe.jsx)(U.default,{style:{flexShrink:0},children:ji}),Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",onLayout:Ui,style:ki&&!Ni?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:dt<820,snug:dt<820,tight:dt<800,fill:ki&&!Ni,sound:(0,O.flapSoundOn)(),onPress:cn})}),Pt?null:(0,qe.jsx)(U.default,{ref:Ti,testID:"day-graph-slot",onLayout:Ui,style:{flexGrow:0,flexShrink:ki?0:1,flexBasis:(ct?Di:Si)+(ki?Mi:Hi),height:(ct?Di:Si)+(ki?Mi:Hi),minHeight:dt<=600?90:Math.min((ct?Di:Si)+We.DAY_GRAPH_CHROME,!ct&&dt>=768?140+We.DAY_GRAPH_CHROME:120),overflow:'visible'},children:an}),ki&&!Pt?(0,qe.jsx)(U.default,{ref:$i,testID:"display-side-split",onLayout:Ui,style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})}):null,(0,qe.jsxs)(V.default,{testID:"display-side-scroll",style:ki?{flexGrow:0,flexShrink:1,minHeight:Wi&&Oi?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Bi.current&&(Bi.current=s,Li(s),setTimeout(Ui,0))},children:[ki||xi?null:(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),qi,(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt})]})]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Ds.current=Date.now()},onMouseDown:()=>{Ds.current=Date.now()},children:[ct?(0,qe.jsx)(U.default,{style:{flex:1},children:(0,qe.jsxs)(V.default,{ref:yt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,qe.jsxs)(U.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,qe.jsx)(U.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,qe.jsx)(j.ExitButton,{})}),(0,qe.jsx)(X.RestaurantLogo,{rid:mt,size:64}),(0,qe.jsx)(Y.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:jt.name}),(0,qe.jsx)(X.PoweredBy,{}),(0,qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(U.default,{accessible:!0,accessibilityLabel:`Current time ${(0,ee.hm)(vt)}`,children:(0,qe.jsx)(Y.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,ee.hm)(vt)})}),(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:"m"}),(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",size:"m"}),Z]}),Fe,k.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:mt}),rn,(0,qe.jsx)(U.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(it,{phone:!0,split:Ll,items:[{label:`Tables \xb7 ${dl}`,value:Bl.length,testID:'badge-tables'},{label:`Covers \xb7 ${dl}`,value:Wl,testID:'badge-covers'},{label:'Takeaway',value:qs.length,alert:qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ls(!0)}]})}),(0,qe.jsx)(U.default,{testID:"primary-actions",style:{gap:8},children:Ii(!0)}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt}),ji,(0,qe.jsxs)(U.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[gi?hi:ui,bi]}),(0,qe.jsxs)(U.default,{onLayout:e=>{pt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ne.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Y.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Xi," (",Qi.length,")"]}),(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{gap:4},children:Zi})]}),qi,an,(0,qe.jsx)(U.default,{testID:"covers-dock",children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>yt.current?.scrollTo({y:pt.current,animated:!0})})}),(0,qe.jsxs)(U.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,qe.jsx)(Y.T,{center:!0,size:14,colour:Ot?se.colours.muted:se.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Y.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Rs(!0),style:{minHeight:48,alignSelf:'stretch'}}),xi?null:(0,qe.jsx)(Y.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ki]})}):(0,qe.jsxs)(qe.Fragment,{children:[ki?(0,qe.jsx)(U.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:se.colours.hairline},children:(0,qe.jsx)(U.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)(U.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,paddingVertical:zi?2:dt<820?4:8,gap:8,minHeight:zi&&ki?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ne.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(U.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:ki?16:8,minWidth:0,overflow:'hidden',...ki?{justifyContent:'flex-start'}:null},children:[(0,qe.jsx)(U.default,{testID:"display-header-brand",style:ki?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(X.RestaurantBrand,{rid:jt.id,size:at<900?32:40,beside:!0,noLogo:ki})}),(0,qe.jsxs)(U.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Y.T,{size:at<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,ee.hm)(vt)}),at>=900?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:(0,ee.niceDate)(vt)}):null]})]}),Pt?(0,qe.jsx)(U.default,{style:{width:220}}):(0,qe.jsx)(U.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:rn}),(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,qe.jsxs)(U.default,{testID:"display-header-chips",style:{flexDirection:at>=1400||ki?'row':'column',alignItems:at>=1400||ki?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:at<1240?'xs':at<1280||dt<700?'s':'m'}),Pt?null:(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",slot:ki,size:at<1340?'xs':at<1400||dt<700?'s':'m'})]}),'simulated'===St?(0,qe.jsx)(F.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>Dt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,Z,e?null:(0,qe.jsx)(U.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(j.ExitButton,{size:44})})]})]}),Fe,k.IS_CAR||!Pt||ki?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:mt,margin:{marginHorizontal:12,marginTop:6}}),Pt||ki?null:(0,qe.jsx)(U.default,{testID:"display-day-stats",style:Xe,children:(0,qe.jsxs)(U.default,{style:Ze,children:[k.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(U.default,{style:et,children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})})]})}),ht?un:(hn=(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{testID:"front-door-bar",style:{gap:10},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Ii(!1)}),ji]}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt}),Pt?(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"}):(0,qe.jsx)(qe.Fragment,{children:(0,qe.jsxs)(U.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[yi,gi?hi:ui,bi,nn]})]})}),qi,Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,sound:(0,O.flapSoundOn)(),onPress:cn})}),Pt?null:(0,qe.jsx)(U.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Di+We.DAY_GRAPH_CHROME},children:an})]}),(0,qe.jsx)(V.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:hn})),Ki]}),(0,qe.jsx)($.SoldOutStrip,{rid:mt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:zs,onClose:()=>Hs(!1),rid:mt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:mt}),Mt.elements,is?(0,qe.jsx)(y.EditBookingPicker,{rid:mt,today:Ht,who:Lt,onClose:()=>ns(!1)}):null,os?(0,qe.jsx)(y.EditBookingSheet,{rid:mt,id:os,who:Lt,onClose:()=>as(null)}):null,Qt?(0,qe.jsx)(Se.TableSheet,{rid:mt,name:Qt,view:Xs,plan:Nt,todays:Us,now:vt,privacy:Ot,turnBase:jt.settings.turnMins,onClose:()=>Jt(null),onWalkIn:e=>Mt.openWalkInAt(e),onMove:e=>Zt(e),onDetails:Vs}):null,kl?(()=>{const e=Il[kl],t=e?.dayBookings??[];return(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>{$l(null),Dl(null)},title:`${(0,d.tableNumbersA11y)(kl)} \xb7 ${cl?dl:(0,ze.dayLong)(al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Y.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${cl?dl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${cl?dl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Ot):tt(e.name);return(0,qe.jsx)(Y.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,ke.tablesWords)((0,ae.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Dl(null),fs(e.id)},style:{minHeight:56}},e.id)}),al>=Ht?(()=>{const t=e?.table.maxSeats??0,s=It.filter(e=>e.date===al&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,ae.tablesOf)(e.table).includes(kl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,qe.jsxs)(U.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(kl)]}),Rl?(0,qe.jsxs)(U.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Rl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Rl.ask}),(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!wi.ok,accessibilityHint:wi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Rl.id);if($l(null),!e)return;const s=tt(e.name);Dl(null),await(0,Ie.saveTablesReported)(mt,e,[kl],s,t,Os)}}),(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>$l(null)})]})]}):null,Rl?null:s.slice(0,12).map(e=>{const s=tt(e.name),l=e.partySize>t;return(0,qe.jsx)(Y.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:!wi.ok,accessibilityHint:wi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(kl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(Os,{b:e,tables:[kl]}))return;const l=(0,ke.overCapacityAsk)([kl],t,e.partySize);l?$l({id:e.id,ask:l}):(Dl(null),await(0,Ie.saveTablesReported)(mt,e,[kl],s,t,Os))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Y.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{$l(null),Dl(null)},style:{minHeight:56}})]})})():null,ps?(()=>{const e=It.find(e=>e.id===ps);return e?(0,qe.jsx)(je.GuestActionsSheet,{rid:mt,b:e,name:e.walkIn?(0,fe.privName)(e,Ot):tt(e.name),view:Xs,now:vt,otherDay:e.date!==Ht,turnBase:jt.settings.turnMins,onClose:()=>fs(null),onDetails:Vs,onDone:Os,onEdit:e=>{fs(null),as(e.id)},onPickOnPlan:(e,t)=>{gs(!1),Vt('plan'),Yt('all'),ms({id:e.id,tables:t})}}):null})():null,es?(0,qe.jsx)(Se.DetailsPanel,{title:es.title,onClose:()=>ts(null),children:es.body}):null,dn,rs?(0,qe.jsx)(Se.ServiceSummary,{r:jt,todays:Us,orders:wt,waitlistAll:vs,walkInCount:Cs,onClose:()=>ds(!1)}):null,Ts?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Rs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsxs)(U.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:se.colours.amber,ink:se.colours.bg}),(0,qe.jsx)(Y.T,{size:14,children:"allergy"})]}),(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(me.DogIcon,{size:18}),(0,qe.jsx)(Y.T,{size:14,children:"dog"})]}),(0,qe.jsx)(Y.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Rs(!1)})]}):null,Ws?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ls(!1),Bs(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,$s?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(Q.ReviewsSection,{rid:mt,mode:"read",venueName:jt.name}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,ss?(0,qe.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>ls(!1),children:[(0,qe.jsx)(Y.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(ot,{list:qs,me:Lt,bookings:It})]}):null,Es?(0,qe.jsx)(U.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,qe.jsx)(he.PlanDesigner,{initial:Nt,venue:jt.name,mode:"display",startStep:"arrange",onActivity:()=>{_s.current=Date.now(),null!==Gs&&Fs(null)},notice:null!==Gs?`Locking again in ${Gs} s \xb7 touch to keep editing`:null,onSave:e=>{ae.useFloor.getState().setPlan(mt,e),Ns(null),Os('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{ae.useFloor.getState().setPlan(mt,e),Os('Live seating plan updated on every screen.')},onCancel:()=>{Ns(null),Os('No changes kept. Editing is locked again.')}},Es.at)}):null,e?null:(0,qe.jsx)(ye.Screensaver,{rid:mt,idleMins:At.idleMins,pinOn:At.pinOn,wake:At,tonightCards:At.tonightCards,cfg:Et}),e?null:(0,qe.jsx)(Ce.PrintHost,{rid:mt}),e?null:(0,qe.jsx)(ve.AlertHost,{variant:"display",rid:mt,skipTakeaway:!0}),e?null:(0,qe.jsx)(E.SeatAllergenReminder,{rid:mt}),e?null:(0,qe.jsx)(Te.TakeawayTakeover,{rid:mt,me:Lt})]});var hn}function rt({rid:e,id:t,turnBase:s}){const l=(0,te.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1319,[1051,779,805,806,1320,813,1321,1092,843,1138,1322,1323,1324,1089,1120,1325,1326,1331,1332,1200,1333,856,1338,1339,1340,1113,1111,920,1341,1150,891,1102,1342,17,1070,1176,1016,1085,1343,378,363,385,278,85,409,19,777,1216,1220,857,845,863,858,804,1088,876,1096,1055,996,1074,1107,1344,1106,1345,1352,1354,1357,1362,1356,1363,1366,1367,1115,1093,1094,862,1372,1205,1373,1215,1207,993,1378,1383,1384,1052,1050,1117,1386,1387,1388,1069,1169,1389,1168,1159,853,1334,1390,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},1322,[]); @@ -1420,7 +1420,7 @@ __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(t,c){return}},1337,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.displayActionBy=function(t){if(t.isCar)return'Car';if(t.isDisplayApp)return'Display';return(t.personName??'').trim()||'Duty Manager'}},1338,[]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"finishClearPatch",{enumerable:!0,get:function(){return s.finishClearPatch}}),Object.defineProperty(e,"DEFAULT_TURN_MINS",{enumerable:!0,get:function(){return a}}),e.bookingEndAt=u,e.isLeftEarly=o,e.todaysGuestList=function(t,n,s=a){return t.filter(t=>'confirmed'===t.status||'seated'===t.status||o(t,n,s)).sort((t,n)=>t.time.localeCompare(n.time))},e.todaysFinishedList=function(t,n,s=a){return t.filter(t=>'finished'===t.status&&!o(t,n,s)).sort((t,n)=>t.time.localeCompare(n.time))};var t=r(d[0]),n=r(d[1]),s=r(d[2]);const a=90;function u(s,u=a){if(!s.date||!s.time)return null;const o=(0,n.atTime)((0,n.parseYmd)(s.date),s.time),f=u>0?u:a,c=s.durationMins&&s.durationMins>=15?s.durationMins:(0,t.turnFor)(s.partySize??2,f);return new Date(o.getTime()+6e4*c)}function o(t,s,o=a){if('finished'!==t.status||!t.date||!t.time||!t.finishedAt)return!1;const f=(0,n.atTime)((0,n.parseYmd)(t.date),t.time);if(new Date(t.finishedAt).getTime()>=f.getTime())return!1;const c=u(t,o);return!!c&&(s??new Date).getTime()1?'are':'is'} free again`:'',"."]}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${$}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>I(t,e,{stage:void 0,dirty:!1})),j(!1)}}),(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${$} seated`,onPress:()=>j(!1)})]})]}):(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${$}: ${e.walkIn?'removes the walk-in':'back to booked'}${v?`, frees ${v}`:''}`,onPress:()=>j(!0)});const L='undo-finished'===x?'seated':'confirmed';return(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===x?`Undo finished: ${$} back to seated${v?` at ${v}`:''}`:`Undo no-show: ${$} back to booked`,onPress:async()=>{'undo-finished'!==x?await n.repo.bookings.setStatus(e.id,L):await(0,b.undoFinishedNow)(t,e)}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),h=r(d[7]),f=r(d[8]);function k(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1340,[17,85,858,996,777,804,1112,1111,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=k,_e.BookingUndo=function({b:e,rid:t,today:w,who:$,allowed:y=!0}){const[p,j]=(0,s.useState)(!1),x=k(e,w);if(!x||!y)return null;const U=(0,h.tableForUndo)(e),v=(0,l.tableCardLabel)(U),I=l.useFloor.getState().setLive;if('unseat'===x)return p?(0,f.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,f.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",$,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',v?` and ${v} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${$}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>I(t,e,{stage:void 0,dirty:!1})),j(!1)}}),(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${$} seated`,onPress:()=>j(!1)})]})]}):(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${$}: ${e.walkIn?'removes the walk-in':'back to booked'}${v?`, frees ${v}`:''}`,onPress:()=>j(!0)});const L='undo-finished'===x?'seated':'confirmed';return(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===x?`Undo finished: ${$} back to seated${v?` at ${v}`:''}`:`Undo no-show: ${$} back to booked`,onPress:async()=>{'undo-finished'!==x?await n.repo.bookings.setStatus(e.id,L):await(0,b.undoFinishedNow)(t,e)}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),h=r(d[7]),f=r(d[8]);function k(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1340,[17,85,858,996,777,804,1113,1111,8]); __d(function(g,r,i,a,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},1341,[813,812,17,219,385,278,85,777,1150,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])},1342,[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])},1343,[17,85,780,804,8]); @@ -1443,16 +1443,16 @@ __d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?global __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||'')}},1360,[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},1362,[17,831,928,899,1361]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=$,e.guestRowText=function(n,p){const l=n.partySize,b=Math.max(0,Math.min(l-1,Math.round(Number(n.children)||0))),f=`${l} ${1===l?'person':'people'}${b?` (${b} ${1===b?'child':'children'})`:''}`,h=(0,o.tablesOf)(n.table??void 0),c=h.length?`${p.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',w=p.leftEarly?"Left early"+(c?` \xb7 ${c}`:''):p.finished?"Finished"+(c?` \xb7 ${c}`:''):p.seated?"Seated"+(c?` \xb7 ${c}`:''):c||'No table yet',x=$(n),y=h.length?`table${h.length>1?'s':''} ${u(h.map(t.plainTableNumber))}`:p.finished?'finished':'no table yet',D=!!n.dog,m=(0,s.allergyLine)(n),k=(0,d.guestChangeLine)(n),v=[n.time,p.name,m?`allergy noted: ${m}`:'',f,p.leftEarly?'left early':p.finished?'finished':p.seated?'seated':'',x?.spoken??'',y,D?'dog':''].filter(Boolean).join(', ')+'.'+(k?` ${k}`:'');return{time:n.time,name:p.name,people:f,deposit:x?.text??null,depositWarn:!!x?.warn,table:w,dog:D,allergy:m,guestChange:k,a11y:v}};var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),s=r(_d[3]),d=r(_d[4]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,l=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 o=(0,n.depositBadge)(t,p);if(!o)return null;const s=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||d>0&&u>d&&!o.label.startsWith('Deposit paid')){const t=d||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${l(t).replace(' pounds','')} of ${l(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(o.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const $=o.label.match(/\xa3[\d.,]+/);if(o.label.startsWith('Deposit paid')){const t=/about/.test(o.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(o.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(o.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}}},1363,[843,841,996,1364,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}}},1363,[843,841,996,1364,1365]); __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])},1364,[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}},1365,[]); __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])},1366,[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'},1367,[1368,843,1093,996,17,85,777,1096,858,1113,1363,1094,863,1091,1114,1115,1116,804,1323,1370,1371,1112,1340,1111,8]); +__d(function(_g,r,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'},1367,[1368,843,1093,996,17,85,777,1096,858,1114,1363,1094,863,1091,1115,1116,1117,804,1323,1370,1371,1113,1340,1111,8]); __d(function(g,r,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])},1368,[17,362,385,85,858,920,876,994,1369,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')}`}},1369,[]); __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},1372,[1169,1368,813,1093,812,843,1138,1089,1114,863,17,1076,219,385,278,85,777,1096,1356,858,996,845,1087,1074,1301,804,1323,1370,1371,1112,1111,8]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"Card",{enumerable:!0,get:function(){return M}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const l=e.filter(e=>'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},1372,[1169,1368,813,1093,812,843,1138,1089,1115,863,17,1076,219,385,278,85,777,1096,1356,858,996,845,1087,1074,1301,804,1323,1370,1371,1113,1111,8]); __d(function(g,_r,_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.']}]},1373,[812,17,219,385,85,777,858,996,1374,804,1375,1377,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))},1374,[]); __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)}},1375,[831,858,996,1374,1376,1377]); @@ -1494,7 +1494,7 @@ __d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModu __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1411,[]); __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}},1412,[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]},1413,[17,85,777,804,914,1020,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])},1414,[805,1411,1093,1247,1415,812,822,1114,1115,1089,1119,1416,1120,1116,1386,1387,1055,1323,994,1117,1087,841,1365,1123,1418,1216,1419,1378,1076,1053,1088,17,85,777,1343,858,845,851,863,1301,804,1175,1096,1112,996,1340,1060,1159,1420,1207,899,1177,1383,862,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1414,[805,1411,1093,1247,1415,812,822,1115,1116,1089,1120,1416,1112,1117,1386,1387,1055,1323,994,1118,1087,841,1365,1123,1418,1216,1419,1378,1076,1053,1088,17,85,777,1343,858,845,851,863,1301,804,1175,1096,1113,996,1340,1060,1159,1420,1207,899,1177,1383,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])},1415,[806,17,85,777,899,1251,8]); __d(function(g,r,_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])},1416,[17,385,85,1417,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},1417,[]); @@ -1518,7 +1518,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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])},1435,[17,278,85,777,857,804,1436,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(' ')},1436,[]); __d(function(g,_r,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]})}},1437,[888,813,17,1067,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])},1438,[1176,1070,1114,1087,17,385,85,777,876,863,804,1088,1168,1165,1055,1117,1173,1425,1159,860,1177,853,1175,884,1340,996,843,1112,1190,1197,1069,8]); +__d(function(g,_r,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])},1438,[1176,1070,1115,1087,17,385,85,777,876,863,804,1088,1168,1165,1055,1118,1173,1425,1159,860,1177,853,1175,884,1340,996,843,1113,1190,1197,1069,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]})}},1439,[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(()=>{})},1440,[1441,899,778,1392,1443,993,13,1470,479,17,368,319,219,24,85,805,857,1063,856,1472,19,858,996,876,804,1433,920,986,1475,1476,1026,1102,880,1006,914,1477,1362,8,1478,1479,1480,1481]); __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.'}},1441,[880,812,17,219,366,85,777,1442,899,804,1179,920,876,909,8]); diff --git a/display-app/admin.html b/display-app/admin.html index d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 8fce23a70abd33de7ee0f2f5c0f70702630c9446..d02004d1841e5803b9d87fedad5257c5519c72aa 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 a9b7830f937bd322178250c5d219246fed9ce690..e2566e8d46d2043e85161db397c3e4520e14701e 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-8d7389e2f2"; +const V = "cc-display-04c1bd7ab9"; 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=8d7389e2f2cfbf2a9d3bc31c6bab7dd004b3564fe648906a13b28da6983a51be"]; +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=04c1bd7ab9c0daadc8ee9a7cab7aa4cb2ff3bf1280d054de7664c6809b8e41b4"]; // 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 d3a9c2dec6493d5782618aecc6a8f73bcfb38c87..b5135bc40bec06f16adfd87f652f7aca94986055 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 b0b132c34da65cb03e9eb784a4733c67d7c99373..754abbe5f0e5ad0474763be49b5a08618aab41f0 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ -Cover Charge: try the apps (v0.3.12.205) +Cover Charge: try the apps (v0.3.12.206) @@ -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.205)

+

Cover Charge: try the apps (v0.3.12.206)

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

+

Cover Charge v0.3.12.206

diff --git a/owner-app/_expo/static/js/web/bundle.js b/owner-app/_expo/static/js/web/bundle.js index dfa2f30cdf1e18fc9b54bee1df87373b40d3bf9d..725539289c059cdba36a0694726c238a75a22b86 100644 --- a/owner-app/_expo/static/js/web/bundle.js +++ b/owner-app/_expo/static/js/web/bundle.js @@ -1058,7 +1058,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.205'},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.206'},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 c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},979,[980,981,928,972,976]); __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]); @@ -1166,17 +1166,17 @@ __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,"useChatOpen",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)()(t=>({request:n=>t({ch:n})}))},1083,[831]); __d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},1084,[912,17,1010,876,816,913,927,1066,916,1065]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:u}){const h=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const f=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==u||'seated'!==s.status||s.date!==(0,c.venueYmd)(new Date)||!(0,l.hasAllergens)(s)||h.current.has(s.id))continue;const n=f.get(s.id);n&&'seated'!==n&&(h.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} Covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[u]),null},e.useKitchenTodoChime=function(t,c,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=c&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,u.soundAllowed)()&&(0,u.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} Covers \xb7 ${t.date===c?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6])},1085,[843,17,916,858,1053,863,1016]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:s,today:o,by:S,app:j}){const $=(0,n.useBookings)(s).filter(e=>e.date===o&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),w=$.reduce((e,t)=>e+(t.diet?.vegan??0),0),T=$.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,x.jsxs)(a.default,{style:{gap:12},testID:"todays-bookings",children:[(0,x.jsx)(p.CoversToday,{rid:s}),(0,x.jsx)(b.PlattersBooked,{rid:s,date:o,label:"Platters booked today"}),w||T?(0,x.jsxs)(l.T,{colour:h.colours.ok,children:["\u24cb ",w?`${w} vegan`:'',w&&T?' \xb7 ':'',T?`${T} vegetarian`:''," today"]}):null,(0,x.jsx)(b.KitchenSignoffs,{rid:s,today:o,by:S,app:j,showAll:!0}),$.length?$.map(o=>(0,x.jsxs)(a.default,{testID:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?`kitchen-seated-${o.id}`:`kitchen-booking-${o.id}`,style:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?{gap:6,padding:14,borderRadius:16,...(0,c.seatedHighlightStyle)()}:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface,opacity:'finished'===o.status?.55:1},children:[(0,x.jsxs)(l.T,{weight:"semibold",colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,accessibilityLabel:`${o.time}, ${o.walkIn?`Walk-in ${o.ref}`:o.name}, ${o.partySize} Covers${o.table?`, ${(0,e.tableNumbersA11y)(o.table)}`:''}`,children:[o.time," \xb7 ",o.walkIn?`Walk-in ${o.ref}`:o.name," \xb7 ",o.partySize," Covers",o.table?` \xb7 ${(0,e.tableNumbers)(o.table)}`:'']}),(0,x.jsx)(t.DepositChip,{b:o,money:!0,testID:`kitchen-deposit-${o.id}`}),(0,x.jsx)(k.BookingTableButton,{rid:s,booking:o,readOnly:'chef'===j}),'chef'!==j&&o.walkIn?(0,x.jsx)(y.CancelWalkInButton,{rid:s,b:o,small:!0}):null,o.notes?(0,x.jsxs)(l.T,{size:16,colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,testID:`kitchen-notes-${o.id}`,children:["Notes: ",o.notes]}):null,(0,x.jsx)(f.BookingEditButton,{rid:s,booking:o,who:S,inStaffApp:'staff'===j}),(0,x.jsx)(b.BookingNeeds,{b:o}),'seated'===(0,u.shownStatus)(o)?(0,x.jsx)(l.T,{weight:"semibold",colour:c.SEATED_FG,children:"Seated"}):'finished'===o.status?(0,x.jsx)(l.Muted,{children:"Finished"}):null]},o.id)):(0,x.jsx)(l.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var s,o=r(d[3]),a=(s=o)&&s.__esModule?s:{default:s},l=r(d[4]),n=r(d[5]),u=r(d[6]),h=r(d[7]),c=r(d[8]),b=r(d[9]),k=r(d[10]),y=r(d[11]),f=r(d[12]),p=r(d[13]),x=r(d[14])},1086,[843,1087,17,85,777,858,1053,804,1088,1076,1089,1114,1119,1070,8]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:s,today:o,by:S,app:j}){const $=(0,n.useBookings)(s).filter(e=>e.date===o&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),w=$.reduce((e,t)=>e+(t.diet?.vegan??0),0),T=$.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,x.jsxs)(a.default,{style:{gap:12},testID:"todays-bookings",children:[(0,x.jsx)(p.CoversToday,{rid:s}),(0,x.jsx)(b.PlattersBooked,{rid:s,date:o,label:"Platters booked today"}),w||T?(0,x.jsxs)(l.T,{colour:h.colours.ok,children:["\u24cb ",w?`${w} vegan`:'',w&&T?' \xb7 ':'',T?`${T} vegetarian`:''," today"]}):null,(0,x.jsx)(b.KitchenSignoffs,{rid:s,today:o,by:S,app:j,showAll:!0}),$.length?$.map(o=>(0,x.jsxs)(a.default,{testID:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?`kitchen-seated-${o.id}`:`kitchen-booking-${o.id}`,style:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?{gap:6,padding:14,borderRadius:16,...(0,c.seatedHighlightStyle)()}:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface,opacity:'finished'===o.status?.55:1},children:[(0,x.jsxs)(l.T,{weight:"semibold",colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,accessibilityLabel:`${o.time}, ${o.walkIn?`Walk-in ${o.ref}`:o.name}, ${o.partySize} Covers${o.table?`, ${(0,e.tableNumbersA11y)(o.table)}`:''}`,children:[o.time," \xb7 ",o.walkIn?`Walk-in ${o.ref}`:o.name," \xb7 ",o.partySize," Covers",o.table?` \xb7 ${(0,e.tableNumbers)(o.table)}`:'']}),(0,x.jsx)(t.DepositChip,{b:o,money:!0,testID:`kitchen-deposit-${o.id}`}),(0,x.jsx)(k.BookingTableButton,{rid:s,booking:o,readOnly:'chef'===j}),'chef'!==j&&o.walkIn?(0,x.jsx)(y.CancelWalkInButton,{rid:s,b:o,small:!0}):null,o.notes?(0,x.jsxs)(l.T,{size:16,colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,testID:`kitchen-notes-${o.id}`,children:["Notes: ",o.notes]}):null,(0,x.jsx)(f.BookingEditButton,{rid:s,booking:o,who:S,inStaffApp:'staff'===j}),(0,x.jsx)(b.BookingNeeds,{b:o}),'seated'===(0,u.shownStatus)(o)?(0,x.jsx)(l.T,{weight:"semibold",colour:c.SEATED_FG,children:"Seated"}):'finished'===o.status?(0,x.jsx)(l.Muted,{children:"Finished"}):null]},o.id)):(0,x.jsx)(l.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var s,o=r(d[3]),a=(s=o)&&s.__esModule?s:{default:s},l=r(d[4]),n=r(d[5]),u=r(d[6]),h=r(d[7]),c=r(d[8]),b=r(d[9]),k=r(d[10]),y=r(d[11]),f=r(d[12]),p=r(d[13]),x=r(d[14])},1086,[843,1087,17,85,777,858,1053,804,1088,1076,1089,1115,1120,1070,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DepositChip=function({b:e,money:o,big:n,testID:b}){const f=(0,s.depositView)(e,o);if(!f)return null;const h={gold:[t.colours.goldTint,t.colours.goldLight,t.colours.gold],amber:[t.colours.amberBg,'#FFE2A8',t.colours.amber],red:[t.colours.redBg,'#FFD9D4',t.colours.red],neutral:[t.colours.surface2,t.colours.muted,t.colours.border]}[f.kind];return(0,u.jsxs)(l.default,{accessible:!0,accessibilityRole:"text",accessibilityLabel:f.a11y,testID:b??'deposit-chip',style:{alignSelf:'flex-start',maxWidth:'100%'},children:[(0,u.jsx)(l.default,{style:{backgroundColor:h[0],borderColor:h[2],borderWidth:n?2:1,borderRadius:8,paddingHorizontal:n?12:8,paddingVertical:n?6:3},children:(0,u.jsx)(c.T,{size:16,weight:"semibold",colour:h[1],children:f.label})}),f.note?(0,u.jsx)(c.Muted,{size:12,children:f.note}):null]})},r(d[0]);var e,o=r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),c=r(d[4]),u=r(d[5])},1087,[17,85,841,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEATED_BG",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SEATED_FG",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEATED_MUTED",{enumerable:!0,get:function(){return u}}),e.isSeatedHighlight=function(t,o){return'seated'===t&&!o?.otherDay},e.seatedHighlightStyle=function(u){return{backgroundColor:o,borderColor:t.colours.goldLight,borderWidth:1.5,borderLeftWidth:8,borderLeftColor:n,...u}};var t=r(d[0]);const o=t.colours.gold,n=t.colours.onGold,u='#3F3218'},1088,[804]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f,canClear:h=!0}){const[j,k]=(0,t.useState)(!1),x=(0,s.tableButtonLabel)(l.table),_=f??`table-btn-${l.id}`;if(y)return(0,b.jsx)(n.default,{testID:_,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,b.jsx)(u.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:x})});return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u.Button,{kind:"secondary",label:x,testID:_,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>k(!0),style:{minHeight:44}}),j?(0,b.jsx)(c.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>k(!1),canClear:h}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6])},1089,[17,85,1090,804,1091,777,8]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const u={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(u)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(u,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}}),e.splitChoices=function(t){const n=String(t??'').split('+').map(t=>t.trim()).filter(Boolean);return n.length>1?[...new Set(n)]:[]};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1090,[843,1074]); -__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,t,s){const l=(0,p.tableKey)(s);if('finished'===t.status&&l)return void await(0,j.restoreFinishedToTable)(e,t,s);const o=(0,g.tablesOf)(t.table);await h.repo.bookings.update(t.id,(0,y.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(t=>g.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,m.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:m=90,onClose:T,onSaved:S,onPickOnPlan:L,canClear:P=!0}){const W=(0,g.usePlan)(e),z=(0,h.useBookings)(e),[D,I]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),R=(0,l.useMemo)(()=>(0,p.pickGroups)(W),[W]),B=z.filter(e=>e.date===y.date),O=(0,p.seatsOf)(W,D),N=(0,p.seatLine)(O.total,y.partySize),F=(0,p.pickClashes)(y,D,B,m),M=e=>(0,p.pickClashes)(y,[e],B,m)[0]?.with,Y=(0,p.tableKey)(D)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,C.useBlocks)(e=>e.blocks),A=(0,C.blockAt)(_,e,y.date,y.time),[G,K]=(0,l.useState)(null),E=e=>{K(null),I(t=>(0,p.toggleTable)(t,e))},[H]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{H&&(0,c.announce)(`Tables can't be saved: ${H}.`)},[H]);const[U,V]=(0,l.useState)(!1),[q,J]=(0,l.useState)(!1),Q=async t=>{(0,o.guardBookingChange)(S,{b:y,tables:t})?(V(!0),T(),await(0,o.saveTablesReported)(e,y,t,f,(0,p.seatsOf)(W,t).total,e=>S?.(e))):T()},X=(0,w.jsxs)(u.default,{style:{gap:8},children:[(0,w.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(D)} picked. ${N.text}.`,children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(D)}),(0,w.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:N.text})]}),A?(0,w.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,w.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,F.length?(0,w.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(F)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,w.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(F)," You can still save."]})}):null,q?(0,w.jsx)(j.RestoreSeatedConfirm,{prompt:(0,v.restoreSeatedPrompt)(f,(0,p.tableKey)(D)),onYes:()=>{J(!1),Q(D)},onNo:()=>J(!1)}):null,G?(0,w.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:G,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,w.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:G}),(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(D)} for ${f}, ${y.partySize} people`,disabled:U,onPress:()=>{Q(D)},style:[$,{flexGrow:1}]}),(0,w.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>K(null),style:$})]})]}):null,(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[G?null:(0,w.jsx)(x.Button,{testID:"table-pick-save",label:U?'Saving\u2026':F.length?'Save anyway':'Save tables',disabled:!Y||!D.length||U,accessibilityLabel:`${F.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(D)} for ${f}. ${N.text}.${F.length?` ${(0,p.clashWords)(F)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(S,{b:y,tables:D}))return void T();const e=(0,p.overCapacityAsk)(D,O.total,y.partySize);!e||G?'finished'!==y.status||!D.length||q?Q(D):J(!0):K(e)},style:[$,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&P?(0,w.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:U,onPress:()=>Q([]),style:$}):null,(0,w.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:T,style:$})]})]});return(0,w.jsxs)(x.Sheet,{visible:!0,onClose:T,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:X,children:[(0,w.jsx)(t.TableNumberWarning,{plan:W}),H?(0,w.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${H}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,w.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${H}.`})}):null,(0,w.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),L?(0,w.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>L(D),style:$}):null,R.map(e=>(0,w.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,w.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,w.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=D.includes(e.name),l=M(e.name);return(0,w.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,t,l),onPress:()=>E(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",colour:t?k.colours.onGold:k.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,w.jsxs)(x.T,{size:14,colour:t?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),R.length?null:(0,w.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),m=r(d[15]),j=r(d[16]),v=r(d[17]),C=r(d[18]),w=r(d[19]);const $={minHeight:56}},1091,[1092,843,17,1093,899,1095,385,85,858,996,1090,1094,804,863,777,1096,1112,1111,993,8]); +__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,t,s){const l=(0,p.tableKey)(s);if('finished'===t.status&&l)return void await(0,j.restoreFinishedToTable)(e,t,s);const o=(0,g.tablesOf)(t.table);await h.repo.bookings.update(t.id,(0,y.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(t=>g.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,m.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:m=90,onClose:T,onSaved:S,onPickOnPlan:L,canClear:P=!0}){const W=(0,g.usePlan)(e),z=(0,h.useBookings)(e),[D,I]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),R=(0,l.useMemo)(()=>(0,p.pickGroups)(W),[W]),B=z.filter(e=>e.date===y.date),O=(0,p.seatsOf)(W,D),N=(0,p.seatLine)(O.total,y.partySize),F=(0,p.pickClashes)(y,D,B,m),M=e=>(0,p.pickClashes)(y,[e],B,m)[0]?.with,Y=(0,p.tableKey)(D)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,C.useBlocks)(e=>e.blocks),A=(0,C.blockAt)(_,e,y.date,y.time),[G,K]=(0,l.useState)(null),E=e=>{K(null),I(t=>(0,p.toggleTable)(t,e))},[H]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{H&&(0,c.announce)(`Tables can't be saved: ${H}.`)},[H]);const[U,V]=(0,l.useState)(!1),[q,J]=(0,l.useState)(!1),Q=async t=>{(0,o.guardBookingChange)(S,{b:y,tables:t})?(V(!0),T(),await(0,o.saveTablesReported)(e,y,t,f,(0,p.seatsOf)(W,t).total,e=>S?.(e))):T()},X=(0,w.jsxs)(u.default,{style:{gap:8},children:[(0,w.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(D)} picked. ${N.text}.`,children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(D)}),(0,w.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:N.text})]}),A?(0,w.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,w.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,F.length?(0,w.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(F)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,w.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(F)," You can still save."]})}):null,q?(0,w.jsx)(j.RestoreSeatedConfirm,{prompt:(0,v.restoreSeatedPrompt)(f,(0,p.tableKey)(D)),onYes:()=>{J(!1),Q(D)},onNo:()=>J(!1)}):null,G?(0,w.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:G,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,w.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:G}),(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(D)} for ${f}, ${y.partySize} people`,disabled:U,onPress:()=>{Q(D)},style:[$,{flexGrow:1}]}),(0,w.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>K(null),style:$})]})]}):null,(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[G?null:(0,w.jsx)(x.Button,{testID:"table-pick-save",label:U?'Saving\u2026':F.length?'Save anyway':'Save tables',disabled:!Y||!D.length||U,accessibilityLabel:`${F.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(D)} for ${f}. ${N.text}.${F.length?` ${(0,p.clashWords)(F)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(S,{b:y,tables:D}))return void T();const e=(0,p.overCapacityAsk)(D,O.total,y.partySize);!e||G?'finished'!==y.status||!D.length||q?Q(D):J(!0):K(e)},style:[$,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&P?(0,w.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:U,onPress:()=>Q([]),style:$}):null,(0,w.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:T,style:$})]})]});return(0,w.jsxs)(x.Sheet,{visible:!0,onClose:T,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:X,children:[(0,w.jsx)(t.TableNumberWarning,{plan:W}),H?(0,w.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${H}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,w.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${H}.`})}):null,(0,w.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),L?(0,w.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>L(D),style:$}):null,R.map(e=>(0,w.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,w.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,w.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=D.includes(e.name),l=M(e.name);return(0,w.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,t,l),onPress:()=>E(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",colour:t?k.colours.onGold:k.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,w.jsxs)(x.T,{size:14,colour:t?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),R.length?null:(0,w.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),m=r(d[15]),j=r(d[16]),v=r(d[17]),C=r(d[18]),w=r(d[19]);const $={minHeight:56}},1091,[1092,843,17,1093,899,1095,385,85,858,996,1090,1094,804,863,777,1096,1113,1111,993,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},1092,[17,842,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.guardBookingChange=w,_e.saveTablesReported=async function(e,t,n,o,s,u){if(!w(u,{b:t,tables:n}))return!1;const v=n.length?(0,h.notSavedWhat)({...t,name:o,table:n.join('+')}):`Taking the table off ${o}`;u(`Saving ${v}\u2026`);try{await(0,b.saveBookingTables)(e,t,n)}catch(e){const t=`${v} did not save: ${String(e?.message??e).slice(0,120)}`;return u(t),(0,l.announce)(t),!1}const y=await(0,c.waitForBookingSave)(t.id);if('saved'===y.state||'local'===y.state){const e=(0,r.savedWords)(o,t.partySize,n,s);return u(e),(0,l.announce)(e),!0}const k='waiting'===y.state?`${v}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${v} did not save. ${f("why"in y?y.why:"the shared system did not take it")}. Tap the red banner to try again.`;return u(k),(0,l.announce)(k),!1},_e.reportBookingSave=async function(e,t,n,o){const s=await(0,c.waitForBookingSave)(e);if('saved'===s.state||'local'===s.state)return o(t),(0,l.announce)(t),!0;const r='waiting'===s.state?`${n}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${n} did not save. ${f('why'in s?s.why:'the shared system did not take it')}. Tap the red banner to try again.`;return o(r),(0,l.announce)(r),!1},_e.BookingSaveBanner=function({rid:e,testID:r="booking-save-banner",margin:c}){const b=(0,h.useBookingSaves)(e=>e.notSaved),w=(0,s.useBookings)(e).filter(e=>b[e.id]).map(e=>void 0!==b[e.id].want?{...e,table:b[e.id].want||void 0}:e),{msg:S,retry:$}=k(),m=(0,t.useRef)(''),p=w.map(e=>(0,h.notSavedLine)(e)),B=w.map(e=>e.id).sort().join(',');if((0,t.useEffect)(()=>{B&&B!==m.current&&(0,l.announce)(1===w.length?p[0]:`${w.length} booking changes did not save. Tap the red banner to try again.`),m.current=B},[B]),!w.length)return null;const j=1===w.length?p[0]:`${w.length} booking changes did not save. Tap to try again.`;return(0,y.jsx)(n.default,{testID:r,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${j}${w.length>1?` ${w.map(e=>(0,h.notSavedWhat)(e)).join('. ')}.`:''} ${f(b[w[0].id].why)}.`,onPress:$,style:{...c??{},alignSelf:'stretch',gap:4,padding:12,borderRadius:12,borderWidth:2,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:(0,y.jsxs)(o.default,{accessibilityRole:"alert",style:{alignItems:'center',gap:4},children:[(0,y.jsx)(v.T,{testID:`${r}-title`,size:17,weight:"semibold",center:!0,colour:"#FFD2CC",children:j}),w.length>1?w.slice(0,6).map(e=>(0,y.jsx)(v.T,{testID:`${r}-line`,size:15,center:!0,colour:"#FFD2CC",children:(0,h.notSavedWhat)(e)},e.id)):null,(0,y.jsx)(v.T,{testID:`${r}-why`,size:14,center:!0,colour:"#FFB3AA",children:w.length>1?`${f(b[w[0].id].why)}${w.length>6?` \xb7 and ${w.length-6} more`:''}`:f(b[w[0].id].why)}),S?(0,y.jsx)(v.T,{testID:`${r}-msg`,size:14,center:!0,colour:u.colours.goldLight,children:S}):null]})})},_e.BookingNotSavedLine=function({b:e}){const t=(0,h.useBookingSaves)(t=>t.notSaved[e.id]),{msg:o,retry:s}=k();if(!t)return null;void 0!==t.want&&(e={...e,table:t.want||void 0});return(0,y.jsxs)(n.default,{testID:`booking-not-saved-${e.id}`,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${(0,h.notSavedLine)(e)} ${f(t.why)}.`,onPress:s,style:{alignSelf:'stretch',padding:8,borderRadius:10,borderWidth:1.5,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:[(0,y.jsx)(v.T,{size:15,weight:"semibold",center:!0,colour:"#FFD2CC",children:(0,h.notSavedLine)(e)}),o?(0,y.jsx)(v.T,{size:13,center:!0,colour:u.colours.goldLight,children:o}):null]})};var t=_r(d[0]),n=e(_r(d[1])),o=e(_r(d[2])),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),b=_r(d[9]),v=_r(d[10]),y=_r(d[11]);const f=e=>e.charAt(0).toUpperCase()+e.slice(1);function w(e,t){const n=(0,c.bookingSaveBlocker)();if(!n)return!0;t&&h.useBookingSaves.getState().mark({id:t.b.id,table:t.b.walkIn?'walk_ins':'bookings',why:n,...t.tables?{want:t.tables.join('+')}:{}});const o=`${t?(0,h.notSavedWhat)({...t.b,...t.tables?{table:t.tables.join('+')||void 0}:{}}):'This change'} did not save: ${n}.`;return e?.(o),(0,l.announce)(o),!1}function k(){const[e,n]=(0,t.useState)('');return{msg:e,retry:async()=>{n('Saving\u2026'),(0,l.announce)('Saving');const e=await(0,c.saveBookingsNow)(!0),t=e?`Not saved: ${e}.`:h.useBookingSaves.getState().count()?'Sent again. The banner clears when the shared system takes it.':'Nothing is left waiting. Check the plan and make the change again if it is not there.';n(t),(0,l.announce)(t)}}}},1093,[17,385,85,858,1094,1095,899,983,804,1091,777,8]); __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=u,e.requestedFreeTable=function(t,n,a,s,l=90){const o={id:n.id??'new',status:'confirmed',...n};for(const n of t)if(a.includes(n)&&!u(o,[n],s,l).length)return n;return null},e.overCapacityAsk=function(n,s,l){const u=a(o(n));if(!u.length||s>=l)return null;const c=u.map(n=>(0,t.tableNumbers)(n));return`${1===c.length?`Table ${c[0]} seats`:`Tables ${c.slice(0,-1).join(', ')} and ${c[c.length-1]} seat`} ${s} \u2013 this booking is ${l}. Use it anyway?`},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=c,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${c(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${c(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${c(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))}function c(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1094,[843,1074]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.primeAnnouncer=function(){u()},_e.announce=function(t){const e=String(t??'').trim();if(!e)return;{const t=u();if(!t)return;const n=++o;return t.textContent='',void setTimeout(()=>{n===o&&(t.textContent=e)},80)}},Object.defineProperty(_e,"lastAnnounced",{enumerable:!0,get:function(){return c}});var t,e=r(d[0]);(t=e)&&t.__esModule;r(d[1]);let n=null,o=0;function u(){if('undefined'==typeof document||!document.body)return null;if(n&&document.body.contains(n))return n;const t=document.createElement('div');return t.id='cc-announcer',t.setAttribute('aria-live','assertive'),t.setAttribute('aria-atomic','true'),t.setAttribute('role','status'),t.setAttribute('data-testid','cc-announcer'),Object.assign(t.style,{position:'absolute',width:'1px',height:'1px',margin:'-1px',padding:'0',overflow:'hidden',clip:'rect(0 0 0 0)',whiteSpace:'nowrap',border:'0'}),document.body.appendChild(t),n=t,t}const c=()=>n?.textContent??''},1095,[264,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,"TABLES",{enumerable:!0,get:function(){return A}}),_e.useTableNames=R,_e.resetTableLive=W,_e.seatBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'seated'),W(e,t.table)},_e.finishBookingNow=async function(e,t){const s=(new Date).toISOString();await k.repo.bookings.update(t.id,(0,N.finishClearPatch)(s,t.table)),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=E,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return _}}),_e.TablePicker=H,_e.WalkInSheet=q,_e.AssignTableSheet=G,_e.undoNotice=Y,_e.NewBookingSheet=V,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[n,i]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>i({b:e}),combineTables:e=>i({b:e,combine:!0}),elements:(0,L.jsxs)(L.Fragment,{children:[s?(0,L.jsx)(q,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,L.jsx)(V,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,L.jsx)(G,{booking:n.b,combine:n.combine,onClose:()=>i(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),z=_r(_d[29]),B=_r(_d[30]),M=_r(_d[31]),N=_r(_d[32]),L=_r(_d[33]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),A=Array.from({length:12},(e,t)=>String(t+1));function R(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function W(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function E(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=R(e),a=(0,v.useFloor)(t=>t.live[e])??{},n=(0,v.usePlan)(e),i=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(i,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const _=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function H({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=n?6:8,f=n?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(i??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,L.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],i=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!i,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,L.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:i?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,L.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,L.jsx)(C.T,{weight:"bold",size:22,colour:i?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,L.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,L.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,L.jsx)(C.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const U=[1,2,3,4,5,6,7,8];function q({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:r,r:d,now:u}=(0,y.useCtx)(15e3),x=E(r,u),[T,I]=(0,c.useState)(2),[P,$]=(0,c.useState)(!1),[O,z]=(0,c.useState)(i??null),B=(0,v.usePlan)(r),N=(0,k.useBookings)(r),A=(0,D.useBlocks)(e=>e.blocks),R=(0,D.closedAreasAt)(A,r,(0,w.ymd)(u),(0,w.hm)(u)),_=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(x).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(B,N.filter(e=>e.date===(0,w.ymd)(u)),e,T,u,(0,j.turnFor)(T,d.settings.turnMins),90,void 0,{closed:R})?.table??null},[B,N,x,T,R.size,u.getTime()]);(0,c.useEffect)(()=>{O&&(0,v.tablesOf)(O).some(e=>'Closed'===x[e]?.label)&&z(null)},[O,R.size]);const[q,G]=(0,c.useState)(!1),[Y,V]=(0,c.useState)(''),K=(e,t=String(e),s=()=>{$(!1),I(e)})=>{const o='9+'===t?P:!P&&T===e;return(0,L.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,L.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},Q=(0,L.jsx)(s.PartySizeInput,{value:T,onChange:I,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),X=(0,L.jsxs)(m.default,{style:{gap:8,width:n?256:void 0},children:[(0,L.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,L.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[U.map(e=>K(e)),K(9,'9+',()=>{$(!0),I(e=>e>=9?e:9)})]}),P?Q:null]}),[J,Z]=(0,c.useState)(!1),ee=async(t=O)=>{if(!J&&(0,M.guardBookingChange)(F)){Z(!0);try{const s=await k.repo.bookings.seatWalkIn(r,T,t??void 0,Y);W(r,t??void 0),a(s),e()}finally{Z(!1)}}},te=(0,L.jsxs)(m.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,L.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,L.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),O?(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>z(null)}):null]}),(0,L.jsx)(H,{use:x,value:O,onPick:e=>{x[e]&&!x[e].busy?ee(e):z(O===e?null:e)},big:n,dense:n,best:_,bestSet:(0,h.bestTables)(B)}),(0,L.jsxs)(C.Muted,{children:["Tap a free table to seat them there",_&&!O?` (suggested for ${T}: ${(0,l.tableNumbers)(_)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(u)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,L.jsx)(C.Button,{label:`Seat walk-in \xb7 ${T} ${1===T?'person':'people'}${O?` \xb7 ${(0,l.tableNumbers)(O)}`:''}`,disabled:J,onPress:()=>{ee()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,L.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[X,te]}):(0,L.jsxs)(L.Fragment,{children:[X,te]}),(0,L.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[q?(0,L.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:Y,onChangeText:V,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,L.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,L.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function G({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,y.useCtx)(15e3),i=E(o,n),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(n)),t,e.partySize,n,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,n.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),P=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,$=D.reduce((e,t)=>e+P(t),0),O=D.length>0&&${if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&W(o,l),t()},B=x?(0,L.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,L.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,L.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${$} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,L.jsx)(m.default,{testID:"combine-short",children:(0,L.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-$," more needed. Add another table."]})}):null,(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,L.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,L.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,L.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,L.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${_(e)}`,testID:"assign-table-sheet",footer:B,children:[f&&!x?(0,L.jsx)(m.default,{testID:"assign-suggested",children:(0,L.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,L.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,L.jsx)(H,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function Y(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${_(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function V({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:N}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const A=(0,w.ymd)(p),[R,W]=(0,c.useState)(ee.blocks),[H,U]=(0,c.useState)(!1),[q,G]=(0,c.useState)(''),[Y,V]=(0,c.useState)(2),[K,Q]=(0,c.useState)(0),X=Math.min(K,Math.max(0,Y-1)),[J,Z]=(0,c.useState)(null),[ee,te]=(0,c.useState)(''),[se,oe]=(0,c.useState)(''),[le,ae]=(0,c.useState)(''),[ne,ie]=(0,c.useState)(!1),[re,de]=(0,c.useState)('phone'),[ue,ce]=(0,c.useState)((0,P.emptyNeeds)()),be=(0,P.needsMissing)(ue),[ge,he]=(0,c.useState)(null),pe=(0,v.usePlan)(b),me=(0,O.dogSetUp)(pe),fe=!0===ue.dog&&me,ye=ue.dog?ue.dogs:0,ke=(0,w.parseYmd)(R),xe=(0,j.turnFor)(Y,h.settings.turnMins),je=E.filter(e=>e.date===R),we=e=>(0,j.dogTablesAt)(pe,je,Y,(0,j.slotStart)(R,e),xe,h.settings.turnMins,(0,D.closedAreasAt)(_,b,R,e)),Se=fe&&J?we(J):[];(0,c.useEffect)(()=>{he(null)},[fe,J,Y]);const Te=(0,x.bookingSlots)(h,ke,e=>E.filter(t=>t.date===R&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Y,R===(0,w.ymd)(p)?p:(0,w.addMins)(ke,0),e=>E.filter(t=>t.date===R&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),Ce=(0,T.guestPhone)(se),[ve,De]=(0,c.useState)(!1),Ie=J?Te.find(e=>e.time===J):void 0,Pe=Ie&&Ie.left=2&&!!J&&(!Oe||ve)&&(0,o.validParty)(Y)&&Ce.ok&&(0,T.emailOk)(le)&&(!ze||Be&&H)&&(!fe||Se.length>0)&&!Me,Le=ue.wheelchair>0||ue.stepFree,Fe=(0,$.bookingRulesOf)(h),Ae=(0,$.largeGroupTables)(Fe,Y),Re=(0,$.dogPartyCheck)(Fe,Y,!0===ue.dog,ue.assistDog),We=(0,$.bookingDepositSplit)((0,n.depositOf)(h.settings),Y,X,(0,P.needsPatch)(ue),(0,O.reservablesOf)(h));return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(ke)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,L.jsx)(P.FirstQuestions,{rid:b,value:ue,onChange:ce,party:Y,audience:"staff"}),ue.dog&&!me?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,L.jsx)(I.BookingDatePicker,{r:h,today:p,value:R,onChange:e=>{e!==R&&(W(e),Z(null),U(!1))}}),(0,L.jsxs)(C.Row,{gap:6,children:[(0,L.jsx)(C.Chip,{label:"Phone",selected:'phone'===re,onPress:()=>de('phone')}),(0,L.jsx)(C.Chip,{label:"In person",selected:'in-person'===re,onPress:()=>de('in-person')})]}),(0,L.jsx)(C.Field,{label:"Name",value:q,onChangeText:G,placeholder:"e.g. Reid",testID:"nb-name"}),(0,L.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:se,onChangeText:oe,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!Ce.ok&&se?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:Ce.error}):null,(0,L.jsx)(C.Field,{label:"Email (optional)",value:le,onChangeText:ae,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email",testID:"nb-email"}),(0,T.emailOk)(le)?null:(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),le.trim()&&Fe.marketingOptIn?(0,L.jsx)(C.Toggle,{label:Fe.marketingWords,value:ne,onChange:ie,testID:"nb-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,L.jsx)(i.AdultsChildren,{value:(0,r.peopleOf)(Y,X),onChange:e=>{V(e.partySize),Q(e.children),De(!1)},depositsOn:(0,n.depositOf)(h.settings).on&&(0,n.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:Te.map(e=>{const t=fe&&e.available&&!we(e.time).length||!(0,P.dogTimeOk)(h,E,R,e.time,ye);return(0,L.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(_,b,R,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:J===e.time,onPress:()=>{Z(e.time),U(!1),De(!1)}},e.time)})}),Oe?(0,L.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[Pe?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Y,Pe.left,Pe.time)}):null,$e?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)($e.time,$e.cap)}):null,(0,L.jsx)(C.Chip,{label:ve?'Booking over the limit: on':'Book anyway (over the limit)',selected:ve,onPress:()=>De(e=>!e),testID:"nb-over-ok"})]}):null,fe&&J?(0,L.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,L.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,L.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",pe.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),Se.length?pe.areas.filter(e=>Se.some(t=>t.area===e.name)).map(e=>(0,L.jsxs)(m.default,{style:{gap:6},accessibilityLabel:e.name,children:[(0,L.jsxs)(C.T,{size:13,center:!0,colour:S.colours.muted,children:[e.name,e.outdoor?' (outdoor)':'']}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:Se.filter(t=>t.area===e.name).map(e=>{const t=Se[0]?.table===e.table;return(0,L.jsx)(C.Chip,{testID:`nb-dog-table-${(0,l.tableNumbers)(e.table)}`,label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.seats} seats${t?' \xb7 best':''}${Le&&(0,O.accessibleSetUp)(pe)&&!(0,O.isAccessible)(pe,e.table)?' \xb7 not step-free':''}`,selected:(ge??Se[0].table)===e.table,onPress:()=>he(e.table)},e.table)})})]},e.id)):(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Y," at ",J,". Try another time."]})]}):null,ze?(0,L.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,L.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",ze.from,"\u2013",ze.to,ze.reason?` (${ze.reason})`:'']}),Be?(0,L.jsx)(C.Chip,{label:H?'Manager override on':'Override and book anyway',selected:H,onPress:()=>U(e=>!e)}):(0,L.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,Te.length?null:(0,L.jsx)(m.default,{testID:"nb-closed",children:(0,L.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(ke)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,L.jsx)(P.MoreQuestions,{rid:b,r:h,value:ue,onChange:ce,party:Y,date:R,time:J,today:(0,w.ymd)(p),bookings:E,audience:"staff",showTables:!1!==h.settings.tableRequests}),Le&&!(0,O.accessibleSetUp)(pe)?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,Ae&&!fe?(0,L.jsxs)(C.T,{size:14,colour:S.colours.goldLight,testID:"nb-large-group",children:["Large group: tables ",Ae.join(' + ')," joined."]}):null,Re.ok?null:(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,testID:"nb-dog-cap",children:["Online, a dog booking is for up to ",Fe.dogMaxParty," people. You can still book it here: check where they can sit."]}),(0,L.jsx)(C.Field,{label:"Notes (optional)",value:ee,onChangeText:te,placeholder:Fe.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"nb-notes"}),We.preorders?(0,L.jsxs)(C.Muted,{testID:"nb-preorder-deposit",children:["Pre-order deposit: ",(0,a.gbp)(We.preorders),We.adults?`, plus the group deposit: ${(0,a.gbp)(We.total)} in total`:'',". Staff can waive it."]}):null,(0,n.depositDue)((0,n.depositOf)(h.settings),Y,X)?(0,L.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(h.settings),Y,X))," (",(0,a.gbp)((0,n.depositOf)(h.settings).perPersonPence)," per adult for tables of ",(0,n.depositOf)(h.settings).fromParty,"+ adults",X?`; ${X} ${1===X?'child':'children'} free`:'; children free, and they do not count towards the number that needs a deposit',"). Staff can waive it. Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,L.jsx)(C.Muted,{children:"CoverCharge confirms the guest by email automatically (preview mode: shown in the Outbox, not sent)."}),Me?(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",J,". Try another time: dogs are very welcome then."]}):null,(0,L.jsx)(C.Button,{label:be.length?be[0]:'Save booking',testID:"nb-save",disabled:!Ne,onPress:()=>{if(R<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,P.needsPatch)(ue),s=ue.tableReq.find(e=>!fe||Se.some(t=>t.table===e)),o=fe?null:(0,B.requestedFreeTable)(ue.tableReq,{date:R,time:J,partySize:Y},pe.tables.map(e=>e.name),je,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:q.trim(),partySize:Y,date:R,time:J,notes:ee.trim(),security:We.total?'deposit':'none',depositPaid:0,...X?{children:X}:{},...We.total?{...(0,$.depositFields)(We),depositPolicy:(0,n.depositWords)((0,n.depositOf)(h.settings),Y,h.name,X).join(' '),depositRefundable:(0,n.depositOf)(h.settings).refundable,depositCutoffHours:(0,n.depositOf)(h.settings).cutoffHours}:{},phone:Ce.pretty,email:le.trim()||void 0,...ne?(0,$.marketingChoice)(le,!0):{},source:re,...e,...Te.find(e=>e.time===J)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...fe?{table:ge??s??Se[0]?.table}:o?{table:o}:{}}).then(e=>(0,z.postNewBookingToKitchen)(e,N)).catch(()=>{}),u?.({date:R,time:J,name:q.trim()}),t()}})]})}},1096,[812,1097,1098,843,851,841,1099,1100,1101,1102,17,842,385,85,856,1055,858,1103,1074,863,804,848,777,996,993,1104,1105,1077,1053,1076,1094,1093,1111,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return R}}),_e.useTableNames=W,_e.resetTableLive=E,_e.seatBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'seated'),E(e,t.table)},_e.finishBookingNow=async function(e,t){const s=(new Date).toISOString();await k.repo.bookings.update(t.id,(0,N.finishClearPatch)(s,t.table)),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=_,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return H}}),_e.TablePicker=U,_e.WalkInSheet=G,_e.AssignTableSheet=V,_e.undoNotice=Y,_e.NewBookingSheet=K,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[n,i]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>i({b:e}),combineTables:e=>i({b:e,combine:!0}),elements:(0,A.jsxs)(A.Fragment,{children:[s?(0,A.jsx)(G,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,A.jsx)(K,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,A.jsx)(V,{booking:n.b,combine:n.combine,onClose:()=>i(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),z=_r(_d[29]),B=_r(_d[30]),M=_r(_d[31]),N=_r(_d[32]),L=_r(_d[33]),A=_r(_d[34]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),R=Array.from({length:12},(e,t)=>String(t+1));function W(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function E(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function _(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=W(e),a=(0,v.useFloor)(t=>t.live[e])??{},n=(0,v.usePlan)(e),i=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(i,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const H=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function U({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=n?6:8,f=n?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(i??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,A.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],i=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!i,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,A.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:i?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,A.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,A.jsx)(C.T,{weight:"bold",size:22,colour:i?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,A.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,A.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,A.jsx)(C.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const q=[1,2,3,4,5,6,7,8];function G({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:r,r:d,now:u}=(0,y.useCtx)(15e3),x=_(r,u),[T,I]=(0,c.useState)(2),[P,$]=(0,c.useState)(!1),[O,z]=(0,c.useState)(i??null),B=(0,v.usePlan)(r),N=(0,k.useBookings)(r),L=(0,D.useBlocks)(e=>e.blocks),R=(0,D.closedAreasAt)(L,r,(0,w.ymd)(u),(0,w.hm)(u)),W=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(x).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(B,N.filter(e=>e.date===(0,w.ymd)(u)),e,T,u,(0,j.turnFor)(T,d.settings.turnMins),90,void 0,{closed:R})?.table??null},[B,N,x,T,R.size,u.getTime()]);(0,c.useEffect)(()=>{O&&(0,v.tablesOf)(O).some(e=>'Closed'===x[e]?.label)&&z(null)},[O,R.size]);const[H,G]=(0,c.useState)(!1),[V,Y]=(0,c.useState)(''),K=(e,t=String(e),s=()=>{$(!1),I(e)})=>{const o='9+'===t?P:!P&&T===e;return(0,A.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,A.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},Q=(0,A.jsx)(s.PartySizeInput,{value:T,onChange:I,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),X=(0,A.jsxs)(m.default,{style:{gap:8,width:n?256:void 0},children:[(0,A.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,A.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[q.map(e=>K(e)),K(9,'9+',()=>{$(!0),I(e=>e>=9?e:9)})]}),P?Q:null]}),[J,Z]=(0,c.useState)(!1),ee=async(t=O)=>{if(!J&&(0,M.guardBookingChange)(F)){Z(!0);try{const s=await k.repo.bookings.seatWalkIn(r,T,t??void 0,V);E(r,t??void 0),a(s),e()}finally{Z(!1)}}},te=(0,A.jsxs)(m.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,A.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,A.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),O?(0,A.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>z(null)}):null]}),(0,A.jsx)(U,{use:x,value:O,onPick:e=>{x[e]&&!x[e].busy?ee(e):z(O===e?null:e)},big:n,dense:n,best:W,bestSet:(0,h.bestTables)(B)}),(0,A.jsxs)(C.Muted,{children:["Tap a free table to seat them there",W&&!O?` (suggested for ${T}: ${(0,l.tableNumbers)(W)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(u)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,A.jsx)(C.Button,{label:`Seat walk-in \xb7 ${T} ${1===T?'person':'people'}${O?` \xb7 ${(0,l.tableNumbers)(O)}`:''}`,disabled:J,onPress:()=>{ee()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,A.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[X,te]}):(0,A.jsxs)(A.Fragment,{children:[X,te]}),(0,A.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[H?(0,A.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:V,onChangeText:Y,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,A.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,A.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,A.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function V({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,y.useCtx)(15e3),i=_(o,n),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(n)),t,e.partySize,n,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,n.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),P=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,$=D.reduce((e,t)=>e+P(t),0),O=D.length>0&&${if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&E(o,l),t()},B=x?(0,A.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,A.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,A.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${$} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,A.jsx)(m.default,{testID:"combine-short",children:(0,A.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-$," more needed. Add another table."]})}):null,(0,A.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,A.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,A.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,A.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,A.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,A.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${H(e)}`,testID:"assign-table-sheet",footer:B,children:[f&&!x?(0,A.jsx)(m.default,{testID:"assign-suggested",children:(0,A.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,A.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,A.jsx)(U,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function Y(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${H(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function K({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:N}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const R=(0,w.ymd)(p),[W,E]=(0,c.useState)(ee.blocks),[U,q]=(0,c.useState)(!1),[G,V]=(0,c.useState)(''),[Y,K]=(0,c.useState)(2),[Q,X]=(0,c.useState)(0),J=Math.min(Q,Math.max(0,Y-1)),[Z,ee]=(0,c.useState)(null),[te,se]=(0,c.useState)(''),[oe,le]=(0,c.useState)(''),[ae,ne]=(0,c.useState)(''),[ie,re]=(0,c.useState)(!1),[de,ue]=(0,c.useState)('phone'),[ce,be]=(0,c.useState)([]),[ge,he]=(0,c.useState)(''),[pe,me]=(0,c.useState)((0,P.emptyNeeds)()),fe=(0,P.needsMissing)(pe),[ye,ke]=(0,c.useState)(null),xe=(0,v.usePlan)(b),je=(0,O.dogSetUp)(xe),we=!0===pe.dog&&je,Se=pe.dog?pe.dogs:0,Te=(0,w.parseYmd)(W),Ce=(0,j.turnFor)(Y,h.settings.turnMins),ve=_.filter(e=>e.date===W),De=e=>(0,j.dogTablesAt)(xe,ve,Y,(0,j.slotStart)(W,e),Ce,h.settings.turnMins,(0,D.closedAreasAt)(H,b,W,e)),Ie=we&&Z?De(Z):[];(0,c.useEffect)(()=>{ke(null)},[we,Z,Y]);const Pe=(0,x.bookingSlots)(h,Te,e=>_.filter(t=>t.date===W&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Y,W===(0,w.ymd)(p)?p:(0,w.addMins)(Te,0),e=>_.filter(t=>t.date===W&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),$e=(0,T.guestPhone)(oe),[Oe,ze]=(0,c.useState)(!1),Be=Z?Pe.find(e=>e.time===Z):void 0,Me=Be&&Be.left=2&&!!Z&&(!Le||Oe)&&(0,o.validParty)(Y)&&$e.ok&&(0,T.emailOk)(ae)&&(!Ae||Fe&&U)&&(!we||Ie.length>0)&&!Re,Ee=pe.wheelchair>0||pe.stepFree,He=(0,$.bookingRulesOf)(h),Ue=(0,$.largeGroupTables)(He,Y),qe=(0,$.dogPartyCheck)(He,Y,!0===pe.dog,pe.assistDog),Ge=(0,$.bookingDepositSplit)((0,n.depositOf)(h.settings),Y,J,(0,P.needsPatch)(pe),(0,O.reservablesOf)(h));return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(Te)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,A.jsx)(P.FirstQuestions,{rid:b,value:pe,onChange:me,party:Y,audience:"staff"}),pe.dog&&!je?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,A.jsx)(I.BookingDatePicker,{r:h,today:p,value:W,onChange:e=>{e!==W&&(E(e),ee(null),q(!1))}}),(0,A.jsxs)(C.Row,{gap:6,children:[(0,A.jsx)(C.Chip,{label:"Phone",selected:'phone'===de,onPress:()=>ue('phone')}),(0,A.jsx)(C.Chip,{label:"In person",selected:'in-person'===de,onPress:()=>ue('in-person')})]}),(0,A.jsx)(C.Field,{label:"Name",value:G,onChangeText:V,placeholder:"e.g. Reid",testID:"nb-name"}),(0,A.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:oe,onChangeText:le,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!$e.ok&&oe?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:$e.error}):null,(0,A.jsx)(C.Field,{label:"Email (optional)",value:ae,onChangeText:ne,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email",testID:"nb-email"}),(0,T.emailOk)(ae)?null:(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),ae.trim()&&He.marketingOptIn?(0,A.jsx)(C.Toggle,{label:He.marketingWords,value:ie,onChange:re,testID:"nb-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,A.jsx)(i.AdultsChildren,{value:(0,r.peopleOf)(Y,J),onChange:e=>{K(e.partySize),X(e.children),ze(!1)},depositsOn:(0,n.depositOf)(h.settings).on&&(0,n.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,children:Pe.map(e=>{const t=we&&e.available&&!De(e.time).length||!(0,P.dogTimeOk)(h,_,W,e.time,Se);return(0,A.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(H,b,W,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:Z===e.time,onPress:()=>{ee(e.time),q(!1),ze(!1)}},e.time)})}),Le?(0,A.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[Me?(0,A.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Y,Me.left,Me.time)}):null,Ne?(0,A.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)(Ne.time,Ne.cap)}):null,(0,A.jsx)(C.Chip,{label:Oe?'Booking over the limit: on':'Book anyway (over the limit)',selected:Oe,onPress:()=>ze(e=>!e),testID:"nb-over-ok"})]}):null,we&&Z?(0,A.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,A.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,A.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",xe.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),Ie.length?xe.areas.filter(e=>Ie.some(t=>t.area===e.name)).map(e=>(0,A.jsxs)(m.default,{style:{gap:6},accessibilityLabel:e.name,children:[(0,A.jsxs)(C.T,{size:13,center:!0,colour:S.colours.muted,children:[e.name,e.outdoor?' (outdoor)':'']}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,children:Ie.filter(t=>t.area===e.name).map(e=>{const t=Ie[0]?.table===e.table;return(0,A.jsx)(C.Chip,{testID:`nb-dog-table-${(0,l.tableNumbers)(e.table)}`,label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.seats} seats${t?' \xb7 best':''}${Ee&&(0,O.accessibleSetUp)(xe)&&!(0,O.isAccessible)(xe,e.table)?' \xb7 not step-free':''}`,selected:(ye??Ie[0].table)===e.table,onPress:()=>ke(e.table)},e.table)})})]},e.id)):(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Y," at ",Z,". Try another time."]})]}):null,Ae?(0,A.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,A.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",Ae.from,"\u2013",Ae.to,Ae.reason?` (${Ae.reason})`:'']}),Fe?(0,A.jsx)(C.Chip,{label:U?'Manager override on':'Override and book anyway',selected:U,onPress:()=>q(e=>!e)}):(0,A.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,Pe.length?null:(0,A.jsx)(m.default,{testID:"nb-closed",children:(0,A.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(Te)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,A.jsx)(P.MoreQuestions,{rid:b,r:h,value:pe,onChange:me,party:Y,date:W,time:Z,today:(0,w.ymd)(p),bookings:_,audience:"staff",showTables:!1!==h.settings.tableRequests}),Ee&&!(0,O.accessibleSetUp)(xe)?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,Ue&&!we?(0,A.jsxs)(C.T,{size:14,colour:S.colours.goldLight,testID:"nb-large-group",children:["Large group: tables ",Ue.join(' + ')," joined."]}):null,qe.ok?null:(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,testID:"nb-dog-cap",children:["Online, a dog booking is for up to ",He.dogMaxParty," people. You can still book it here: check where they can sit."]}),(0,A.jsx)(C.T,{size:16,center:!0,children:"VIP or regular"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:L.TAGS.map(e=>{const t=ce.includes(e);return(0,A.jsx)(C.Chip,{label:e,selected:t,testID:`nb-tag-${e}`,onPress:()=>be(t?ce.filter(t=>t!==e):[...ce,e].sort())},e)})}),(0,A.jsx)(C.T,{size:16,center:!0,children:"Occasion"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:L.OCCASIONS.map(e=>(0,A.jsx)(C.Chip,{label:e.label,selected:ge===e.id,testID:`nb-occasion-${e.id||'none'}`,onPress:()=>he(e.id)},e.id||'none'))}),(0,A.jsx)(C.Field,{label:"Notes (optional)",value:te,onChangeText:se,placeholder:He.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"nb-notes"}),Ge.preorders?(0,A.jsxs)(C.Muted,{testID:"nb-preorder-deposit",children:["Pre-order deposit: ",(0,a.gbp)(Ge.preorders),Ge.adults?`, plus the group deposit: ${(0,a.gbp)(Ge.total)} in total`:'',". Staff can waive it."]}):null,(0,n.depositDue)((0,n.depositOf)(h.settings),Y,J)?(0,A.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(h.settings),Y,J))," (",(0,a.gbp)((0,n.depositOf)(h.settings).perPersonPence)," per adult for tables of ",(0,n.depositOf)(h.settings).fromParty,"+ adults",J?`; ${J} ${1===J?'child':'children'} free`:'; children free, and they do not count towards the number that needs a deposit',"). Staff can waive it. Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,A.jsx)(C.Muted,{children:"CoverCharge confirms the guest by email automatically (preview mode: shown in the Outbox, not sent)."}),Re?(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",Z,". Try another time: dogs are very welcome then."]}):null,(0,A.jsx)(C.Button,{label:fe.length?fe[0]:'Save booking',testID:"nb-save",disabled:!We,onPress:()=>{if(W<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,P.needsPatch)(pe),s=pe.tableReq.find(e=>!we||Ie.some(t=>t.table===e)),o=we?null:(0,B.requestedFreeTable)(pe.tableReq,{date:W,time:Z,partySize:Y},xe.tables.map(e=>e.name),ve,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:G.trim(),partySize:Y,date:W,time:Z,notes:te.trim(),security:Ge.total?'deposit':'none',depositPaid:0,...J?{children:J}:{},...Ge.total?{...(0,$.depositFields)(Ge),depositPolicy:(0,n.depositWords)((0,n.depositOf)(h.settings),Y,h.name,J).join(' '),depositRefundable:(0,n.depositOf)(h.settings).refundable,depositCutoffHours:(0,n.depositOf)(h.settings).cutoffHours}:{},phone:$e.pretty,email:ae.trim()||void 0,...ie?(0,$.marketingChoice)(ae,!0):{},source:de,...e,...Pe.find(e=>e.time===Z)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...ce.length?{tags:ce}:{},...ge?{occasion:ge}:{},...we?{table:ye??s??Ie[0]?.table}:o?{table:o}:{}}).then(e=>(0,z.postNewBookingToKitchen)(e,N)).catch(()=>{}),u?.({date:W,time:Z,name:G.trim()}),t()}})]})}},1096,[812,1097,1098,843,851,841,1099,1100,1101,1102,17,842,385,85,856,1055,858,1103,1074,863,804,848,777,996,993,1104,1105,1077,1053,1076,1094,1093,1111,1112,8]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,S]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{S(String(e))},[e]);const T=e=>p((0,s.clampParty)(e,b,y)),$=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>T(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:u.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(c.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:u.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?$(-10,'\u221210',"10 fewer people"):null,$(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{S(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&T((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);S(String(e)),T(e)},returnKeyType:"done",blurOnSubmit:!0,onSubmitEditing:e=>{e?.target?.blur?.()},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:u.colours.border,color:u.colours.text,backgroundColor:u.colours.surface,textAlign:'center',fontSize:20,fontFamily:u.fonts.semibold}}),$(1,'+','One more person'),y-b>=20?$(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),u=r(_d[5]),c=r(_d[6]),d=r(_d[7])},1097,[17,385,395,85,1098,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"overCapacityNote",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"overPartiesNote",{enumerable:!0,get:function(){return b}});const t=100,n=1,o=`Bookings are for ${n} to ${t} people.`,u=o=>'number'==typeof o&&Number.isInteger(o)&&o>=n&&o<=t,c=(o,u=n,c=t)=>{const s=parseInt(String(o??'').replace(/\D/g,'').slice(0,4),10);return Math.max(u,Math.min(c,Number.isFinite(s)?s:u))},s=(o,u=n,c=t)=>Math.max(u,Math.min(c,Math.round(Number(o)||u))),f=(t,n,o)=>n<=0?`${o} is already full for booked Covers. Booking ${t} more goes over the venue\u2019s limit: check tables and staffing.`:`${t} is more than the ${n} Covers left at ${o}. Booking goes over the venue\u2019s limit by ${t-n}: check tables and staffing.`,b=(t,n)=>`${t} already has the most bookings we take at one start time (${n}). Booking another goes over the venue\u2019s limit: check tables and staffing.`},1098,[]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdultsChildren=function({value:e,onChange:t,depositsOn:h,testID:x="people"}){const p=e=>t((0,s.storedPeople)(e)),b=(0,s.totalLine)(e);return(0,o.jsxs)(l.default,{testID:x,style:{gap:8,alignItems:'center',width:'100%'},children:[(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",children:"Adults"}),(0,o.jsx)(n.PartySizeInput,{value:e.adults,min:1,max:(0,s.maxAdults)(e.children),onChange:t=>p({adults:t,children:e.children}),label:"Adults",testID:`${x}-adults`}),(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",children:"Children"}),(0,o.jsx)(n.PartySizeInput,{value:e.children,min:0,max:(0,s.maxKids)(e.adults),onChange:t=>p({adults:e.adults,children:t}),label:"Children",testID:`${x}-children`}),(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",colour:c.colours.goldLight,testID:`${x}-total`,accessibilityLabel:b,children:b}),h?(0,o.jsx)(u.Muted,{center:!0,children:"Children never pay a deposit."}):null]})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4]),c=r(d[5]),o=r(d[6])},1099,[17,85,1100,1097,777,804,8]); @@ -1192,18 +1192,18 @@ __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,"ARM_MS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SELECT_HINT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SELECTED_A11Y",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"TABLE_SELECT_HINT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isArmed",{enumerable:!0,get:function(){return l}}),e.releaseOn=function(n,o,c,u){const b=l(n,o,u);return c?b?{arm:null,action:'move'}:{arm:n&&u-n.at!!n&&n.id===o&&c-n.at!e.signOff),S=k.filter(e=>e.signOff),_=j.map(o.allergenLabel).join(', '),C=e=>e.map(e=>e.name).join(', ')||'none';return(0,f.jsxs)(l.default,{testID:"menu-allergy-check",style:{gap:6,borderWidth:1,borderColor:p.length?h.colours.red:h.colours.border,borderRadius:12,padding:10,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(u.T,{weight:"semibold",children:["Allergy check against the menu (",_,")"]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.red,children:["Contains: ",p.length," dish",1===p.length?'':'es']}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.amber,children:["May contain: ",M.length]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.ok,children:["Free from ",1===j.length?'it':'them'," (signed off): ",S.length]}),w.length?(0,f.jsxs)(u.Muted,{children:[w.length," more awaiting the head chef's sign-off, so not shown as safe."]}):null,(0,f.jsx)(n.default,{testID:"menu-allergy-details",accessibilityRole:"button",onPress:()=>y(!x),hitSlop:6,children:(0,f.jsx)(u.T,{size:14,colour:h.colours.gold,children:x?'Hide dishes':'Show dishes'})}),x?(0,f.jsxs)(l.default,{style:{gap:4},children:[(0,f.jsxs)(u.Muted,{children:["Contains: ",C(p)]}),(0,f.jsxs)(u.Muted,{children:["May contain: ",C(M)]}),(0,f.jsxs)(u.Muted,{children:["Free from: ",C(S)]})]}):null,(0,f.jsx)(u.Muted,{children:'guest'===m?'From the kitchen\u2019s signed-off recipe cards. Specials on the board are checked by staff on the day.':'From the signed-off recipe cards. Specials on the board have their own allergens. Still check with the guest and the kitchen.'})]})};var s=r(d[0]),n=e(r(d[1])),l=e(r(d[2])),t=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8])},1110,[17,385,85,858,845,847,804,777,8]); __d(function(g,r,i,_a,m,_e,d){"use strict";function t(t){return String(t??'').split('+').map(t=>t.trim()).filter(Boolean)}function e(t){return t.length<=1?t[0]??'':2===t.length?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`}function n(n){const o=t(n);return o.length>1?`tables ${e(o)}`:o.length?`table ${o[0]}`:''}Object.defineProperty(_e,'__esModule',{value:!0}),_e.tableWords=n,Object.defineProperty(_e,"RECENT_SEATED_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"FINISH_UNDO_MS",{enumerable:!0,get:function(){return a}}),_e.seatedAgoMs=s,_e.seatedAgoWords=u,_e.needsRecentSeatedWarning=c,_e.finishConfirmPrompt=function(t){const e=t.name.trim()||'This party',n=t.parties&&t.parties>1?t.parties:1,o=t.seated&&c({seatedAt:t.seatedAt},t.now),a=o?u(s({seatedAt:t.seatedAt},t.now)):'',l=f(t.table);if(!t.seated)return`Mark ${e} finished without seating?`;if(n>1){return`${n} parties seated here${o?`, including ${e} seated ${a}`:''}. Mark all finished${l}?`}return o?`${e} seated ${a}. Mark finished${l}?`:`Mark ${e} finished${l}?`},_e.restoreSeatedPrompt=function(t,e){return`${t.trim()||'This party'} is finished. Seat them at ${n(e)}?`},_e.lastTableFromAudit=l,_e.tableForUndo=function(t,e){const n=String(t.table??'').trim();if(n)return n;const o=String(t.lastTable??'').trim();return o||l(e)},_e.finishClearPatch=function(t,e){const n=String(e??'').trim();return{status:'finished',finishedAt:t,table:void 0,...n?{lastTable:n}:{}}},_e.finishUndoPatch=function(t){const e=String(t??'').trim();return{status:'seated',finishedAt:void 0,lastTable:void 0,...e?{table:e}:{table:void 0}}};const o=15,a=15e3;function s(t,e){if(!t.seatedAt)return null;const n=new Date(t.seatedAt).getTime();return Number.isFinite(n)?Math.max(0,e.getTime()-n):null}function u(t){const e=Math.round(t/1e3);if(e<1)return'just now';if(e<60)return`${e} second${1===e?'':'s'} ago`;const n=Math.round(e/60);if(n<60)return`${n} minute${1===n?'':'s'} ago`;const o=Math.round(n/60);return`${o} hour${1===o?'':'s'} ago`}function c(t,e){const n=s(t,e);return null!=n&&n<9e5}function f(t){const e=t?n(t):'';return e?` and set ${e} to needs clearing`:''}function l(t){if(!t?.length)return;const e=[...t].sort((t,e)=>String(e.at??'').localeCompare(String(t.at??'')));for(const t of e){if(t.action&&'tables'!==t.action)continue;const e=String(t.from_value??'').trim(),n=String(t.to_value??'').trim();if(e&&!n)return e.replace(/\+/g,'+')}for(const t of e){if(t.action&&'tables'!==t.action)continue;const e=String(t.to_value??'').trim();if(e)return e;const n=String(t.from_value??'').trim();if(n)return n}}},1111,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FinishConfirm=I,_e.RestoreSeatedConfirm=function({prompt:e,onYes:t,onNo:n}){return(0,k.jsxs)(s.default,{testID:"restore-seated-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:"Yes, seat them",testID:"restore-seated-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"restore-seated-no",onPress:n,style:w})]})},Object.defineProperty(_e,"finishBookingNow",{enumerable:!0,get:function(){return p.finishBookingNow}}),_e.undoFinishedNow=D,_e.restoreFinishedToTable=async function(e,t,s){const o=(0,b.tableKey)(s);await n.repo.bookings.update(t.id,{...(0,f.tablePatch)(o||null),status:'seated',finishedAt:void 0,lastTable:void 0}),o&&(0,p.resetTableLive)(e,o)},_e.offerFinishUndo=F,_e.finishAndOfferUndo=v,_e.finishUnseatedAndOfferUndo=N,_e.FinishButton=function({rid:e,b:s,name:n,allowed:o=!0,hint:c,small:b,bigToast:f,testID:u,label:h="Finished",a11y:p,kind:D="secondary"}){const[F,j]=t.default.useState(!1);if(!o)return null;const x=(0,l.finishConfirmPrompt)({name:n,table:s.table,seatedAt:s.seatedAt,now:new Date,seated:'seated'===s.status});if(F)return(0,k.jsx)(I,{prompt:x,onNo:()=>j(!1),onYes:()=>{j(!1),'seated'===s.status?v(e,[s],n,{big:f,table:s.table}):N(e,s,n,{big:f})}});return(0,k.jsx)(y.Button,{small:b,kind:D,label:h,testID:u,accessibilityLabel:p??`${h}: ${n}`,accessibilityHint:c,disabled:!o,onPress:()=>j(!0),style:b?void 0:w})};var t=e(r(d[0])),s=e(r(d[1])),n=r(d[2]),o=r(d[3]),l=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),u=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]);const w={minHeight:64};function I({prompt:e,onYes:t,onNo:n,yesLabel:o="Yes, finish"}){return(0,k.jsxs)(s.default,{testID:"finish-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:o,testID:"finish-confirm-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"finish-confirm-no",onPress:n,style:w})]})}async function D(e,t,s){const c=(0,l.tableForUndo)(t,s);await n.repo.bookings.update(t.id,(0,l.finishUndoPatch)(c)),c&&(0,o.tablesOf)(c).forEach(t=>o.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function F(e){const t=e.bookings[0];if(!t)return;const s=e.bookings.length>1?`${e.bookings.length} parties finished.`:`${e.name} finished.`,n=e.table?`${(0,c.tableWords)(e.table).replace(/^t/,'T')} needs clearing.`:void 0,o=`finish-undo-${t.id}`;(0,u.notify)({id:o,title:s,body:n,timeoutMs:l.FINISH_UNDO_MS,big:e.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{for(const t of e.bookings)await D(e.rid,{...t,table:void 0,lastTable:t.table||t.lastTable});(0,u.dismissNotice)(o)})()}}]})}async function v(e,t,s,n){const o=n?.table??t.find(e=>e.table)?.table;for(const s of t)await(0,p.finishBookingNow)(e,s);F({rid:e,bookings:t,name:s,table:o,big:n?.big})}async function N(e,t,s,o){await n.repo.bookings.setStatus(t.id,'finished');const c=`finish-undo-${t.id}`;(0,u.notify)({id:c,title:`${s} finished.`,timeoutMs:l.FINISH_UNDO_MS,big:o?.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{await n.repo.bookings.setStatus(t.id,t.walkIn?'cancelled':'confirmed'),(0,u.dismissNotice)(c)})()}}]})}},1112,[17,85,858,996,1111,1113,1094,1090,916,804,777,1096,8]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return s.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return c}}),e.freeTablesNow=function(t,a,s=!1){const l=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),n=l.filter(([,t])=>t.table.maxSeats>=a),o=t=>t.map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}));return s?[...o(n),...o(l.filter(([,t])=>t.table.maxSeatsh[t]&&(l.includes(h[t].status)||'dirty'===h[t].status||'blocked'===h[t].status));if(p.length&&p.every(t=>h[t])&&!t.length)f.push({id:'seat',label:`Seat at ${b(s.table).replace(/^t/,'T')}`,a11y:`Seat ${n}, ${u(s.partySize)}, at ${b(s.table)}`,table:s.table});else if(c(s,$)){const a=p.length?t.length?`${b(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===h[t[0]].status?'waiting to be cleared':'blocked'===h[t[0]].status?'blocked':'in use'}`:`${b(s.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';f.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${n}, ${u(s.partySize)}. ${a}.`,note:a})}c(s,$)&&f.push({id:'finished',label:'Finished',a11y:`Finished, ${n}, ${s.time} booking, without seating at a table`}),o($,s)<=0&&f.push({id:'noshow',label:'No-show',a11y:`No-show, ${n}, ${s.time} booking`})}return f.push({id:'details',label:'Guest details',a11y:`Guest details, ${n}`}),f};var t=r(d[0]),a=r(d[1]),s=r(d[2]);const l=['seated','mains','dessert','bill'],n=t=>new Date(`${t.date}T${t.time}:00`),o=(t,a)=>(n(a).getTime()-t.getTime())/6e4,b=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},u=t=>`${t} ${1===t?'person':'people'}`,c=(t,a)=>o(a,t)<=45},1113,[996,863,1074]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return x}}),_e.cancelWalkInWords=I,_e.reinstateWalkInWords=$,_e.cancelWalkInNow=j,_e.reinstateWalkInNow=C,_e.CancelWalkInButton=function({rid:e,b:t,onDone:o,small:c,big:u}){const[b,f]=(0,n.useState)(!1),k=(0,l.useInStaffApp)(),x=(0,s.useSeatClearFinish)();return p(t)?k&&!x.ok?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(w.Button,{kind:"secondary",small:c,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>f(!0),style:u?{minHeight:64}:c?{minHeight:44}:h}),b?(0,y.jsx)(W,{rid:e,b:t,onClose:()=>f(!1),onDone:o}):null]}):null},_e.CancelWalkInConfirm=W,_e.ReinstateWalkInButton=function({rid:e,b:t,today:o,onDone:u,small:b}){const[f,p]=(0,n.useState)(!1),I=(0,l.useInStaffApp)(),j=(0,s.useSeatClearFinish)();if(!x(t,o))return null;if(I&&!j.ok)return null;const W=$(t);if(!f)return(0,y.jsx)(w.Button,{kind:"ghost",small:b,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>p(!0),style:b?{minHeight:44}:h});return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:()=>p(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:W,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:W})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[h,{flexGrow:1}],onPress:async()=>{await C(e,t),p(!1),u?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>p(!1),style:h})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]),o=r(d[4]),c=(e=o)&&e.__esModule?e:{default:e},u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]),w=r(d[9]),y=r(d[10]);const h={minHeight:56},p=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),x=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function I(e){const t=(0,b.tablesOf)(e.table),n=(0,f.tablesWords)(t);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${t.length?` at ${n}`:''}, arrived ${e.time}? It comes off the Covers${t.length?` and ${n} ${t.length>1?'go':'goes'} back to Free`:''}.`}function $(e){return`Put walk-in ${e.ref} back to seated? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`}async function j(e,n){await u.repo.bookings.setStatus(n.id,'cancelled'),await u.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,b.tablesOf)(n.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function C(e,t){await u.repo.bookings.setStatus(t.id,'seated'),(0,b.tablesOf)(t.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function W({rid:e,b:t,onClose:n,onDone:l}){const s=I(t);return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:s,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:s})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[h,{flexGrow:1}],onPress:async()=>{await j(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,b.tablesOf)(t.table).length?` ${(0,f.tablesWords)((0,b.tablesOf)(t.table))} free.`:''}`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:h})]})]})}},1114,[1115,17,1055,1117,85,858,996,1094,804,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.cancelStamp=C,_e.cancelBookingNow=w,_e.reinstateBookingNow=$,_e.CancelBookingButton=function({rid:e,b:n,name:o,onDone:s,big:l,small:c}){const[u,f]=(0,t.useState)(!1);return(0,b.canCancelBooking)(n)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(x.Button,{kind:"secondary",small:c,label:"Cancel booking",testID:`cancel-booking-${n.id}`,accessibilityLabel:`Cancel booking for ${o}, ${n.time}, ${n.partySize} Covers`,onPress:()=>f(!0),style:l?{minHeight:64}:c?{minHeight:44}:j}),u?(0,h.jsx)(D,{rid:e,b:n,name:o,onClose:()=>f(!1),onDone:s}):null]}):null},_e.CancelBookingConfirm=D,_e.ReinstateBookingButton=function({b:e,name:n,today:s,onDone:l}){const[c,u]=(0,t.useState)(!1);if(!(0,b.canReinstateBooking)(e,s))return null;const y=(0,b.reinstateBookingWords)(e,n);if(!c)return(0,h.jsx)(x.Button,{kind:"ghost",label:"Undo cancel",testID:`reinstate-booking-${e.id}`,accessibilityLabel:`Undo cancel for ${n}`,onPress:()=>u(!0),style:j});return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:()=>u(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center'},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, put back to booked",testID:"reinstate-booking-yes",accessibilityLabel:`Yes, put ${n} back to booked`,style:[j,{flexGrow:1}],onPress:async()=>{await $(e),u(!1),l?.(`${n} put back to booked.`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-booking-no",onPress:()=>u(!1),style:j})]})]})};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]),c=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]),y=r(d[8]),k=r(d[9]),p=r(d[10]),x=r(d[11]),h=r(d[12]);const j={minHeight:56},B={display:'Display',owner:'Managers app',staff:'Staff app',chef:'Kitchen app',customer:'Customer page'};function C(e){const t=y.useSession.getState().meId,n=t?k.useOwner.getState().staff.find(e=>e.id===t):void 0,o=B[p.APP_VARIANT]??'CoverCharge';return{by:n?`${n.name.replace(' (example)','')} (${o})`:o,at:(new Date).toISOString(),app:o,...e.table?{table:e.table}:{}}}async function w(e,t){const n=(0,l.tablesOf)(t.table);await s.repo.bookings.update(t.id,{status:'cancelled',cancelled:C(t),...(0,c.tablePatch)(null)}),n.forEach(t=>l.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function $(e){await s.repo.bookings.setStatus(e.id,'confirmed')}function D({rid:e,b:t,name:n,onClose:s,onDone:c}){const y=(0,b.cancelBookingWords)(t,n),k=(0,l.tablesOf)(t.table);return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:s,title:"Cancel booking?",maxWidth:560,testID:"cancel-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center',gap:8},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, cancel booking",testID:"cancel-booking-yes",accessibilityLabel:`Yes, cancel booking for ${n}`,style:[j,{flexGrow:1}],onPress:async()=>{await w(e,t),s(),c?.(`${n} cancelled.${k.length?` ${(0,u.tablesWords)(k)} free.`:''}`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep booking",testID:"cancel-booking-no",accessibilityLabel:`Keep booking for ${n}`,onPress:s,style:j})]})]})}},1115,[17,85,858,996,1090,1116,1094,804,920,876,856,777,8]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canCancelBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canReinstateBooking",{enumerable:!0,get:function(){return t}}),e.cancelBookingWords=function(n,t){const o=`${n.partySize} Cover${1===n.partySize?'':'s'}`;return`Cancel booking for ${t}, ${n.time}, ${o}? The table is freed. Website bookings will cancel it on the website and may email the guest.`},e.reinstateBookingWords=function(n,t){return`Put ${t} back to booked for ${n.time}? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`},e.cancelledOnDay=o,e.cancelledDayTally=function(n,t){const a=o(n,t),l=a.filter(n=>!!n.walkIn),c=a.filter(n=>!n.walkIn);return{count:a.length,covers:a.reduce((n,t)=>n+t.partySize,0),bookings:c.length,bookingCovers:c.reduce((n,t)=>n+t.partySize,0),walkIns:l.length,walkInCovers:l.reduce((n,t)=>n+t.partySize,0),list:a}},e.cancelledTallyWords=function(n,t="today"){if(!n.count)return`No cancellations ${t}`;const o=[],a=n.bookings??0,l=n.walkIns??0;a&&o.push(`${a} booking${1===a?'':'s'} (${n.bookingCovers??0} Cover${1===(n.bookingCovers??0)?'':'s'})`);l&&o.push(`${l} walk-in${1===l?'':'s'} (${n.walkInCovers??0} Cover${1===(n.walkInCovers??0)?'':'s'})`);if(!o.length)return`Cancelled ${t}: ${n.count} \xb7 ${n.covers} Cover${1===n.covers?'':'s'}`;return`Cancelled ${t}: ${o.join(' \xb7 ')}`};const n=n=>!n.walkIn&&('confirmed'===n.status||'pending'===n.status||'seated'===n.status),t=(n,t)=>!n.walkIn&&'cancelled'===n.status&&n.date>=t;function o(n,t){return n.filter(n=>n.date===t&&'cancelled'===n.status).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name))}},1116,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSeatClearFinish=function(){const t=(0,A.useSignedIn)(),o=(0,A.useInStaffApp)(),_='staff'===s.APP_VARIANT||'chef'===s.APP_VARIANT||o,l=(0,c.canSeatClearFinish)({device:s.IS_CAR||'display'===s.APP_VARIANT||!_&&!t,viaDisplay:(0,n.isKitchenViaDisplay)(),role:t?.role,ownerAccess:t?.ownerAccess,managerAccess:t?.managerAccess});return{ok:l,hint:l?void 0:c.SEAT_CLEAR_HINT}};var s=r(d[0]),n=r(d[1]),c=r(d[2]),A=r(d[3])},1117,[856,922,1118,1055]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEAT_CLEAR_HINT",{enumerable:!0,get:function(){return n}}),e.canSeatClearFinish=function(n){return!(!n.device&&!n.viaDisplay)||('owner'===n.role||'manager'===n.role||!(!n.ownerAccess&&!n.managerAccess))};const n='Ask a manager to seat, finish or clear a table.'},1118,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:s,who:i,role:n,inStaffApp:l,shiftManager:a,big:o,testID:d}){const[h,u]=(0,t.useState)(!1),p=(0,b.useSession)(e=>e.meId),y=(0,m.useOwner)(e=>e.staff.find(e=>e.id===p&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:l,role:n,shiftManager:a})||p&&!(0,x.canChangeBookings)(y)?null:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:d??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),h?(0,N.jsx)(V,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:n,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,l.useBookings)(e).filter(e=>!e.walkIn&&e.date>=s&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,200);return o?(0,N.jsx)(V,{rid:e,id:o,who:i,hidePrivate:a,onClose:n}):(0,N.jsxs)(z.Sheet,{visible:!0,onClose:n,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,N.jsx)(z.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${L(e.date,s)} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${L(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,N.jsx)(z.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,N.jsx)(z.Button,{kind:"ghost",label:"Close",onPress:n,style:{minHeight:44}})]})},_e.EditBookingSheet=V;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=(e=i)&&e.__esModule?e:{default:e},l=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),f=_r(_d[19]),C=_r(_d[20]),I=_r(_d[21]),k=_r(_d[22]),w=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),O=_r(_d[28]),W=_r(_d[29]),z=_r(_d[30]),B=_r(_d[31]),N=_r(_d[32]);const E=/^([01]\d|2[0-3]):[0-5]\d$/,R=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const L=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,D.ymd)(s)?'Tomorrow':F(e)};const A=e=>e?(e/100).toFixed(e%100?2:0):'',M=e=>{const t=(0,B.parseMoneyInput)(e);return null!=t&&t>=0?Math.round(100*t):NaN},F=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',H=e=>{const t=e.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);return t?`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`:''},_=e=>e.charAt(0).toUpperCase()+e.slice(1);function Y({title:e,children:t,testID:s}){return(0,N.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,N.jsx)(z.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const G=({label:e,value:t,onChange:s,max:i=20,testID:n})=>(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:e}),(0,N.jsx)(z.Stepper,{testID:n,value:t,min:0,max:i,onChange:s,label:e})]});function V({rid:e,id:i,who:b,onClose:m,hidePrivate:x=!1}){(0,$.useBlurOutside)();const B=(0,l.useBookings)(e),L=B.find(e=>e.id===i),V=(0,d.useRestaurant)(e),K=(0,a.usePlan)(e),U=(0,o.useBlocks)(e=>e.blocks),[q,X]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Q,J]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Z,ee]=(0,t.useState)(!1),[te,se]=(0,t.useState)(null),[ie,ne]=(0,t.useState)(null),[le,ae]=(0,t.useState)(!1),[oe,de]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositDue:0)),[re,ce]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositAmount:0)),[he,ue]=(0,t.useState)(F(L?(0,c.draftOf)(L).depositDate:''));if(!L||!q||!V)return null;const pe=e=>{se(null),ne(null),X({...q,...e})},ge=(0,O.depositOf)(V.settings),be=e=>{const t=e.partySize??q.partySize,s=Math.min(e.children??q.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(L)&&q.depositOn&&!q.depositPaid&&M(oe||'0')===(0,O.depositDue)(ge,q.partySize,q.children??0)){const e=(0,O.depositDue)(ge,t,s);e>0&&de(A(e))}pe({...e,children:s})},me=(0,v.bookingSlotMinutesOf)(V),xe=R(q.time),ye=E.test(xe),je=q.area?K.areas.filter(e=>e.name===q.area).map(e=>e.id):null,De=e=>!je||e.split('+').every(e=>je.includes(K.tables.find(t=>t.name===e)?.areaId??'')),ve=(0,y.tableOptions)(K,B.filter(e=>e.date===q.date),q.table).filter(e=>De(e)||e===q.table),fe=!(q.depositOn&&(Number.isNaN(M(oe||'0'))||q.depositPaid&&(Number.isNaN(M(re||'0'))||he.trim()&&!H(he)))),Ce={...q,time:xe,depositDue:M(oe||'0')||0,depositAmount:M(re||'0')||0,depositDate:H(he)},Ie=(0,c.changedDraftFields)(Q??(0,c.draftOf)(L),Ce),ke=V.settings.turnMins??90,we=!!q?.email?.trim()&&q.email.trim()!==(L?.email??'').trim(),Te=(0,u.bookingRulesOf)(V),Se=async()=>{const t=(0,c.editPatch)(L,Ce,{by:b||'Team member',app:r.APP_VARIANT});if(le&&we&&Object.assign(t,(0,u.marketingChoice)(Ce.email,!0)),Object.keys(t).length&&await l.repo.bookings.update(L.id,t),'seated'===L.status&&'table'in t&&t.table!==L.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(L.table),n=s(t.table),l=a.useFloor.getState(),o=i.map(t=>l.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!n.includes(e)).forEach(t=>l.setLive(e,t,{stage:void 0,dirty:!0})),n.forEach(t=>l.setLive(e,t,{stage:o,dirty:!1}))}ne(`Saved. Changed: ${(0,c.editedWords)(Ie)}.`),se(null),m()},$e=()=>{const t=ye?(0,o.blockAt)(U,e,q.date,xe):void 0,s=(0,c.editWarnings)(L,Ce,B,t,ke,K);!s.length||te?Se():se(s)},Pe=q.allergies??[],Oe=e=>pe({allergyNone:!1,allergies:Pe.some(t=>t.allergen===e)?Pe.filter(t=>t.allergen!==e):[...Pe,{allergen:e,severity:'allergy'}]}),We=(0,c.historyLines)(L);return(0,N.jsxs)(z.Sheet,{visible:!0,onClose:()=>{Ie.length?ee(!0):(ee(!1),m())},title:`Edit booking \xb7 ${L.name} \xb7 ${L.ref}`,maxWidth:760,testID:"edit-booking-sheet",onTypingDone:()=>{(0,C.hideKeyboard)(),Ie.length&&ye&&fe&&q.name.trim().length>=1&&$e()},typingDoneLabel:Ie.length?'Done, save changes':'Done, hide the keyboard',footer:(0,N.jsx)(z.Button,{label:te?'Save anyway':'Save changes',testID:"edit-save",disabled:!ye||!fe||q.name.trim().length<1||!Ie.length,onPress:$e,style:{minHeight:56,width:'100%'}}),children:[(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(w.DepositChip,{b:L,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(L)?(0,N.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,N.jsxs)(Y,{title:"Deposit",testID:"edit-section-deposit",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No deposit",selected:!q.depositOn,testID:"edit-deposit-none",onPress:()=>pe({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit due",selected:!!q.depositOn&&!q.depositPaid&&!q.depositWaived,testID:"edit-deposit-due",onPress:()=>pe({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit paid",selected:!!q.depositOn&&!!q.depositPaid,testID:"edit-deposit-paid",onPress:()=>{re||ce(oe),he||ue(F((0,D.ymd)(new Date))),pe({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsx)(z.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsxs)(z.T,{size:15,center:!0,colour:j.colours.goldLight,testID:"edit-deposit-waived-by",children:[L.depositWaived?.by?(0,O.waiverText)(L.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,q.depositWaived||Ie.includes('deposit')?null:(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(P.WaiveDepositButton,{b:L,who:b,onDone:e=>{const t={...q,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e};X(t),J(s=>s?{...s,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e}:t)}})}),q.depositOn?(0,N.jsx)(z.Field,{money:!0,label:"Deposit due (\xa3)",value:oe,onChangeText:e=>{de(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,q.depositOn&&q.depositPaid?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Field,{money:!0,label:"Amount paid (\xa3)",value:re,onChangeText:e=>{ce(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"How was it paid?"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,N.jsx)(z.Chip,{label:_(e),selected:q.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>pe({depositMethod:e})},e))}),(0,N.jsx)(z.Field,{label:"Date paid (DD/MM/YYYY)",value:he,onChangeText:e=>{ue((0,s.slashDate)(e,he)),pe({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),he.trim()&&!H(he)?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,fe?null:(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,N.jsx)(z.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,N.jsxs)(Y,{title:"When",testID:"edit-section-when",children:[(0,N.jsx)(k.BookingDatePicker,{r:V,today:new Date,value:q.date,onChange:e=>pe({date:e})}),(0,N.jsx)(I.TimeRoller,{testID:"edit-time",value:(0,f.snapTime)(q.time,me),onChange:e=>pe({time:e}),step:me}),ye?null:(0,N.jsx)(z.T,{size:15,colour:j.colours.amber,center:!0,children:"Choose a time on the roller."}),(0,N.jsx)(T.AdultsChildren,{value:(0,S.peopleOf)(q.partySize,q.children),onChange:e=>be(e),depositsOn:ge.on&&ge.perPersonPence>0,testID:"edit-people"}),(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:"Table time"}),(0,N.jsx)(z.Stepper,{testID:"edit-duration",value:q.duration||0,min:0,max:360,step:15,onChange:e=>pe({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,N.jsxs)(Y,{title:"Where",testID:"edit-section-where",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"Any area",selected:!q.area,testID:"edit-area-any",onPress:()=>pe({area:''})}),K.areas.map(e=>(0,N.jsx)(z.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:q.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>pe({area:e.name})},e.id))]}),(0,N.jsx)(z.T,{size:18,weight:"semibold",center:!0,children:(0,y.tableButtonLabel)(q.table)}),(0,y.splitChoices)(q.table).length?(0,N.jsxs)(n.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:"Split the joined tables"}),(0,N.jsx)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,y.splitChoices)(q.table).map(e=>(0,N.jsx)(z.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>pe({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:q.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(q.table?'':', chosen'),onPress:()=>pe({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),ve.map(e=>(0,N.jsx)(z.Button,{kind:e===q.table?'primary':'secondary',label:(0,y.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,y.tableButtonLabel)(e)}${e===q.table?', chosen':''}`,onPress:()=>pe({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,N.jsxs)(Y,{title:"Guest",testID:"edit-section-guest",children:[(0,N.jsx)(z.Field,{label:"Name",value:q.name,onChangeText:e=>pe({name:e}),testID:"edit-name"}),(0,N.jsx)(z.Field,{label:"Phone",value:q.phone,onChangeText:e=>pe({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,N.jsx)(z.Field,{label:"Email",value:q.email,onChangeText:e=>pe({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),we&&Te.marketingOptIn?(0,N.jsx)(z.Toggle,{label:Te.marketingWords,value:le,onChange:ae,testID:"edit-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,N.jsx)(z.T,{size:16,center:!0,children:"Booked by"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>pe({source:e.id})},e.id))}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(q.tags??[]).includes(e);return(0,N.jsx)(z.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>pe({tags:t?(q.tags??[]).filter(t=>t!==e):[...q.tags??[],e].sort()})},e)})})]}),(0,N.jsxs)(Y,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,N.jsx)(G,{label:"Dogs",value:q.dogs??0,max:6,onChange:e=>pe({dogs:e}),testID:"edit-dogs"}),(0,N.jsx)(G,{label:"High chairs",value:q.highChairs??0,max:10,onChange:e=>pe({highChairs:e}),testID:"edit-high-chairs"}),(0,N.jsx)(G,{label:"Wheelchair users",value:q.wheelchair??0,max:10,onChange:e=>pe({wheelchair:e}),testID:"edit-wheelchair"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"Occasion"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:(q.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>pe({occasion:e.id})},e.id||'none'))})]}),(0,N.jsxs)(Y,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No allergies",selected:!!q.allergyNone&&!Pe.length,testID:"edit-allergy-none",onPress:()=>pe({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,N.jsx)(z.Chip,{label:e.short,selected:Pe.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>Oe(e.id)},e.id))]}),Pe.map(e=>(0,N.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,N.jsxs)(z.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,N.jsx)(z.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>pe({allergies:Pe.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,N.jsx)(z.Field,{label:"Anything else about allergies",value:q.allergyNote,onChangeText:e=>pe({allergyNote:e}),testID:"edit-allergy-note"}),Ie.includes('allergies')&&Pe.length?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,N.jsx)(G,{label:"Vegan",value:q.vegan??0,max:q.partySize,onChange:e=>pe({vegan:e}),testID:"edit-vegan"}),(0,N.jsx)(G,{label:"Vegetarian",value:q.vegetarian??0,max:q.partySize,onChange:e=>pe({vegetarian:e}),testID:"edit-vegetarian"})]}),(q.holds??[]).length||(L.holds??[]).some(e=>e.qty>0&&!e.served)?(0,N.jsxs)(Y,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,N.jsx)(z.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(q.holds??[]).map(e=>{const t=(0,h.reservablesOf)(V),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),l=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,N.jsxs)(n.default,{testID:l,style:{gap:6,width:'100%'},children:[(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,N.jsx)(z.Stepper,{testID:l,value:e.qty,min:0,max:20,onChange:t=>pe({holds:(0,c.setEditableHoldQty)(q.holds??[],e.kind,e.id,t)}),label:i})]}),(0,N.jsx)(z.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${l}-remove`,onPress:()=>pe({holds:(0,c.removeEditableHold)(q.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(q.holds??[]).length?null:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==L.status?(0,N.jsxs)(Y,{title:"Status",testID:"edit-section-status",children:[(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>pe({status:e.id})},e.id))}),(0,N.jsx)(z.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,N.jsx)(Y,{title:"Notes",testID:"edit-section-notes",children:(0,N.jsx)(z.Field,{label:"Notes",value:q.notes,onChangeText:e=>pe({notes:e}),placeholder:Te.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),te?(0,N.jsxs)(n.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[te.map(e=>(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,ie?(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:ie}):null,Z?(0,N.jsxs)(n.default,{testID:"edit-discard-warn",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:j.colours.gold,backgroundColor:j.colours.surface2},children:[(0,N.jsx)(z.T,{size:20,weight:"bold",center:!0,children:"Discard unsaved changes?"}),(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.muted,children:"Your changes have not been saved."}),(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:"secondary",label:"Keep editing",testID:"edit-discard-keep",onPress:()=>ee(!1),style:{minHeight:52,flex:1}}),(0,N.jsx)(z.Button,{kind:"danger",label:"Discard changes",testID:"edit-discard-discard",onPress:()=>{ee(!1),m()},style:{minHeight:52,flex:1}})]})]}):null,We.length?(0,N.jsx)(Y,{title:"Changes",testID:"edit-history",children:We.slice(0,12).map((e,t)=>(0,N.jsx)(z.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,N.jsx)(W.CancelBookingButton,{rid:e,b:L,name:L.name,big:!0,onDone:()=>m()}),(0,N.jsx)(W.ReinstateBookingButton,{b:L,name:L.name,today:(0,D.ymd)(new Date),onDone:()=>m()})]})}},1119,[17,1031,85,858,996,993,860,856,1120,1053,1077,845,920,876,994,1090,804,863,1103,1121,815,1122,1104,1087,1099,1100,1101,1123,841,1115,777,840,8]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedDraftFields=W,_e.changedFields=j,_e.historyText=E,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=j(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:E(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${D(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!j(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return x}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: high chair, birthday, quiet table',o='This booking is on the website too. Saving here updates the website booking. The website may email the guest about a new date, time or status.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],u=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],h=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],k=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),w=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return w(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){return l.filter(i=>M(i,e)!==M(i,t))}function j(e,t){return W(y(e),t)}const A=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,D=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function E(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${A(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=k(o.holds),i=k(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${D(s)}`}const x=e=>e.map(e=>f[e]).join(', ')},1120,[1053,1098,1090,1094]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedDraftFields=W,_e.changedFields=j,_e.historyText=E,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=j(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:E(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${D(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!j(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return x}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: high chair, birthday, quiet table',o='This booking is on the website too. Saving here updates the website booking. The website may email the guest about a new date, time or status.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],u=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],h=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],k=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),w=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return w(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){return l.filter(i=>M(i,e)!==M(i,t))}function j(e,t){return W(y(e),t)}const A=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,D=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function E(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${A(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=k(o.holds),i=k(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${D(s)}`}const x=e=>e.map(e=>f[e]).join(', ')},1112,[1053,1098,1090,1094]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FinishConfirm=I,_e.RestoreSeatedConfirm=function({prompt:e,onYes:t,onNo:n}){return(0,k.jsxs)(s.default,{testID:"restore-seated-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:"Yes, seat them",testID:"restore-seated-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"restore-seated-no",onPress:n,style:w})]})},Object.defineProperty(_e,"finishBookingNow",{enumerable:!0,get:function(){return p.finishBookingNow}}),_e.undoFinishedNow=D,_e.restoreFinishedToTable=async function(e,t,s){const o=(0,b.tableKey)(s);await n.repo.bookings.update(t.id,{...(0,f.tablePatch)(o||null),status:'seated',finishedAt:void 0,lastTable:void 0}),o&&(0,p.resetTableLive)(e,o)},_e.offerFinishUndo=F,_e.finishAndOfferUndo=v,_e.finishUnseatedAndOfferUndo=N,_e.FinishButton=function({rid:e,b:s,name:n,allowed:o=!0,hint:c,small:b,bigToast:f,testID:u,label:h="Finished",a11y:p,kind:D="secondary"}){const[F,j]=t.default.useState(!1);if(!o)return null;const x=(0,l.finishConfirmPrompt)({name:n,table:s.table,seatedAt:s.seatedAt,now:new Date,seated:'seated'===s.status});if(F)return(0,k.jsx)(I,{prompt:x,onNo:()=>j(!1),onYes:()=>{j(!1),'seated'===s.status?v(e,[s],n,{big:f,table:s.table}):N(e,s,n,{big:f})}});return(0,k.jsx)(y.Button,{small:b,kind:D,label:h,testID:u,accessibilityLabel:p??`${h}: ${n}`,accessibilityHint:c,disabled:!o,onPress:()=>j(!0),style:b?void 0:w})};var t=e(r(d[0])),s=e(r(d[1])),n=r(d[2]),o=r(d[3]),l=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),u=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]);const w={minHeight:64};function I({prompt:e,onYes:t,onNo:n,yesLabel:o="Yes, finish"}){return(0,k.jsxs)(s.default,{testID:"finish-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:o,testID:"finish-confirm-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"finish-confirm-no",onPress:n,style:w})]})}async function D(e,t,s){const c=(0,l.tableForUndo)(t,s);await n.repo.bookings.update(t.id,(0,l.finishUndoPatch)(c)),c&&(0,o.tablesOf)(c).forEach(t=>o.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function F(e){const t=e.bookings[0];if(!t)return;const s=e.bookings.length>1?`${e.bookings.length} parties finished.`:`${e.name} finished.`,n=e.table?`${(0,c.tableWords)(e.table).replace(/^t/,'T')} needs clearing.`:void 0,o=`finish-undo-${t.id}`;(0,u.notify)({id:o,title:s,body:n,timeoutMs:l.FINISH_UNDO_MS,big:e.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{for(const t of e.bookings)await D(e.rid,{...t,table:void 0,lastTable:t.table||t.lastTable});(0,u.dismissNotice)(o)})()}}]})}async function v(e,t,s,n){const o=n?.table??t.find(e=>e.table)?.table;for(const s of t)await(0,p.finishBookingNow)(e,s);F({rid:e,bookings:t,name:s,table:o,big:n?.big})}async function N(e,t,s,o){await n.repo.bookings.setStatus(t.id,'finished');const c=`finish-undo-${t.id}`;(0,u.notify)({id:c,title:`${s} finished.`,timeoutMs:l.FINISH_UNDO_MS,big:o?.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{await n.repo.bookings.setStatus(t.id,t.walkIn?'cancelled':'confirmed'),(0,u.dismissNotice)(c)})()}}]})}},1113,[17,85,858,996,1111,1114,1094,1090,916,804,777,1096,8]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return s.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return c}}),e.freeTablesNow=function(t,a,s=!1){const l=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),n=l.filter(([,t])=>t.table.maxSeats>=a),o=t=>t.map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}));return s?[...o(n),...o(l.filter(([,t])=>t.table.maxSeatsh[t]&&(l.includes(h[t].status)||'dirty'===h[t].status||'blocked'===h[t].status));if(p.length&&p.every(t=>h[t])&&!t.length)f.push({id:'seat',label:`Seat at ${b(s.table).replace(/^t/,'T')}`,a11y:`Seat ${n}, ${u(s.partySize)}, at ${b(s.table)}`,table:s.table});else if(c(s,$)){const a=p.length?t.length?`${b(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===h[t[0]].status?'waiting to be cleared':'blocked'===h[t[0]].status?'blocked':'in use'}`:`${b(s.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';f.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${n}, ${u(s.partySize)}. ${a}.`,note:a})}c(s,$)&&f.push({id:'finished',label:'Finished',a11y:`Finished, ${n}, ${s.time} booking, without seating at a table`}),o($,s)<=0&&f.push({id:'noshow',label:'No-show',a11y:`No-show, ${n}, ${s.time} booking`})}return f.push({id:'details',label:'Guest details',a11y:`Guest details, ${n}`}),f};var t=r(d[0]),a=r(d[1]),s=r(d[2]);const l=['seated','mains','dessert','bill'],n=t=>new Date(`${t.date}T${t.time}:00`),o=(t,a)=>(n(a).getTime()-t.getTime())/6e4,b=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},u=t=>`${t} ${1===t?'person':'people'}`,c=(t,a)=>o(a,t)<=45},1114,[996,863,1074]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return x}}),_e.cancelWalkInWords=I,_e.reinstateWalkInWords=$,_e.cancelWalkInNow=j,_e.reinstateWalkInNow=C,_e.CancelWalkInButton=function({rid:e,b:t,onDone:o,small:c,big:u}){const[b,f]=(0,n.useState)(!1),k=(0,l.useInStaffApp)(),x=(0,s.useSeatClearFinish)();return p(t)?k&&!x.ok?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(w.Button,{kind:"secondary",small:c,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>f(!0),style:u?{minHeight:64}:c?{minHeight:44}:h}),b?(0,y.jsx)(W,{rid:e,b:t,onClose:()=>f(!1),onDone:o}):null]}):null},_e.CancelWalkInConfirm=W,_e.ReinstateWalkInButton=function({rid:e,b:t,today:o,onDone:u,small:b}){const[f,p]=(0,n.useState)(!1),I=(0,l.useInStaffApp)(),j=(0,s.useSeatClearFinish)();if(!x(t,o))return null;if(I&&!j.ok)return null;const W=$(t);if(!f)return(0,y.jsx)(w.Button,{kind:"ghost",small:b,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>p(!0),style:b?{minHeight:44}:h});return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:()=>p(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:W,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:W})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[h,{flexGrow:1}],onPress:async()=>{await C(e,t),p(!1),u?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>p(!1),style:h})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]),o=r(d[4]),c=(e=o)&&e.__esModule?e:{default:e},u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]),w=r(d[9]),y=r(d[10]);const h={minHeight:56},p=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),x=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function I(e){const t=(0,b.tablesOf)(e.table),n=(0,f.tablesWords)(t);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${t.length?` at ${n}`:''}, arrived ${e.time}? It comes off the Covers${t.length?` and ${n} ${t.length>1?'go':'goes'} back to Free`:''}.`}function $(e){return`Put walk-in ${e.ref} back to seated? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`}async function j(e,n){await u.repo.bookings.setStatus(n.id,'cancelled'),await u.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,b.tablesOf)(n.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function C(e,t){await u.repo.bookings.setStatus(t.id,'seated'),(0,b.tablesOf)(t.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function W({rid:e,b:t,onClose:n,onDone:l}){const s=I(t);return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:s,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:s})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[h,{flexGrow:1}],onPress:async()=>{await j(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,b.tablesOf)(t.table).length?` ${(0,f.tablesWords)((0,b.tablesOf)(t.table))} free.`:''}`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:h})]})]})}},1115,[1116,17,1055,1118,85,858,996,1094,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.cancelStamp=C,_e.cancelBookingNow=w,_e.reinstateBookingNow=$,_e.CancelBookingButton=function({rid:e,b:n,name:o,onDone:s,big:l,small:c}){const[u,f]=(0,t.useState)(!1);return(0,b.canCancelBooking)(n)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(x.Button,{kind:"secondary",small:c,label:"Cancel booking",testID:`cancel-booking-${n.id}`,accessibilityLabel:`Cancel booking for ${o}, ${n.time}, ${n.partySize} Covers`,onPress:()=>f(!0),style:l?{minHeight:64}:c?{minHeight:44}:j}),u?(0,h.jsx)(D,{rid:e,b:n,name:o,onClose:()=>f(!1),onDone:s}):null]}):null},_e.CancelBookingConfirm=D,_e.ReinstateBookingButton=function({b:e,name:n,today:s,onDone:l}){const[c,u]=(0,t.useState)(!1);if(!(0,b.canReinstateBooking)(e,s))return null;const y=(0,b.reinstateBookingWords)(e,n);if(!c)return(0,h.jsx)(x.Button,{kind:"ghost",label:"Undo cancel",testID:`reinstate-booking-${e.id}`,accessibilityLabel:`Undo cancel for ${n}`,onPress:()=>u(!0),style:j});return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:()=>u(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center'},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, put back to booked",testID:"reinstate-booking-yes",accessibilityLabel:`Yes, put ${n} back to booked`,style:[j,{flexGrow:1}],onPress:async()=>{await $(e),u(!1),l?.(`${n} put back to booked.`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-booking-no",onPress:()=>u(!1),style:j})]})]})};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]),c=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]),y=r(d[8]),k=r(d[9]),p=r(d[10]),x=r(d[11]),h=r(d[12]);const j={minHeight:56},B={display:'Display',owner:'Managers app',staff:'Staff app',chef:'Kitchen app',customer:'Customer page'};function C(e){const t=y.useSession.getState().meId,n=t?k.useOwner.getState().staff.find(e=>e.id===t):void 0,o=B[p.APP_VARIANT]??'CoverCharge';return{by:n?`${n.name.replace(' (example)','')} (${o})`:o,at:(new Date).toISOString(),app:o,...e.table?{table:e.table}:{}}}async function w(e,t){const n=(0,l.tablesOf)(t.table);await s.repo.bookings.update(t.id,{status:'cancelled',cancelled:C(t),...(0,c.tablePatch)(null)}),n.forEach(t=>l.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function $(e){await s.repo.bookings.setStatus(e.id,'confirmed')}function D({rid:e,b:t,name:n,onClose:s,onDone:c}){const y=(0,b.cancelBookingWords)(t,n),k=(0,l.tablesOf)(t.table);return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:s,title:"Cancel booking?",maxWidth:560,testID:"cancel-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center',gap:8},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, cancel booking",testID:"cancel-booking-yes",accessibilityLabel:`Yes, cancel booking for ${n}`,style:[j,{flexGrow:1}],onPress:async()=>{await w(e,t),s(),c?.(`${n} cancelled.${k.length?` ${(0,u.tablesWords)(k)} free.`:''}`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep booking",testID:"cancel-booking-no",accessibilityLabel:`Keep booking for ${n}`,onPress:s,style:j})]})]})}},1116,[17,85,858,996,1090,1117,1094,804,920,876,856,777,8]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canCancelBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canReinstateBooking",{enumerable:!0,get:function(){return t}}),e.cancelBookingWords=function(n,t){const o=`${n.partySize} Cover${1===n.partySize?'':'s'}`;return`Cancel booking for ${t}, ${n.time}, ${o}? The table is freed. Website bookings will cancel it on the website and may email the guest.`},e.reinstateBookingWords=function(n,t){return`Put ${t} back to booked for ${n.time}? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`},e.cancelledOnDay=o,e.cancelledDayTally=function(n,t){const a=o(n,t),l=a.filter(n=>!!n.walkIn),c=a.filter(n=>!n.walkIn);return{count:a.length,covers:a.reduce((n,t)=>n+t.partySize,0),bookings:c.length,bookingCovers:c.reduce((n,t)=>n+t.partySize,0),walkIns:l.length,walkInCovers:l.reduce((n,t)=>n+t.partySize,0),list:a}},e.cancelledTallyWords=function(n,t="today"){if(!n.count)return`No cancellations ${t}`;const o=[],a=n.bookings??0,l=n.walkIns??0;a&&o.push(`${a} booking${1===a?'':'s'} (${n.bookingCovers??0} Cover${1===(n.bookingCovers??0)?'':'s'})`);l&&o.push(`${l} walk-in${1===l?'':'s'} (${n.walkInCovers??0} Cover${1===(n.walkInCovers??0)?'':'s'})`);if(!o.length)return`Cancelled ${t}: ${n.count} \xb7 ${n.covers} Cover${1===n.covers?'':'s'}`;return`Cancelled ${t}: ${o.join(' \xb7 ')}`};const n=n=>!n.walkIn&&('confirmed'===n.status||'pending'===n.status||'seated'===n.status),t=(n,t)=>!n.walkIn&&'cancelled'===n.status&&n.date>=t;function o(n,t){return n.filter(n=>n.date===t&&'cancelled'===n.status).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name))}},1117,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSeatClearFinish=function(){const t=(0,A.useSignedIn)(),o=(0,A.useInStaffApp)(),_='staff'===s.APP_VARIANT||'chef'===s.APP_VARIANT||o,l=(0,c.canSeatClearFinish)({device:s.IS_CAR||'display'===s.APP_VARIANT||!_&&!t,viaDisplay:(0,n.isKitchenViaDisplay)(),role:t?.role,ownerAccess:t?.ownerAccess,managerAccess:t?.managerAccess});return{ok:l,hint:l?void 0:c.SEAT_CLEAR_HINT}};var s=r(d[0]),n=r(d[1]),c=r(d[2]),A=r(d[3])},1118,[856,922,1119,1055]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEAT_CLEAR_HINT",{enumerable:!0,get:function(){return n}}),e.canSeatClearFinish=function(n){return!(!n.device&&!n.viaDisplay)||('owner'===n.role||'manager'===n.role||!(!n.ownerAccess&&!n.managerAccess))};const n='Ask a manager to seat, finish or clear a table.'},1119,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:s,who:i,role:n,inStaffApp:l,shiftManager:a,big:o,testID:d}){const[h,u]=(0,t.useState)(!1),p=(0,b.useSession)(e=>e.meId),y=(0,m.useOwner)(e=>e.staff.find(e=>e.id===p&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:l,role:n,shiftManager:a})||p&&!(0,x.canChangeBookings)(y)?null:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:d??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),h?(0,N.jsx)(V,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:n,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,l.useBookings)(e).filter(e=>!e.walkIn&&e.date>=s&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,200);return o?(0,N.jsx)(V,{rid:e,id:o,who:i,hidePrivate:a,onClose:n}):(0,N.jsxs)(z.Sheet,{visible:!0,onClose:n,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,N.jsx)(z.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${L(e.date,s)} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${L(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,N.jsx)(z.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,N.jsx)(z.Button,{kind:"ghost",label:"Close",onPress:n,style:{minHeight:44}})]})},_e.EditBookingSheet=V;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=(e=i)&&e.__esModule?e:{default:e},l=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),f=_r(_d[19]),C=_r(_d[20]),I=_r(_d[21]),k=_r(_d[22]),w=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),O=_r(_d[28]),W=_r(_d[29]),z=_r(_d[30]),B=_r(_d[31]),N=_r(_d[32]);const E=/^([01]\d|2[0-3]):[0-5]\d$/,R=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const L=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,D.ymd)(s)?'Tomorrow':F(e)};const A=e=>e?(e/100).toFixed(e%100?2:0):'',M=e=>{const t=(0,B.parseMoneyInput)(e);return null!=t&&t>=0?Math.round(100*t):NaN},F=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',H=e=>{const t=e.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);return t?`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`:''},_=e=>e.charAt(0).toUpperCase()+e.slice(1);function Y({title:e,children:t,testID:s}){return(0,N.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,N.jsx)(z.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const G=({label:e,value:t,onChange:s,max:i=20,testID:n})=>(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:e}),(0,N.jsx)(z.Stepper,{testID:n,value:t,min:0,max:i,onChange:s,label:e})]});function V({rid:e,id:i,who:b,onClose:m,hidePrivate:x=!1}){(0,$.useBlurOutside)();const B=(0,l.useBookings)(e),L=B.find(e=>e.id===i),V=(0,d.useRestaurant)(e),K=(0,a.usePlan)(e),U=(0,o.useBlocks)(e=>e.blocks),[q,X]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Q,J]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Z,ee]=(0,t.useState)(!1),[te,se]=(0,t.useState)(null),[ie,ne]=(0,t.useState)(null),[le,ae]=(0,t.useState)(!1),[oe,de]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositDue:0)),[re,ce]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositAmount:0)),[he,ue]=(0,t.useState)(F(L?(0,c.draftOf)(L).depositDate:''));if(!L||!q||!V)return null;const pe=e=>{se(null),ne(null),X({...q,...e})},ge=(0,O.depositOf)(V.settings),be=e=>{const t=e.partySize??q.partySize,s=Math.min(e.children??q.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(L)&&q.depositOn&&!q.depositPaid&&M(oe||'0')===(0,O.depositDue)(ge,q.partySize,q.children??0)){const e=(0,O.depositDue)(ge,t,s);e>0&&de(A(e))}pe({...e,children:s})},me=(0,v.bookingSlotMinutesOf)(V),xe=R(q.time),ye=E.test(xe),je=q.area?K.areas.filter(e=>e.name===q.area).map(e=>e.id):null,De=e=>!je||e.split('+').every(e=>je.includes(K.tables.find(t=>t.name===e)?.areaId??'')),ve=(0,y.tableOptions)(K,B.filter(e=>e.date===q.date),q.table).filter(e=>De(e)||e===q.table),fe=!(q.depositOn&&(Number.isNaN(M(oe||'0'))||q.depositPaid&&(Number.isNaN(M(re||'0'))||he.trim()&&!H(he)))),Ce={...q,time:xe,depositDue:M(oe||'0')||0,depositAmount:M(re||'0')||0,depositDate:H(he)},Ie=(0,c.changedDraftFields)(Q??(0,c.draftOf)(L),Ce),ke=V.settings.turnMins??90,we=!!q?.email?.trim()&&q.email.trim()!==(L?.email??'').trim(),Te=(0,u.bookingRulesOf)(V),Se=async()=>{const t=(0,c.editPatch)(L,Ce,{by:b||'Team member',app:r.APP_VARIANT});if(le&&we&&Object.assign(t,(0,u.marketingChoice)(Ce.email,!0)),Object.keys(t).length&&await l.repo.bookings.update(L.id,t),'seated'===L.status&&'table'in t&&t.table!==L.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(L.table),n=s(t.table),l=a.useFloor.getState(),o=i.map(t=>l.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!n.includes(e)).forEach(t=>l.setLive(e,t,{stage:void 0,dirty:!0})),n.forEach(t=>l.setLive(e,t,{stage:o,dirty:!1}))}ne(`Saved. Changed: ${(0,c.editedWords)(Ie)}.`),se(null),m()},$e=()=>{const t=ye?(0,o.blockAt)(U,e,q.date,xe):void 0,s=(0,c.editWarnings)(L,Ce,B,t,ke,K);!s.length||te?Se():se(s)},Pe=q.allergies??[],Oe=e=>pe({allergyNone:!1,allergies:Pe.some(t=>t.allergen===e)?Pe.filter(t=>t.allergen!==e):[...Pe,{allergen:e,severity:'allergy'}]}),We=(0,c.historyLines)(L);return(0,N.jsxs)(z.Sheet,{visible:!0,onClose:()=>{Ie.length?ee(!0):(ee(!1),m())},title:`Edit booking \xb7 ${L.name} \xb7 ${L.ref}`,maxWidth:760,testID:"edit-booking-sheet",onTypingDone:()=>{(0,C.hideKeyboard)(),Ie.length&&ye&&fe&&q.name.trim().length>=1&&$e()},typingDoneLabel:Ie.length?'Done, save changes':'Done, hide the keyboard',footer:(0,N.jsx)(z.Button,{label:te?'Save anyway':'Save changes',testID:"edit-save",disabled:!ye||!fe||q.name.trim().length<1||!Ie.length,onPress:$e,style:{minHeight:56,width:'100%'}}),children:[(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(w.DepositChip,{b:L,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(L)?(0,N.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,N.jsxs)(Y,{title:"Deposit",testID:"edit-section-deposit",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No deposit",selected:!q.depositOn,testID:"edit-deposit-none",onPress:()=>pe({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit due",selected:!!q.depositOn&&!q.depositPaid&&!q.depositWaived,testID:"edit-deposit-due",onPress:()=>pe({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit paid",selected:!!q.depositOn&&!!q.depositPaid,testID:"edit-deposit-paid",onPress:()=>{re||ce(oe),he||ue(F((0,D.ymd)(new Date))),pe({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsx)(z.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsxs)(z.T,{size:15,center:!0,colour:j.colours.goldLight,testID:"edit-deposit-waived-by",children:[L.depositWaived?.by?(0,O.waiverText)(L.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,q.depositWaived||Ie.includes('deposit')?null:(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(P.WaiveDepositButton,{b:L,who:b,onDone:e=>{const t={...q,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e};X(t),J(s=>s?{...s,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e}:t)}})}),q.depositOn?(0,N.jsx)(z.Field,{money:!0,label:"Deposit due (\xa3)",value:oe,onChangeText:e=>{de(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,q.depositOn&&q.depositPaid?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Field,{money:!0,label:"Amount paid (\xa3)",value:re,onChangeText:e=>{ce(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"How was it paid?"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,N.jsx)(z.Chip,{label:_(e),selected:q.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>pe({depositMethod:e})},e))}),(0,N.jsx)(z.Field,{label:"Date paid (DD/MM/YYYY)",value:he,onChangeText:e=>{ue((0,s.slashDate)(e,he)),pe({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),he.trim()&&!H(he)?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,fe?null:(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,N.jsx)(z.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,N.jsxs)(Y,{title:"When",testID:"edit-section-when",children:[(0,N.jsx)(k.BookingDatePicker,{r:V,today:new Date,value:q.date,onChange:e=>pe({date:e})}),(0,N.jsx)(I.TimeRoller,{testID:"edit-time",value:(0,f.snapTime)(q.time,me),onChange:e=>pe({time:e}),step:me}),ye?null:(0,N.jsx)(z.T,{size:15,colour:j.colours.amber,center:!0,children:"Choose a time on the roller."}),(0,N.jsx)(T.AdultsChildren,{value:(0,S.peopleOf)(q.partySize,q.children),onChange:e=>be(e),depositsOn:ge.on&&ge.perPersonPence>0,testID:"edit-people"}),(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:"Table time"}),(0,N.jsx)(z.Stepper,{testID:"edit-duration",value:q.duration||0,min:0,max:360,step:15,onChange:e=>pe({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,N.jsxs)(Y,{title:"Where",testID:"edit-section-where",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"Any area",selected:!q.area,testID:"edit-area-any",onPress:()=>pe({area:''})}),K.areas.map(e=>(0,N.jsx)(z.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:q.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>pe({area:e.name})},e.id))]}),(0,N.jsx)(z.T,{size:18,weight:"semibold",center:!0,children:(0,y.tableButtonLabel)(q.table)}),(0,y.splitChoices)(q.table).length?(0,N.jsxs)(n.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:"Split the joined tables"}),(0,N.jsx)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,y.splitChoices)(q.table).map(e=>(0,N.jsx)(z.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>pe({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:q.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(q.table?'':', chosen'),onPress:()=>pe({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),ve.map(e=>(0,N.jsx)(z.Button,{kind:e===q.table?'primary':'secondary',label:(0,y.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,y.tableButtonLabel)(e)}${e===q.table?', chosen':''}`,onPress:()=>pe({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,N.jsxs)(Y,{title:"Guest",testID:"edit-section-guest",children:[(0,N.jsx)(z.Field,{label:"Name",value:q.name,onChangeText:e=>pe({name:e}),testID:"edit-name"}),(0,N.jsx)(z.Field,{label:"Phone",value:q.phone,onChangeText:e=>pe({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,N.jsx)(z.Field,{label:"Email",value:q.email,onChangeText:e=>pe({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),we&&Te.marketingOptIn?(0,N.jsx)(z.Toggle,{label:Te.marketingWords,value:le,onChange:ae,testID:"edit-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,N.jsx)(z.T,{size:16,center:!0,children:"Booked by"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>pe({source:e.id})},e.id))}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(q.tags??[]).includes(e);return(0,N.jsx)(z.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>pe({tags:t?(q.tags??[]).filter(t=>t!==e):[...q.tags??[],e].sort()})},e)})})]}),(0,N.jsxs)(Y,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,N.jsx)(G,{label:"Dogs",value:q.dogs??0,max:6,onChange:e=>pe({dogs:e}),testID:"edit-dogs"}),(0,N.jsx)(G,{label:"High chairs",value:q.highChairs??0,max:10,onChange:e=>pe({highChairs:e}),testID:"edit-high-chairs"}),(0,N.jsx)(G,{label:"Wheelchair users",value:q.wheelchair??0,max:10,onChange:e=>pe({wheelchair:e}),testID:"edit-wheelchair"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"Occasion"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:(q.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>pe({occasion:e.id})},e.id||'none'))})]}),(0,N.jsxs)(Y,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No allergies",selected:!!q.allergyNone&&!Pe.length,testID:"edit-allergy-none",onPress:()=>pe({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,N.jsx)(z.Chip,{label:e.short,selected:Pe.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>Oe(e.id)},e.id))]}),Pe.map(e=>(0,N.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,N.jsxs)(z.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,N.jsx)(z.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>pe({allergies:Pe.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,N.jsx)(z.Field,{label:"Anything else about allergies",value:q.allergyNote,onChangeText:e=>pe({allergyNote:e}),testID:"edit-allergy-note"}),Ie.includes('allergies')&&Pe.length?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,N.jsx)(G,{label:"Vegan",value:q.vegan??0,max:q.partySize,onChange:e=>pe({vegan:e}),testID:"edit-vegan"}),(0,N.jsx)(G,{label:"Vegetarian",value:q.vegetarian??0,max:q.partySize,onChange:e=>pe({vegetarian:e}),testID:"edit-vegetarian"})]}),(q.holds??[]).length||(L.holds??[]).some(e=>e.qty>0&&!e.served)?(0,N.jsxs)(Y,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,N.jsx)(z.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(q.holds??[]).map(e=>{const t=(0,h.reservablesOf)(V),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),l=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,N.jsxs)(n.default,{testID:l,style:{gap:6,width:'100%'},children:[(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,N.jsx)(z.Stepper,{testID:l,value:e.qty,min:0,max:20,onChange:t=>pe({holds:(0,c.setEditableHoldQty)(q.holds??[],e.kind,e.id,t)}),label:i})]}),(0,N.jsx)(z.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${l}-remove`,onPress:()=>pe({holds:(0,c.removeEditableHold)(q.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(q.holds??[]).length?null:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==L.status?(0,N.jsxs)(Y,{title:"Status",testID:"edit-section-status",children:[(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>pe({status:e.id})},e.id))}),(0,N.jsx)(z.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,N.jsx)(Y,{title:"Notes",testID:"edit-section-notes",children:(0,N.jsx)(z.Field,{label:"Notes",value:q.notes,onChangeText:e=>pe({notes:e}),placeholder:Te.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),te?(0,N.jsxs)(n.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[te.map(e=>(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,ie?(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:ie}):null,Z?(0,N.jsxs)(n.default,{testID:"edit-discard-warn",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:j.colours.gold,backgroundColor:j.colours.surface2},children:[(0,N.jsx)(z.T,{size:20,weight:"bold",center:!0,children:"Discard unsaved changes?"}),(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.muted,children:"Your changes have not been saved."}),(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:"secondary",label:"Keep editing",testID:"edit-discard-keep",onPress:()=>ee(!1),style:{minHeight:52,flex:1}}),(0,N.jsx)(z.Button,{kind:"danger",label:"Discard changes",testID:"edit-discard-discard",onPress:()=>{ee(!1),m()},style:{minHeight:52,flex:1}})]})]}):null,We.length?(0,N.jsx)(Y,{title:"Changes",testID:"edit-history",children:We.slice(0,12).map((e,t)=>(0,N.jsx)(z.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,N.jsx)(W.CancelBookingButton,{rid:e,b:L,name:L.name,big:!0,onDone:()=>m()}),(0,N.jsx)(W.ReinstateBookingButton,{b:L,name:L.name,today:(0,D.ymd)(new Date),onDone:()=>m()})]})}},1120,[17,1031,85,858,996,993,860,856,1112,1053,1077,845,920,876,994,1090,804,863,1103,1121,815,1122,1104,1087,1099,1100,1101,1123,841,1116,777,840,8]); __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.hmToMins=n,e.minsToHm=o,e.snapTime=u,e.hourValues=function(){return Array.from({length:24},(t,n)=>n)},e.minuteValues=function(t){const n=t>0&&t<=60&&60%t==0?t:15,o=[];for(let t=0;t<60;t+=n)o.push(t);return o},e.splitHm=function(o){const i=n(t.test(o)?o:u(o,15));return Number.isFinite(i)?{hour:Math.floor(i/60),minute:i%60}:{hour:12,minute:0}},e.joinHm=function(t,n){const o=(n%60+60)%60;return`${String((t%24+24)%24).padStart(2,'0')}:${String(o).padStart(2,'0')}`},e.timeRollerHint=function(t){return`24-hour. Times are every ${t>0?t:15} minutes. Roll or swipe each wheel. No typing.`};const t=/^([01]\d|2[0-3]):[0-5]\d$/;function n(t){const n=t.trim().match(/^(\d{1,2}):(\d{2})$/);if(!n)return NaN;const o=Number(n[1]),u=Number(n[2]);return o>23||u>59?NaN:60*o+u}function o(t){const n=(Math.round(t)%1440+1440)%1440,o=Math.floor(n/60),u=n%60;return`${String(o).padStart(2,'0')}:${String(u).padStart(2,'0')}`}function u(t,u){const i=u>0&&u<=60&&60%u==0?u:15,s=n(t),c=Number.isFinite(s)?s:720;return o(Math.round(c/i)*i)}},1121,[]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TimeRoller=function({value:e,onChange:t,step:n=15,testID:u="time-roller"}){const{hour:h,minute:m}=(0,s.splitHm)(e),f=(0,s.hourValues)(),x=(0,s.minuteValues)(n),p=f.indexOf(h),y=x.reduce((e,t)=>Math.abs(t-m)t((0,s.joinHm)(f[e],y)),label:"Hours",format:e=>String(e).padStart(2,'0'),testID:`${u}-hours`}),(0,c.jsx)(b,{values:x,index:j<0?0:j,onChange:e=>t((0,s.joinHm)(h,x[e])),label:"Minutes",format:e=>String(e).padStart(2,'0'),testID:`${u}-minutes`})]})]}),(0,c.jsx)(l.T,{size:13,center:!0,colour:o.colours.muted,children:(0,s.timeRollerHint)(n)})]})};var t=r(_d[0]),n=e(r(_d[1])),i=e(r(_d[2])),o=r(_d[3]),s=r(_d[4]),l=r(_d[5]),c=r(_d[6]);const d=48,u=5,h=2;function m(e,t){return(e%t+t)%t}function b({values:e,index:s,onChange:b,label:f,format:x,testID:p}){const y=(0,t.useRef)(null),j=(0,t.useRef)(0),v=e.length,w=e[m(s,v)],R=`${x(w)} ${f.toLowerCase()}`,S=e=>b(m(s+e,v)),T=()=>{y.current=null,j.current=0};return(0,c.jsx)(i.default,{testID:p,accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:f,accessibilityValue:{min:e[0],max:e[v-1],now:w,text:R},accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{'increment'===e.nativeEvent.actionName&&S(1),'decrement'===e.nativeEvent.actionName&&S(-1)},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{y.current=e.nativeEvent.pageY,j.current=0},onResponderMove:e=>{if(null==y.current)return;const t=e.nativeEvent.pageY-y.current;for(y.current=e.nativeEvent.pageY,j.current+=t;j.current<=-24;)S(1),j.current+=d;for(;j.current>=24;)S(-1),j.current-=d},onResponderRelease:T,onResponderTerminate:T,style:{width:120,height:240,alignItems:'center'},children:Array.from({length:u},(t,i)=>{const u=i-h,b=e[m(s+u,v)],f=0===u,p=2===Math.abs(u);return(0,c.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",onPress:()=>{u&&S(u)},style:{height:d,width:'100%',alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:f?28:p?18:22,weight:f?'bold':'medium',colour:f?o.colours.goldLight:o.colours.muted,center:!0,style:{opacity:f?1:p?.35:.7},children:x(b)})},`${i}-${b}`)})})}},1122,[17,385,85,804,1121,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1123,[17,85,858,856,1120,841,1095,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1123,[17,85,858,856,1112,841,1095,804,777,8]); __d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingHistory=function({rid:e,today:t}){const[b,k]=(0,s.useState)((0,n.addDaysIso)(t,-1)),[w,v]=(0,s.useState)('day'),[p,f]=(0,s.useState)((0,n.ddmmyyyy)((0,n.addDaysIso)(t,-1))),[D,$]=(0,s.useState)(!1),[_,I]=(0,s.useState)(0),T=(0,n.historyRange)(w,b,t),C=(0,c.useKitchenHistory)(e,T.from,T.to,t,_),P=(0,d.parseHistoryInput)(p),B=!!P&&(0,d.validPastDate)(P,t),L=e=>{(0,d.validPastDate)(e,t)&&(k(e),f((0,n.ddmmyyyy)(e)))};if(!C.allowed)return(0,h.jsx)(l.Card,{children:(0,h.jsx)(l.T,{size:20,center:!0,children:"Booking history is for the Head Chef and managers. Sign in to the Head Chef app to see it."})});const z='day'===w?1:7,S=(0,n.addDaysIso)('day'===w?b:(0,n.mondayOf)(b),-z),R='day'===w?(0,n.addDaysIso)(b,1):(0,n.addDaysIso)((0,n.mondayOf)(b),7),W='day'===w?'day':'week';return(0,h.jsxs)(o.default,{style:{gap:14},testID:"booking-history",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:12,alignItems:'stretch'},children:[(0,h.jsx)(l.T,{size:18,center:!0,children:"Bookings, covers and walk-ins on past days. Read-only; nothing is changed."}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:'day'===w?'primary':'secondary',testID:"bh-mode-day",label:"One day",accessibilityLabel:"Show one day"+('day'===w?', selected':''),onPress:()=>v('day')}),(0,h.jsx)(l.Button,{kind:'week'===w?'primary':'secondary',testID:"bh-mode-week",label:"Whole week",accessibilityLabel:"Show the whole week, Monday to Sunday"+('week'===w?', selected':''),onPress:()=>v('week')})]}),(0,h.jsx)(l.Field,{label:"Past date (DD/MM/YYYY)",value:p,onChangeText:e=>f((0,i.slashDate)(e,p)),placeholder:"09/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Past date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"bh-date",style:{textAlign:'center'}}),B?null:(0,h.jsx)(l.T,{size:16,center:!0,testID:"bh-date-hint",children:"Enter a past date as DD/MM/YYYY, for example 09/11/2026."}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:"secondary",label:"Pick a date",testID:"bh-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${u(b)}`,onPress:()=>$(!0)}),(0,h.jsx)(l.Button,{label:"Show",testID:"bh-show",accessibilityLabel:`Show booking history for ${B&&P?u(P):'a valid past date'}`,disabled:!B,onPress:()=>{P&&L(P),I(_+1)}})]}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:"secondary",testID:"bh-prev",label:`Previous ${W}`,accessibilityLabel:`Previous ${W}, ${u(S)}`,onPress:()=>L(S)}),(0,h.jsx)(l.Button,{kind:"secondary",testID:"bh-next",label:`Next ${W}`,accessibilityLabel:(0,d.validPastDate)(R,t)?`Next ${W}, ${u(R)}`:`Next ${W}, not available. Booking history is for past days only`,disabled:!(0,d.validPastDate)(R,t),onPress:()=>L(R)})]}),'day'===w?(0,h.jsx)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:(0,h.jsx)(l.Button,{small:!0,kind:"secondary",testID:"bh-prev-week",label:"Same day last week",accessibilityLabel:`Same day last week, ${u((0,n.addDaysIso)(b,-7))}`,onPress:()=>L((0,n.addDaysIso)(b,-7))})}):null]})}),(0,h.jsx)(y.LookBackCalendar,{visible:D,today:t,selected:b,purpose:"Booking history",idPrefix:"bh",onClose:()=>$(!1),onPick:e=>{L(e),$(!1)}}),C.data?'day'===w?C.data.days[0]?(0,h.jsx)(x,{d:C.data.days[0]}):null:(0,h.jsx)(j,{days:C.data.days,onDay:e=>{L(e),v('day')}}):(0,h.jsx)(l.Card,{children:(0,h.jsx)(o.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(l.T,{size:20,center:!0,testID:"bh-status",children:C.error||'Loading booking history\u2026'})})})]})};var e,s=r(_d[0]),t=r(_d[1]),o=(e=t)&&e.__esModule?e:{default:e},l=r(_d[2]),i=r(_d[3]),d=r(_d[4]),n=r(_d[5]),c=r(_d[6]),y=r(_d[7]),b=r(_d[8]),h=r(_d[9]);const u=e=>`${(0,n.dayName)(e)} ${(0,n.ddmmyyyy)(e)}`,k=({label:e,value:s,id:t})=>(0,h.jsxs)(o.default,{testID:`bh-stat-${t}`,accessible:!0,accessibilityLabel:`${e}: ${s}`,style:{alignItems:'center',minWidth:96,padding:8,borderRadius:12,borderWidth:1,borderColor:b.colours.border},children:[(0,h.jsx)(l.T,{size:28,weight:"bold",colour:b.colours.gold,center:!0,children:String(s)}),(0,h.jsx)(l.T,{size:16,center:!0,children:e})]});function x({d:e}){return(0,h.jsxs)(o.default,{style:{gap:12},testID:"bh-day",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:10,alignItems:'center'},accessible:!0,accessibilityLabel:(0,n.dayText)(e)+`. Done: ${e.done_covers+e.walk_in_covers} covers.`,children:[(0,h.jsx)(l.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:u(e.date)}),(0,h.jsx)(o.default,{testID:"bh-stats",style:{alignSelf:'stretch'},children:(0,h.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(k,{id:"bookings",label:"Bookings",value:e.bookings}),(0,h.jsx)(k,{id:"booked",label:"Booked covers",value:e.booked_covers}),(0,h.jsx)(k,{id:"walkins",label:"Walk-ins",value:e.walk_ins}),(0,h.jsx)(k,{id:"walkin-covers",label:"Walk-in covers",value:e.walk_in_covers}),(0,h.jsx)(k,{id:"done",label:"Done",value:e.done_covers+e.walk_in_covers}),(0,h.jsx)(k,{id:"total",label:"Total",value:e.total_covers})]})}),e.not_counted?(0,h.jsxs)(l.T,{size:16,center:!0,children:[e.not_counted," cancelled or no-show ",1===e.not_counted?'booking is':'bookings are'," listed but not counted."]}):null,e.old_records?(0,h.jsx)(l.T,{size:16,center:!0,colour:b.colours.muted,children:"Includes records from the previous booking system, which may be incomplete."}):null]})}),(e.lines??[]).length||e.walk_ins?null:(0,h.jsx)(l.Card,{children:(0,h.jsx)(l.T,{size:18,center:!0,children:"No bookings or walk-ins recorded for this day."})}),(e.lines??[]).map((e,s)=>(0,h.jsx)(o.default,{testID:"bh-line",accessible:!0,accessibilityLabel:(0,n.lineText)(e),style:{padding:10,borderRadius:12,borderWidth:1,borderColor:b.colours.border,alignItems:'center',opacity:e.counted?1:.7},children:(0,h.jsxs)(l.Row,{wrap:!0,gap:14,style:{justifyContent:'center'},children:[(0,h.jsx)(l.T,{size:20,weight:"bold",colour:b.colours.gold,children:e.time??'No time'}),(0,h.jsx)(l.T,{size:18,children:null==e.covers?'Covers not recorded':`${e.covers} ${1===e.covers?'cover':'covers'}`}),(0,h.jsx)(l.T,{size:18,children:e.table?`Table ${e.table}`:'No table'}),(0,h.jsx)(l.T,{size:18,children:(0,n.statusWord)(e.status)})]})},s))]})}function j({days:e,onDay:s}){const t=(0,n.sumDays)(e);return(0,h.jsxs)(o.default,{style:{gap:12},testID:"bh-week",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:10,alignItems:'center'},accessible:!0,accessibilityLabel:`Week ${(0,n.ddmmyyyy)(e[0].date)} to ${(0,n.ddmmyyyy)(e[e.length-1].date)}: ${t.bookings} bookings, ${t.booked_covers} booked covers, ${t.walk_ins} walk-ins with ${t.walk_in_covers} covers, ${t.total_covers} covers in total`,children:[(0,h.jsxs)(l.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:["Week ",(0,n.ddmmyyyy)(e[0].date)," to ",(0,n.ddmmyyyy)(e[e.length-1].date)]}),(0,h.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(k,{id:"week-bookings",label:"Bookings",value:t.bookings}),(0,h.jsx)(k,{id:"week-walkins",label:"Walk-ins",value:t.walk_ins}),(0,h.jsx)(k,{id:"week-total",label:"Total",value:t.total_covers})]})]})}),e.map(e=>(0,h.jsx)(l.Button,{kind:"secondary",testID:`bh-week-day-${e.date}`,label:`${(0,n.day3)(e.date)} ${(0,n.ddmmyyyy)(e.date)} \xb7 ${e.bookings} booked (${e.booked_covers}) \xb7 ${e.walk_ins} walk-in (${e.walk_in_covers}) \xb7 Total ${e.total_covers}`,accessibilityLabel:`${(0,n.dayText)(e)}. Double tap to see this day's bookings.`,onPress:()=>s(e.date)},e.date))]})}},1124,[17,85,777,1031,1062,1125,1061,1048,804,8]); __d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"addDaysIso",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ddmmyyyy",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"day3",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"dayName",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"mondayOf",{enumerable:!0,get:function(){return l}}),e.historyRange=function(o,t,s){if('day'===o)return{from:t,to:t};const a=l(t),c=n(a,6),d=n(s,-1);return{from:a,to:c({bookings:o.bookings+t.bookings,booked_covers:o.booked_covers+t.booked_covers,walk_ins:o.walk_ins+t.walk_ins,walk_in_covers:o.walk_in_covers+t.walk_in_covers,total_covers:o.total_covers+t.total_covers}),{bookings:0,booked_covers:0,walk_ins:0,walk_in_covers:0,total_covers:0})};const o=o=>o.toISOString().slice(0,10),t=o=>new Date(o+'T12:00:00Z'),n=(n,s)=>{const a=t(n);return a.setUTCDate(a.getUTCDate()+s),o(a)},s=o=>`${o.slice(8,10)}/${o.slice(5,7)}/${o.slice(0,4)}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],c=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=o=>a[t(o).getUTCDay()],u=o=>c[t(o).getUTCDay()],l=o=>n(o,-(t(o).getUTCDay()+6)%7);function b(o){switch((o??'').toLowerCase()){case'finished':case'seated':return'Done';case'confirmed':case'booked':case'amended':return'Booked';case'cancelled':return'Cancelled';case'noshow':return'No-show';default:return o||'Not recorded'}}const y=(o,t,n)=>`${o} ${1===o?t:n}`},1125,[]); __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TempUnitsSetup=function(){const e=(0,f.useSync)(e=>e.mode),s='live'===e||'offline'===e||'connecting'===e,o=(0,c.useSafety)(e=>e.points),b=(0,d.useOwner)(e=>e.site),[k,j]=(0,t.useState)(()=>(0,u.draftsFrom)(c.useSafety.getState().points)),[$,S]=(0,t.useState)(null),[I,w]=(0,t.useState)(!1),[T,D]=(0,t.useState)(''),[C,L]=(0,t.useState)(1),B=(0,t.useMemo)(()=>(0,u.changesOf)(k,o),[k,o]),z=e=>(0,h.chefCanSee)(b,e),A=Object.fromEntries(k.map(e=>[e.key,(0,u.problemOf)(e,k,z)])),P=Object.values(A).some(Boolean),R=e=>{j(t=>t.map(t=>t.key===e.key?e:t)),D(''),w(!1)},_=k.filter(e=>!e.archived),O=k.filter(e=>e.archived&&e.id),F=_.filter(e=>'fridge'===e.kind).length,H=_.length-F,M=e=>{const t=`new${C}`;L(C+1),D(''),w(!1),j(s=>[...s,{key:t,name:'',kind:e,location:'',max:String(u.DEFAULT_MAX[e]),due:'09:00, 16:00',archived:!1}])},W=P?'Fix the unit marked in red first.':B.length?`${B.length} change${1===B.length?'':'s'} not saved yet.`:'No changes yet.';return(0,x.jsxs)(n.default,{testID:"tu-setup",style:{gap:12,alignSelf:'center',width:'100%',maxWidth:560,alignItems:'stretch'},children:[(0,x.jsx)(l.T,{weight:"semibold",size:18,center:!0,accessibilityRole:"header",children:"Temperature units"}),(0,x.jsx)(l.T,{testID:"tu-count",size:15,center:!0,children:`${F} fridge${1===F?'':'s'} and ${H} freezer${1===H?'':'s'} checked`}),(0,x.jsx)(p.TempSaveBanner,{testID:"tu-save-banner"}),(0,x.jsx)(l.Banner,{kind:"info",title:s?'Shared with every device':'Not connected yet',children:s?'These units and their readings are on the shared food safety log, so every phone, tablet and screen at the venue shows the same units.':'These units are saved on this device until it connects. Then they are shared with every device at the venue.'}),_.map(e=>(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsx)(v,{d:e,problem:A[e.key],onChange:R,onArchive:()=>e.id?S(e.key):j(t=>t.filter(t=>t.key!==e.key))}),$===e.key?(0,x.jsxs)(n.default,{testID:"tu-archive-ask",style:{gap:8,padding:12,borderRadius:12,backgroundColor:y.colours.amberBg,alignItems:'center'},children:[(0,x.jsx)(l.T,{size:15,center:!0,children:`Archive ${e.name.trim()||'this unit'}? It will no longer be checked. Its past readings stay in History and the EHO report. Nothing is deleted.`}),(0,x.jsxs)(l.Row,{gap:8,children:[(0,x.jsx)(l.Button,{small:!0,testID:"tu-archive-confirm",label:"Archive",accessibilityLabel:`Yes, archive ${e.name}`,onPress:()=>{R({...e,archived:!0}),S(null)}}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-archive-cancel",label:"Keep it",accessibilityLabel:`No, keep ${e.name}`,onPress:()=>S(null)})]})]}):null]},e.key)),(0,x.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-add-fridge",label:"Add a fridge",onPress:()=>M('fridge')}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-add-freezer",label:"Add a freezer",onPress:()=>M('freezer')})]}),O.length?(0,x.jsxs)(n.default,{testID:"tu-archived",style:{gap:6,alignItems:'center'},children:[(0,x.jsx)(l.T,{weight:"medium",center:!0,children:"Archived (not checked, history kept)"}),O.map(e=>(0,x.jsxs)(l.Row,{gap:8,style:{justifyContent:'center'},children:[(0,x.jsx)(l.T,{size:14,center:!0,children:e.name}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:`tu-restore-${e.key}`,label:"Bring back",accessibilityLabel:`Bring back ${e.name}`,onPress:()=>R({...e,archived:!1,due:e.due||'09:00, 16:00'})})]},e.key))]}):null,I?(0,x.jsxs)(n.default,{testID:"tu-save-ask",style:{gap:8,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold,alignItems:'center'},children:[(0,x.jsx)(l.T,{weight:"medium",center:!0,children:`Save ${B.length} change${1===B.length?'':'s'}?`}),B.map(e=>(0,x.jsx)(l.T,{size:14,center:!0,children:e.text},e.key)),(0,x.jsxs)(l.Row,{gap:8,children:[(0,x.jsx)(l.Button,{small:!0,testID:"tu-save-confirm",label:"Save",accessibilityLabel:"Yes, save the changes",onPress:()=>{const e=c.useSafety.getState(),t=new Set(e.points.map(e=>e.id));for(const t of B)t.add?e.addPoint(t.add):t.id&&t.patch&&e.setPoint(t.id,t.patch);j((0,u.draftsFrom)(c.useSafety.getState().points)),w(!1);const n=[...B.filter(e=>e.id).map(e=>e.id),...c.useSafety.getState().points.filter(e=>!t.has(e.id)).map(e=>e.id)],l=`Saved ${B.length} change${1===B.length?'':'s'}.`;D(s?`${l} Sending to every device\u2026`:`${l} (on this device until it connects).`),s&&(0,p.reportTempSave)('temp_units',n,l,D)}}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-save-cancel",label:"Back",accessibilityLabel:"Go back without saving",onPress:()=>w(!1)})]})]}):null,(0,x.jsx)(l.Button,{testID:"tu-save",label:"Save changes",disabled:!B.length||P,accessibilityHint:W,onPress:()=>w(!0),style:{alignSelf:'center',minWidth:200}}),T?(0,x.jsx)(l.T,{testID:"tu-saved",size:15,colour:y.colours.ok,center:!0,accessibilityRole:"text",children:T}):(0,x.jsx)(l.Muted,{style:{textAlign:'center'},children:W})]})};var e,t=r(_d[0]),s=r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),h=r(_d[6]),u=r(_d[7]),y=r(_d[8]),p=r(_d[9]),f=r(_d[10]),x=r(_d[11]);const b=['Downstairs','Upstairs'],k={fridge:'Fridge',freezer:'Freezer'};function v({d:e,problem:t,onChange:s,onArchive:c}){const d=e.name.trim()||'new unit';return(0,x.jsxs)(n.default,{testID:`tu-unit-${e.key}`,style:{gap:8,padding:12,borderRadius:12,borderWidth:1,borderColor:t?y.colours.red:y.colours.border,alignSelf:'stretch'},children:[(0,x.jsx)(o.TextInput,{testID:`tu-name-${e.key}`,accessibilityLabel:`Name of ${d}`,value:e.name,onChangeText:t=>s({...e,name:t}),placeholder:"e.g. Upstairs fridge 5",placeholderTextColor:"#7D776C",style:[l.styles.input,{alignSelf:'stretch',width:'100%'}]}),(0,x.jsxs)(l.Row,{wrap:!0,gap:6,children:[['fridge','freezer'].map(t=>(0,x.jsx)(l.Chip,{testID:`tu-kind-${e.key}-${t}`,label:k[t],selected:e.kind===t,accessibilityLabel:`${d}: ${k[t]}${e.kind===t?', selected':''}`,onPress:()=>s((0,u.withKind)(e,t))},t)),b.map(t=>(0,x.jsx)(l.Chip,{testID:`tu-loc-${e.key}-${t.toLowerCase()}`,label:t,selected:e.location.trim().toLowerCase()===t.toLowerCase(),accessibilityLabel:`${d}: location ${t}`,onPress:()=>s({...e,location:t})},t))]}),(0,x.jsxs)(l.Row,{wrap:!0,gap:8,children:[(0,x.jsx)(o.TextInput,{testID:`tu-loc-${e.key}`,accessibilityLabel:`Location of ${d}`,value:e.location,onChangeText:t=>s({...e,location:t}),placeholder:"Location",placeholderTextColor:"#7D776C",style:[l.styles.input,{flexGrow:1,flexBasis:120,minWidth:0,width:40}]}),(0,x.jsxs)(l.Row,{gap:6,style:{flexWrap:'nowrap'},children:[(0,x.jsx)(o.TextInput,{testID:`tu-max-${e.key}`,accessibilityLabel:`Safe limit for ${d}, degrees or colder`,value:e.max,onChangeText:t=>s({...e,max:t}),placeholder:String(u.DEFAULT_MAX[e.kind]),placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[l.styles.input,{width:72,textAlign:'center'}]}),(0,x.jsx)(l.T,{size:14,children:"\xb0C or colder"})]})]}),(0,x.jsx)(o.TextInput,{testID:`tu-due-${e.key}`,accessibilityLabel:`Check times for ${d}, 24 hour, comma separated`,value:e.due,onChangeText:t=>s({...e,due:t}),placeholder:"Check times, e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[l.styles.input,{alignSelf:'stretch',width:'100%'}]}),t?(0,x.jsx)(l.T,{testID:`tu-problem-${e.key}`,size:14,colour:y.colours.red,center:!0,accessibilityRole:"text",children:t}):null,(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:`tu-archive-${e.key}`,label:"Archive",accessibilityLabel:`Archive ${d}`,accessibilityHint:"Stops the checks. Its past readings stay in History and the EHO report",onPress:c,style:{alignSelf:'center'}})]})}},1126,[17,85,777,812,1001,876,820,1127,804,1128,899,8]); @@ -1306,7 +1306,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e __d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:l,declared:s}){return(0,c.jsxs)(a.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,c.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(d.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,n.isLiveVenue)()?null:(0,c.jsx)(d.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,c.jsx)(a.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:t.ALLERGENS.map(e=>{const n=l[e.id],u=s.find(l=>l.allergen===e.id),f='contains'===n?o.colours.redBg:'may'===n?o.colours.amberBg:o.colours.surface2,h='contains'===n?'#FFD9D4':'may'===n?'#FFE2A8':o.colours.muted;return(0,c.jsxs)(a.default,{style:{width:'48%',flexGrow:1,backgroundColor:f,borderRadius:8,padding:8,borderWidth:u?2:1,borderColor:u?o.colours.red:o.colours.border},children:[(0,c.jsx)(d.T,{size:14,weight:"medium",colour:n?h:o.colours.text,children:e.label}),(0,c.jsxs)(d.T,{size:13,colour:h,children:['contains'===n?'Contains':'may'===n?'May contain':'Not listed',u?` \xb7 YOUR ALLERGY (${(0,t.severityLabel)(u.severity)})`:'']})]},e.id)})}),e.allergenNotes?(0,c.jsxs)(d.Muted,{children:["Notes: ",e.allergenNotes]}):null,(0,c.jsx)(a.default,{testID:"allergen-signoff",children:(0,c.jsx)(d.Muted,{children:e.signOff?`From the dish's recipe card. Signed off by ${e.signOff.by} on ${u(e.signOff.at)}.`:"Awaiting the head chef's allergen sign-off: not available to order online."})}),(0,c.jsx)(d.Muted,{children:"Always tell staff about allergies when you order or arrive."})]})},_e.AllergenChips=function({map:l,declared:n,signedOff:s}){const a=Object.entries(l);return a.length?(0,c.jsx)(d.Row,{wrap:!0,gap:5,children:a.sort((e,l)=>e[1]===l[1]?0:'contains'===e[1]?-1:1).map(([e,l])=>{const s=n.some(l=>l.allergen===e);return(0,c.jsx)(d.Badge,{label:`${s?'\u26a0 ':''}${(0,t.allergenLabel)(e)}${'may'===l?' (may)':''}`,kind:s?'contains'===l?'red':'amber':'neutral'},e)})}):(0,c.jsx)(d.Muted,{children:(0,e.noAllergenWords)(s)})};var e=r(_d[0]);r(_d[1]);var l,n=r(_d[2]),s=r(_d[3]),a=(l=s)&&l.__esModule?l:{default:l},t=r(_d[4]),o=r(_d[5]),d=r(_d[6]),c=r(_d[7]);const u=e=>{const l=new Date(`${e.slice(0,10)}T12:00:00`);return isNaN(+l)?e:l.toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric'})}},1223,[901,17,1224,85,845,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1224,[880,899]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1225,[]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},1226,[843,1026,17,219,385,85,780,858,804,777,1227,1102,1228,8]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by email",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},1226,[843,1026,17,219,385,85,780,858,804,777,1227,1102,1228,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,"BANNER_MS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return I}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:b}){const g=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!h||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=p,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,I),x=e.length-y.length,R=(0,f.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:h?'fixed':'absolute',left:10,right:n?10:76,top:8+g.top,zIndex:2147483001,gap:8,alignItems:'center',...h?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,f.jsx)(C,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>b(e)},e.id+':'+e.at)),x>0?(0,f.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:u.SLIDER.bg,borderWidth:1,borderColor:u.SLIDER.border},children:(0,f.jsxs)(c.T,{size:13,colour:u.SLIDER.quiet,children:[x," more new ",1===x?'booking':'bookings']})}):null]});if(h)try{const e=r(_d[13],"react-dom");if(e?.createPortal)return e.createPortal(R,document.body)}catch{}return R};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]),f=r(_d[12]);const h='undefined'!=typeof document,p="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",y=e=>h?{dataSet:{ccbn:e}}:{},x=7e3,I=3;function C({a:e,big:a,managers:p,me:I,onOpen:C,onClose:R}){const j='pending'===e.kind,[k,D]=(0,o.useState)(null),L=j&&p&&!k;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(R,k?1800:x);return()=>clearTimeout(e)},[L,k]);const S=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&R()}})).current,E=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',z=[e.when,E,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),v=j?'Booking request':'New booking',w=[e.when,E,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),T=`${v}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${C?' Tap to open bookings.':''}`,$=n=>{e.refId&&!e.test&&g.repo.bookings.decide(e.refId,n,I??'Manager'),D('confirmed'===n?'Confirmed.':'Declined.')};return(0,f.jsxs)(s.default,{...S.panHandlers,...y('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:u.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':u.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:j?d.colours.amber:d.colours.gold,...h?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,f.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:T,disabled:!C,onPress:()=>{R(),C?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,f.jsx)(c.T,{size:a?14:12,weight:"bold",colour:j?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:k??v.toUpperCase()}),(0,f.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:u.SLIDER.text,numberOfLines:1,children:e.name}),z?(0,f.jsx)(c.T,{size:a?18:15,colour:u.SLIDER.quiet,numberOfLines:1,children:z}):null,e.allergy?(0,f.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,f.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,f.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>$('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:u.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(c.T,{size:15,weight:"bold",colour:u.SLIDER.ink,children:"Confirm"})}),(0,f.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>$('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,f.jsx)(b.ToastClose,{testID:"booking-banner-close",label:`Close ${v.toLowerCase()} for ${e.name}`,onPress:R,size:a?'lg':'md',colour:u.SLIDER.quiet,style:{minWidth:56,minHeight:56,marginRight:4}})]})}},1227,[843,17,363,219,385,85,19,804,777,779,1102,858,8,260]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},1228,[1229,1230,1232,1231,1233,1016,1234]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1229,[]); @@ -1416,7 +1416,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1333,[812,843,17,85,777,845,851,1151,1334,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})},1334,[928,899,1151]); __d(function(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]})}},1335,[13,17,856,1336,1408,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 Je}}),_e2.DisplayBoard=function(e={}){const t=(0,ie.useOwner)(e=>e.site);return(0,te.useRestaurant)(t)?(0,qe.jsx)(at,{...e}):(0,qe.jsx)(U.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Y.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]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=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=_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]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]);const Ye='#221C12',Qe='#2E2618',Je=12e4,Xe={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},Ze={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},et={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},tt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),lt=e=>e.slotTime?(0,ee.hm)(new Date(e.slotTime)):'ASAP';function it({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,qe.jsxs)(U.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)(U.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)(U.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)(Y.T,{size:s?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,qe.jsx)(Y.T,{size:s?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,qe.jsx)(F.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)(U.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)(Y.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,qe.jsxs)(U.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,qe.jsx)(U.default,{style:{width:`${l.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,qe.jsx)(U.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,qe.jsxs)(F.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)(U.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,qe.jsx)(Y.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Y.T,{size:12,colour:se.colours.muted,children:s}):null]})}function ot({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ve.statusBlock)(e,t,(0,Ve.linkedBooking)(e,l));return e.length?(0,qe.jsx)(U.default,{style:{gap:8},children:e.map(e=>(0,qe.jsxs)(U.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:s?16:18,weight:"bold",children:[lt(e)," \xb7 ",tt(e.customerName)]}),(0,qe.jsx)(Y.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)(Y.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)(Y.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,Z.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Fe.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Y.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Y.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>te.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Y.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Y.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Ce.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Y.Muted,{children:"No takeaway orders right now."})}function at({embedded:e=!1,boardW:b,headerExtra:Z,subHeader:Fe,noVoice:Ve=!1}={}){const lt=(0,K.default)(),at=b??lt.width,dt=lt.height,ct=at<700,ut=at>=dt,ht=!ct&&ut&&at>=600,gt=ht,bt=Math.round(Math.min(520,Math.max(at>=1e3?448:280,.3*at))),yt=P.default.useRef(null),pt=P.default.useRef(0),[ft,xt]=(0,H.useState)({w:0,h:0}),mt=(0,ie.useOwner)(e=>e.site),jt=(0,te.useRestaurant)(mt);(0,Re.useAlertWatcher)(mt,{enabled:!e});const wt=(0,te.useOrders)(mt),kt=(0,te.useBookings)(mt),It=(0,te.useEvents)(mt),Dt=(0,te.useStore)(e=>e.skipMinutes),vt=(0,te.useStore)(e=>e.clock.mode),St=(0,te.useNow)(5e3),Ct=(0,ie.useOwner)(e=>e.staff),Tt=(0,ie.useOwner)(e=>e.attendance),Rt=(0,ie.useOwner)(e=>e.shifts),$t=(0,ie.useOwner)(e=>e.leave),Bt=P.default.useMemo(()=>(0,Oe.workingShifts)(Rt,$t),[Rt,$t]);P.default.useEffect(()=>{(0,oe.ensureAttendance)((0,ee.ymd)(St),St)},[(0,ee.ymd)(St)]);const Wt=(0,R.useSession)(e=>e.meId),Lt=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:tt(Ct.find(e=>e.id===Wt)?.name)}),zt=I.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Ht=(0,ee.ymd)(St),Pt=(0,A.useTravelDay)('display',Ht),Mt=(0,ne.useFrontDoor)(Ht,ut),At=(0,ae.useDisplaySettings)(mt),Et=At.privacy,Ot=(0,pe.useSaverSync)(),Nt=(0,ae.usePlan)(mt),_t=(0,ae.useFloor)(e=>e.live[mt]),Gt=(0,$e.useBlocks)(e=>e.blocks),[Ft,Vt]=(0,H.useState)('plan'),[Ut,Kt]=(0,H.useState)(!1),[qt,Yt]=(0,H.useState)('all'),[Qt,Jt]=(0,H.useState)(null),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(!1),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(null),[rs,ds]=(0,H.useState)(!1),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(null),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[ks,Is]=(0,H.useState)(!1),Ds=P.default.useRef(0),vs=e=>{Ds.current=Date.now(),ws(e)};P.default.useEffect(()=>{if(!js)return;const e=setInterval(()=>{Date.now()-Ds.current>=ze.DAY_IDLE_MS&&ws(null)},5e3);return()=>clearInterval(e)},[js]);const Ss=(0,te.useWaitlist)(mt),Cs=(0,te.useStore)(e=>e.walkIns[mt]??0),[Ts,Rs]=(0,H.useState)(!1),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1);(0,J.useReviewAlerts)(mt);const[Ps,Ms]=(0,H.useState)({view:0,content:0}),[As,Es]=(0,H.useState)(null);P.default.useEffect(()=>{As&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:As,timeoutMs:4500,big:!0,testID:'floor-toast'}),Es(null))},[As]),P.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Os,Ns]=(0,H.useState)(null),_s=P.default.useRef(0),[Gs,Fs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Os)return;_s.current=Date.now();const e=setInterval(()=>{const e=Date.now()-_s.current;if(e>=Je)return Ns(null),void Es('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Fs(e>=105e3?Math.ceil((Je-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Os]);const Vs=e=>e.date!==Ht?ts({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Ht)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Ht?(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Ht)}, ${e.time}`,disabled:!wi.ok,accessibilityHint:wi.hint,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}):null,(0,ve.bookingDetails)(e)]})}):ts({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(rt,{rid:mt,id:e.id,turnBase:jt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(we.CancelWalkInButton,{rid:mt,b:e,big:!0,onDone:e=>{ts(null),Es(e)}}):null,e.walkIn?(0,qe.jsx)(we.ReinstateWalkInButton,{rid:mt,b:e,today:Ht,onDone:e=>{ts(null),Es(e)}}):null,(0,ve.bookingDetails)(e)]})}),Us=kt.filter(e=>e.date===Ht).sort((e,t)=>e.time.localeCompare(t.time)),Ks=Us.filter(e=>!['cancelled','noshow'].includes(e.status)),qs=wt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,H.useMemo)(()=>(0,c.forecastToday)(jt,kt,wt,It,St),[jt,kt,wt,It,St.getTime()/6e4|0]),Qs=(0,$e.closedAreasAt)(Gt,mt,Ht,(0,ee.hm)(St)),Js=[...Qs].join(','),Xs=(0,H.useMemo)(()=>(0,re.floorView)(Nt,kt,wt,_t??{},St,jt.settings.turnMins,Qs),[Nt,kt,wt,_t,St.getTime(),Js]),Zs=(0,De.hoursFor)(jt,St),el=Zs?.open??new Date(`${Ht}T12:00:00`),tl=Zs?.close??new Date(`${Ht}T21:00:00`),sl=(0,ee.addMins)(el,-el.getMinutes()),ll=(0,ee.addMins)(tl,30),il=e=>new Date(`${Ht}T${e}:00`),nl=(0,$e.blocksOn)(Gt,mt,Ht).map(e=>({from:il(e.from),to:il(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(jt,St,Ht)),ol=Object.keys(Xs).filter(e=>'blocked'===Xs[e]?.status),al=js&&js!==Ht?js:Ht,rl=al!==Ht,dl=(0,ze.dayWord)(al,Ht),cl=/^(Today|Yesterday|Tomorrow)$/.test(dl),ul=rl?(0,ze.bookingsForDay)(kt,al,Ht).sort((e,t)=>e.time.localeCompare(t.time)):Us,hl=(0,ee.parseYmd)(al);hl.setHours(12);const gl=rl?(0,De.hoursFor)(jt,hl):Zs,bl=gl?.open??new Date(`${al}T12:00:00`),yl=gl?.close??new Date(`${al}T21:00:00`),pl=e=>new Date(`${al}T${e}:00`),fl=[...rl?(0,$e.blocksOn)(Gt,mt,al).map(e=>({from:pl(e.from),to:pl(e.to),label:e.reason??'Paused'})):nl,...rl?(0,n.queuedServicePauses)(jt,hl,al):[]],xl=(0,n.queuedServiceSessions)(jt,hl),ml=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),jl=(0,qe.jsxs)(U.default,{testID:"queued-hours-gate",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Y.Muted,{children:i.queuedVenues[mt]?.hours.note})]}),wl=rl?gl||ul.length?alrl?(0,re.dayFloorView)(Nt,ul,al):Xs,[rl,Nt,ul,al,Xs]),[Il,Dl]=(0,H.useState)(null),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(!1),[Rl,$l]=(0,H.useState)(null),Bl=rl?ul.filter(e=>!['cancelled','noshow'].includes(e.status)):Ks,Wl=Bl.reduce((e,t)=>e+t.partySize,0),Ll=(0,u.coversSplit)(Bl,al),zl=(0,Pe.cancelledDayTally)(kt,al),Hl=(0,Me.cancellationsFor)(kt,al,e=>e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)','')),Pl=(0,Pe.cancelledTallyWords)(zl,cl?dl.toLowerCase():rl?`on ${dl}`:'today'),Ml=Gt.filter(e=>e.rid===mt&&e.date===al&&!e.removedAt),Al=60*bl.getHours()+bl.getMinutes(),El=60*yl.getHours()+yl.getMinutes(),Ol=(0,Le.chartBands)(Ml,Al,El),Nl=(0,Le.seasonClosedAreaIds)(Ml,Al,El),_l=Nl.size?{...Nt,areas:Nt.areas.filter(e=>!Nl.has(e.id)),tables:Nt.tables.filter(e=>!Nl.has(e.areaId))}:Nt,Gl=rl?[]:ol.filter(e=>!Nl.has(Nt.tables.find(t=>t.name===e)?.areaId??'')),Fl=new Set((0,Le.blockedHours)(Ol)),Vl=St.getHours()+(St.getMinutes()>=30?1:0),Ul=Ys.hours.filter(e=>e.hour>=Vl&&!Fl.has(e.hour)),Kl=Ul.reduce((e,t)=>e+t.coversHigh,0),ql=Ul.reduce((e,t)=>e+t.coversLow,0),Yl=Math.round((ql+Kl)/2),Ql=!Ys.example&&Ys.open&&Ys.enough&&Kl>0?`Usually ${(0,c.coversRange)(Yl,Yl)} more`:void 0,Jl=async(e,t)=>{const s=Xs[e]?.booking;if(!s||e===t)return;const l=Xs[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 ${re.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,ke.guardBookingChange)(Es,{b:s,tables:[t]}))return;await te.repo.bookings.update(s.id,{table:t});const i=_t?.[e]?.stage;ae.useFloor.getState().setLive(mt,t,{stage:i??'seated',dirty:!1}),ae.useFloor.getState().setLive(mt,e,{stage:void 0,dirty:!0}),Es(`Saving: ${(0,fe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,ke.reportBookingSave)(s.id,`${(0,fe.privName)(s,Et)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}`,Es)},Xl=e=>{if(xs)return Sl(null),void ms(t=>t?{...t,tables:(0,Ie.toggleTable)(t.tables,e)}:t);rl?Dl(e):Xt?(e!==Xt&&Jl(Xt,e),Zt(null)):Jt(e)},Zl=xs?kt.find(e=>e.id===xs.id):void 0,ei=xs&&Zl?(()=>{const e=Zl.walkIn?(0,fe.privName)(Zl,Et):tt(Zl.name),t=(0,Ie.seatsOf)(Nt,xs.tables).total,s=(0,Ie.seatLine)(t,Zl.partySize),l=(0,Ie.pickClashes)(Zl,xs.tables,kt.filter(e=>e.date===Zl.date),jt.settings.turnMins),i=(0,Ie.tableKey)(xs.tables)!==(0,Ie.tableKey)((0,ae.tablesOf)(Zl.table));return(0,qe.jsxs)(U.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,qe.jsxs)(U.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Zl.date,Ht)} ${Zl.time}. Tap tables on the plan to add or take them off. ${(0,Ie.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Zl.date,Ht)," ",Zl.time]}),(0,qe.jsxs)(Y.T,{size:16,colour:se.colours.text,children:[(0,Ie.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),vl?(0,qe.jsx)(U.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:vl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,qe.jsx)(Y.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:vl})}):null,Cl&&Zl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Tl(!1),(async()=>{if(!(0,ke.guardBookingChange)(Es,{b:Zl,tables:xs.tables}))return Sl(null),void ms(null);const s=xs.tables;ms(null),await(0,ke.saveTablesReported)(mt,Zl,s,e,t,Es)})()},onNo:()=>Tl(!1)}):null,(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:vl?'plan-pick-overcap-yes':'plan-pick-save',label:vl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${vl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,Ie.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Zl)return void ms(null);if(!(0,ke.guardBookingChange)(Es,{b:Zl,tables:xs.tables}))return Sl(null),void ms(null);const s=(0,Ie.overCapacityAsk)(xs.tables,t,Zl.partySize);if(s&&!vl)return void Sl(s);if('finished'===Zl.status&&xs.tables.length&&!Cl)return void Tl(!0);Sl(null),Tl(!1);const l=xs.tables;ms(null),await(0,ke.saveTablesReported)(mt,Zl,l,e,t,Es)}}),(0,qe.jsx)(Y.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Sl(null),ms(null)}})]})]})})():null,ti=_l.areas.filter(e=>_l.tables.some(t=>t.areaId===e.id)),si=e=>{const t=Nt.tables.filter(t=>t.areaId===e);return rl?`${t.filter(e=>!kl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Xs[e.name]?.status??'free')).length}/${t.length} free`},li='all'===qt||ti.some(e=>e.id===qt)?qt:'all',ii=e=>(0,qe.jsx)(de.FloorCanvas,{plan:_l,areaId:e,mode:"live",fit:"contain",crop:!0,fill:ht,big:!0,view:kl,privacy:Et,turnBase:jt.settings.turnMins,highlight:xs?xs.tables:Xt?[Xt]:void 0,onTap:e=>Xl(e.name),onDrop:(e,t)=>xs||rl?void 0:Jl(e.name,t.name)}),ni=ct?1:ut||ti.length>2?2:1,oi=e=>{const t=Nt.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},ai=[];for(let e=0;e{const t=(0,de.areaBounds)(Nt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,de.minReadableScale)(Nt,e.id)}}),ft.w,ft.h):null,di=e=>(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',height:ce.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:si(e.id)})]}),ci=(0,qe.jsx)(U.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-ft.w)>1||Math.abs(s-ft.h)>1)&&xt({w:t,h:s})},children:ri?(0,qe.jsx)(V.default,{style:{flex:1},scrollEnabled:ri.scroll,showsVerticalScrollIndicator:ri.scroll,contentContainerStyle:{gap:ce.GRID_GAP},children:ri.rows.map((e,t)=>(0,qe.jsx)(U.default,{style:{height:ri.rowHeights[t],flexDirection:'row',gap:ce.GRID_GAP},children:e.map(e=>{const t=ti.find(t=>t.id===e);return(0,qe.jsxs)(U.default,{testID:`area-cell-${e}`,style:{width:ri.cellW,gap:2},children:[di(t),(0,qe.jsx)(U.default,{style:{flex:1},children:ii(e)})]},e)})},t))}):null}),ui=(0,qe.jsxs)(U.default,{testID:"venue-plan",style:{flex:ct?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:Nt}),Nt.tables.length?null:(0,qe.jsxs)(U.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,qe.jsx)(Y.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Y.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)(Y.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,qe.jsx)(nt,{chipId:"all",compact:!ct,label:"Whole venue",selected:'all'===li,onPress:()=>Yt('all')},"__all"),...ti.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ct,label:`${e.name}${(0,ue.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ct?Qs.has(e.id)?'closed':li===e.id?si(e.id):void 0:void 0,selected:li===e.id,onPress:()=>Yt(e.id)},e.id))];return ct?(0,qe.jsx)(U.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,qe.jsx)(V.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:Ps.view>0&&Ps.content>0&&Ps.content<=Ps.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ps.view>0&&Ps.content<=Ps.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),ei,Xt?(0,qe.jsxs)(Y.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Y.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Xt),": tap the new table."]}),(0,qe.jsx)(Y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Zt(null)})]}):null,'all'===li&&ht?ci:'all'===li?(0,qe.jsx)(U.default,{style:{flex:ct?void 0:1,gap:12,minHeight:gt?void 0:360},children:ai.map((e,t)=>(0,qe.jsxs)(U.default,{style:{flex:ct?void 0:Math.max(.3,...e.map(e=>oi(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(U.default,{style:{flex:1,gap:2},children:[ct?(0,qe.jsxs)(U.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Y.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{center:!0,children:si(e.id)})]}):(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{children:si(e.id)})]}),(0,qe.jsx)(U.default,{style:ct?{height:Math.max(280,Math.round((at-40)*oi(e.id)))}:{flex:1},children:ii(e.id)})]},e.id)),e.length{if(rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},al)}),gi='timeline'===Ft,bi=Ut?(0,qe.jsx)(_.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Kt(!1),supportedOrientations:['landscape','portrait'],children:(0,qe.jsxs)(U.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,qe.jsx)(F.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Kt(!1),style:{minHeight:64,minWidth:at<600?120:180,paddingHorizontal:at<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,qe.jsx)(U.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,qe.jsx)(Y.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${rl?(0,ze.dayLong)(al):'Today'}`})}),at<600?null:(0,qe.jsx)(U.default,{style:{minWidth:180}})]}),ml?jl:(0,qe.jsx)(U.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(be.Timeline,{hideNow:!0,fit:!0,plan:_l,bookings:rl?ul:Us,now:rl?bl:St,privacy:Et,turnBase:jt.settings.turnMins,t0:rl?(0,ee.addMins)(bl,-bl.getMinutes()):sl,t1:rl?(0,ee.addMins)(yl,30):ll,pauses:rl?fl:nl,blockedTables:Gl,onOpen:e=>{if(Kt(!1),rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},`full-${al}`)})]})}):null,yi=rl?(0,qe.jsxs)(U.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:cl?`Showing ${dl} \xb7 ${(0,ee.niceDate)((0,ee.parseYmd)(al))}`:`Showing ${(0,ze.dayWord)(al,Ht)}`}),(0,qe.jsx)(U.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Pl}. Showing ${(0,ze.dayLong)(al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Y.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ms(null),vs(null)},style:{minHeight:44}})]}):null,pi=(0,qe.jsx)(U.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:ct?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(gi||Ut);return(0,qe.jsx)(F.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?(Vt('plan'),Kt(!0)):(Kt(!1),Vt('plan'))},style:{flex:ct?1:void 0,minHeight:ct?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',...Ne.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)(Y.T,{size:ct?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),fi='display'===I.APP_VARIANT&&!e,xi='display'===I.APP_VARIANT&&!e,mi=!e&&!I.IS_CAR&&!ct,ji=fi?(0,qe.jsxs)(U.default,{testID:"display-view-row",style:{flexDirection:ct?'column':'row',flexWrap:ct||mi?'nowrap':'wrap',gap:6,alignItems:ct||mi?'stretch':'center'},children:[pi,(0,qe.jsx)(k.DisplayRotaKitchenButtons,{phone:ct,fill:mi,shifts:Rt,staff:Ct,today:Ht,leave:$t})]}):pi,wi=(0,h.useBookingWrite)(),ki=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Walk-in",onPress:Mt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"New booking",onPress:Mt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint})]});(0,Ke.useDisplayNotices)(mt,!e);const Ii=!e&&!I.IS_CAR&&!ct,Di=ct?180:202,[vi,Si]=(0,H.useState)(ct?180:168),Ci=P.default.useRef(ct?180:168),Ti=P.default.useRef(null),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(!1),[Wi,Li]=(0,H.useState)(!1),zi=!ct&&dt<=800,Hi=We.DAY_GRAPH_CHROME+(zi?24:8),Pi=P.default.useRef(0),[Mi,Ai]=(0,H.useState)(Hi),[Ei,Oi]=(0,H.useState)(!0),[Ni,Gi]=(0,H.useState)(!1);P.default.useEffect(()=>{Gi(!1)},[at,dt]);const Fi=P.default.useRef(()=>{}),Vi=P.default.useCallback(e=>{Math.abs(e-Pi.current)>=2&&(Pi.current=e,setTimeout(()=>Fi.current(),0))},[]),Ui=()=>{const e=Ti.current,t=Ri.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=t>Ci.current?Math.ceil(t-Ci.current):0,o=Ii?Math.max(Hi,Pi.current):Math.max(Hi,n);Ii&&o!==Mi&&Ai(o);const a=!ct&&dt>=700?140:70,r=Math.floor(s-4-e)-o-l,d=i>0&&r-i>=a;Ii&&d!==Ei&&Oi(d),Ii&&!Ni&&r<48&&Gi(!0);const c=r-(d?i:0),u=Math.min(Di,c>=a?Math.max(a,c):Math.max(0,c));Math.abs(Ci.current-u)>=2&&(Ci.current=u,Si(u))},l=44+(dt<820?4:8),i=46+(dt<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=$i.current;Ii&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=dt<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Bi.current?44+d:0)}):s(n,a,t,Ii?i:l)})})};Fi.current=Ui,P.default.useEffect(()=>{const e=setTimeout(()=>Fi.current(),60),t=setTimeout(()=>Fi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[at,dt,al]);const Ki=(0,qe.jsxs)(U.default,{ref:Ri,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ui()},style:{flexDirection:'row',flexWrap:at>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ct?12:zi?2:6,justifyContent:ct?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ue.DisplayClockButton,{}),(0,qe.jsx)(ge.HoldToEdit,{quiet:!0,onUnlock:()=>{Fs(null),Ns({at:Date.now()})},onHint:()=>Es('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(Be.BlockBookingsButton,{rid:mt,r:jt,now:St,by:Lt,quiet:!0,display:!0,day:al}),Nt.areas.some(e=>e.outdoor)?(0,qe.jsx)(Be.CloseGardenButton,{rid:mt,r:jt,now:St,by:Lt,quiet:!0,short:!0}):null,(0,qe.jsx)(F.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Hs(!0),style:({pressed:e})=>({...Ne.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,qe.jsx)(f.GiftQrButton,{rid:mt,venue:jt.name})]}),qi=qs.length?(0,qe.jsxs)(U.default,{testID:"takeaway-panel",style:[Ne.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Y.T,{size:12,colour:se.colours.muted,children:[qs.length," live"]})]}),(0,qe.jsx)(U.default,{style:{padding:10},children:(0,qe.jsx)(ot,{list:qs,me:Lt,compact:!0,bookings:kt})})]}):null,Yi=(Ee.DueToday,jt.settings.turnMins||90),Qi=rl?ul:(0,v.todaysGuestList)(Us,St,Yi),Ji=rl?[]:(0,v.todaysFinishedList)(Us,St,Yi),Xi=rl?cl?`${dl}\u2019s guests`:`Guests ${dl}`:'Today\u2019s guests',Zi=(0,qe.jsxs)(qe.Fragment,{children:[0===Qi.length?(0,qe.jsx)(Y.Muted,{children:rl?al{const t=(0,v.isLeftEarly)(e,St,Yi),s=(0,le.isSeatedHighlight)(e.status,{otherDay:rl})&&!t,l=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=se.colours.text,n=s?se.colours.goldLight:se.colours.muted,o=se.colours.gold,a=l.depositWarn?se.colours.amber:se.colours.goldLight;return(0,qe.jsxs)(F.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:rl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,le.seatedHighlightStyle)({backgroundColor:e?Qe:Ye,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,qe.jsx)(Y.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)(U.default,{style:{paddingTop:2},children:(0,qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,qe.jsxs)(Y.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Y.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}),(0,qe.jsx)(Y.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,qe.jsx)(Y.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(U.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(me.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,qe.jsx)(Y.T,{size:15,colour:se.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),Ji.length?(0,qe.jsxs)(U.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(F.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ji.length}${bs?', expanded':', collapsed'}`,accessibilityState:{expanded:bs},onPress:()=>ys(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Y.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ji.length,")"]}),(0,qe.jsx)(Y.T,{size:16,colour:se.colours.muted,children:bs?'\u25be':'\u25b8'})]}),bs?Ji.map(e=>{const t=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,qe.jsxs)(F.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Y.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Y.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,qe.jsx)(U.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,qe.jsx)(S.BookingUndo,{b:e,rid:mt,today:Ht,who:t.name,allowed:wi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ae.CancellationsSection,{items:Hl,dayWord:rl?cl?dl.toLowerCase():`on ${dl}`:'today'})]}),en=(0,qe.jsx)(V.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Zi}),tn=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&gs(!1)}}),sn=(0,qe.jsxs)(F.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Xi}, ${Qi.length}`,accessibilityState:{expanded:hs},'aria-expanded':hs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>gs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:hs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:hs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Y.T,{size:16,weight:"bold",colour:se.colours.gold,children:Qi.length}),(0,qe.jsx)(U.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(U.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,qe.jsxs)(Y.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Xi," ",hs?'\u2039':'\u203a']})})})]}),ln=hs?(0,qe.jsxs)(U.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,qe.jsxs)(U.default,{testID:"guests-drawer",...tn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*at)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,...Ne.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,qe.jsxs)(U.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Xi.toUpperCase()," (",Qi.length,")"]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Xi}`,onPress:()=>gs(!1),style:{marginRight:-6}})]}),zl.count?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Pl}):null,(0,qe.jsx)(U.default,{testID:"guests-tools",style:{flexDirection:'row',gap:8,marginTop:6,justifyContent:'center'},children:(0,qe.jsx)(F.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:cs},'aria-expanded':cs,onPress:()=>us(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:14,borderRadius:12,borderWidth:1,borderColor:cs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',backgroundColor:e?se.colours.tilePressed:cs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:se.colours.goldLight,children:["Guest key ",cs?'\u25b4':'\u25be']})})}),cs?(0,qe.jsx)(U.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: warning sign allergy, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:6},children:[['\u26a0','allergy'],['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(Y.T,{size:16,children:e}),(0,qe.jsx)(Y.T,{size:14,children:t})]},t))}):null]}),en]}),(0,qe.jsx)(F.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Xi}`,accessibilityRole:"button",onPress:()=>gs(!1),style:{flex:1}})]}):null,nn=ml?jl:l.IS_KIRKTON&&!Object.values(jt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(U.default,{testID:"kirkton-hours-to-confirm",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Y.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(jt,kt,St).busy,todays:ul,open:bl,close:yl,now:St,turnBase:jt.settings.turnMins,blocks:Ml,pauses:fl,compact:ct,dense:!ct,fit:ht,tight:ht&&dt<=600,height:ht?vi:Di,forecastNote:rl?void 0:Ql,emptyText:wl,past:al{Ds.current=Date.now(),Is(!0)},shortDay:!ct&&at<1100}),rn=(0,qe.jsx)(He.DisplayCalendar,{visible:ks,today:Ht,day:al,bookings:kt,restaurant:jt,now:St,onDay:vs,onClose:()=>Is(!1)}),dn=()=>{rl?gs(!0):Kt(!0)},cn=(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',padding:zi?4:dt<820?8:12,paddingTop:zi?Ii?2:4:dt<820?Ii?4:6:Ii?8:10,gap:zi?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:yi,Pt?(0,qe.jsx)(V.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"})}):gi?hi:ui,bi,ln]}),(0,qe.jsxs)(U.default,{testID:"display-side",style:{width:bt,gap:dt<820?4:8,minHeight:0},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ki(!1)}),(0,qe.jsx)(U.default,{style:{flexShrink:0},children:ji}),Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",onLayout:Ui,style:Ii&&!Ni?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:dt<820,snug:dt<820,tight:dt<800,fill:Ii&&!Ni,sound:(0,E.flapSoundOn)(),onPress:dn})}),Pt?null:(0,qe.jsx)(U.default,{ref:Ti,testID:"day-graph-slot",onLayout:Ui,style:{flexGrow:0,flexShrink:Ii?0:1,flexBasis:(ct?Di:vi)+(Ii?Mi:Hi),height:(ct?Di:vi)+(Ii?Mi:Hi),minHeight:dt<=600?90:Math.min((ct?Di:vi)+We.DAY_GRAPH_CHROME,!ct&&dt>=768?140+We.DAY_GRAPH_CHROME:120),overflow:'visible'},children:on}),Ii&&!Pt?(0,qe.jsx)(U.default,{ref:$i,testID:"display-side-split",onLayout:Ui,style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})}):null,(0,qe.jsxs)(V.default,{testID:"display-side-scroll",style:Ii?{flexGrow:0,flexShrink:1,minHeight:Wi&&Ei?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Bi.current&&(Bi.current=s,Li(s),setTimeout(Ui,0))},children:[Ii||xi?null:(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),qi,(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt})]})]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Ds.current=Date.now()},onMouseDown:()=>{Ds.current=Date.now()},children:[ct?(0,qe.jsx)(U.default,{style:{flex:1},children:(0,qe.jsxs)(V.default,{ref:yt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,qe.jsxs)(U.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,qe.jsx)(U.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,qe.jsx)(j.ExitButton,{})}),(0,qe.jsx)(X.RestaurantLogo,{rid:mt,size:64}),(0,qe.jsx)(Y.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:jt.name}),(0,qe.jsx)(X.PoweredBy,{}),(0,qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(U.default,{accessible:!0,accessibilityLabel:`Current time ${(0,ee.hm)(St)}`,children:(0,qe.jsx)(Y.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,ee.hm)(St)})}),(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:"m"}),(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",size:"m"}),Z]}),Fe,I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(ke.BookingSaveBanner,{rid:mt}),an,(0,qe.jsx)(U.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(it,{phone:!0,split:Ll,items:[{label:`Tables \xb7 ${dl}`,value:Bl.length,testID:'badge-tables'},{label:`Covers \xb7 ${dl}`,value:Wl,testID:'badge-covers'},{label:'Takeaway',value:qs.length,alert:qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ls(!0)}]})}),(0,qe.jsx)(U.default,{testID:"primary-actions",style:{gap:8},children:ki(!0)}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt}),ji,(0,qe.jsxs)(U.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[gi?hi:ui,bi]}),(0,qe.jsxs)(U.default,{onLayout:e=>{pt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ne.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Y.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Xi," (",Qi.length,")"]}),(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{gap:4},children:Zi})]}),qi,on,(0,qe.jsx)(U.default,{testID:"covers-dock",children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>yt.current?.scrollTo({y:pt.current,animated:!0})})}),(0,qe.jsxs)(U.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,qe.jsx)(Y.T,{center:!0,size:14,colour:Et?se.colours.muted:se.colours.amber,children:Et?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Y.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Rs(!0),style:{minHeight:48,alignSelf:'stretch'}}),xi?null:(0,qe.jsx)(Y.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ki]})}):(0,qe.jsxs)(qe.Fragment,{children:[Ii?(0,qe.jsx)(U.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:se.colours.hairline},children:(0,qe.jsx)(U.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)(U.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,paddingVertical:zi?2:dt<820?4:8,gap:8,minHeight:zi&&Ii?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ne.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(U.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:Ii?16:8,minWidth:0,overflow:'hidden',...Ii?{justifyContent:'flex-start'}:null},children:[(0,qe.jsx)(U.default,{testID:"display-header-brand",style:Ii?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(X.RestaurantBrand,{rid:jt.id,size:at<900?32:40,beside:!0,noLogo:Ii})}),(0,qe.jsxs)(U.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Y.T,{size:at<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,ee.hm)(St)}),at>=900?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:(0,ee.niceDate)(St)}):null]})]}),Pt?(0,qe.jsx)(U.default,{style:{width:220}}):(0,qe.jsx)(U.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:an}),(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,qe.jsxs)(U.default,{testID:"display-header-chips",style:{flexDirection:at>=1400||Ii?'row':'column',alignItems:at>=1400||Ii?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:at<1240?'xs':at<1280||dt<700?'s':'m'}),Pt?null:(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",slot:Ii,size:at<1340?'xs':at<1400||dt<700?'s':'m'})]}),'simulated'===vt?(0,qe.jsx)(F.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>Dt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,Z,e?null:(0,qe.jsx)(U.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(j.ExitButton,{size:44})})]})]}),Fe,I.IS_CAR||!Pt||Ii?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(ke.BookingSaveBanner,{rid:mt,margin:{marginHorizontal:12,marginTop:6}}),Pt||Ii?null:(0,qe.jsx)(U.default,{testID:"display-day-stats",style:Xe,children:(0,qe.jsxs)(U.default,{style:Ze,children:[I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(U.default,{style:et,children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})})]})}),ht?cn:(un=(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{testID:"front-door-bar",style:{gap:10},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ki(!1)}),ji]}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt}),Pt?(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"}):(0,qe.jsx)(qe.Fragment,{children:(0,qe.jsxs)(U.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[yi,gi?hi:ui,bi,ln]})]})}),qi,Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,sound:(0,E.flapSoundOn)(),onPress:dn})}),Pt?null:(0,qe.jsx)(U.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Di+We.DAY_GRAPH_CHROME},children:on})]}),(0,qe.jsx)(V.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:un})),Ki]}),(0,qe.jsx)($.SoldOutStrip,{rid:mt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:zs,onClose:()=>Hs(!1),rid:mt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:mt}),Mt.elements,is?(0,qe.jsx)(y.EditBookingPicker,{rid:mt,today:Ht,who:Lt,onClose:()=>ns(!1)}):null,os?(0,qe.jsx)(y.EditBookingSheet,{rid:mt,id:os,who:Lt,onClose:()=>as(null)}):null,Qt?(0,qe.jsx)(ve.TableSheet,{rid:mt,name:Qt,view:Xs,plan:Nt,todays:Us,now:St,privacy:Et,turnBase:jt.settings.turnMins,onClose:()=>Jt(null),onWalkIn:e=>Mt.openWalkInAt(e),onMove:e=>Zt(e),onDetails:Vs}):null,Il?(()=>{const e=kl[Il],t=e?.dayBookings??[];return(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>{$l(null),Dl(null)},title:`${(0,d.tableNumbersA11y)(Il)} \xb7 ${cl?dl:(0,ze.dayLong)(al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Y.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${cl?dl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${cl?dl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Et):tt(e.name);return(0,qe.jsx)(Y.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,Ie.tablesWords)((0,ae.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Dl(null),fs(e.id)},style:{minHeight:56}},e.id)}),al>=Ht?(()=>{const t=e?.table.maxSeats??0,s=kt.filter(e=>e.date===al&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,ae.tablesOf)(e.table).includes(Il)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,qe.jsxs)(U.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(Il)]}),Rl?(0,qe.jsxs)(U.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Rl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Rl.ask}),(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!wi.ok,accessibilityHint:wi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=kt.find(e=>e.id===Rl.id);if($l(null),!e)return;const s=tt(e.name);Dl(null),await(0,ke.saveTablesReported)(mt,e,[Il],s,t,Es)}}),(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>$l(null)})]})]}):null,Rl?null:s.slice(0,12).map(e=>{const s=tt(e.name),l=e.partySize>t;return(0,qe.jsx)(Y.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:!wi.ok,accessibilityHint:wi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(Il)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,ke.guardBookingChange)(Es,{b:e,tables:[Il]}))return;const l=(0,Ie.overCapacityAsk)([Il],t,e.partySize);l?$l({id:e.id,ask:l}):(Dl(null),await(0,ke.saveTablesReported)(mt,e,[Il],s,t,Es))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Y.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{$l(null),Dl(null)},style:{minHeight:56}})]})})():null,ps?(()=>{const e=kt.find(e=>e.id===ps);return e?(0,qe.jsx)(je.GuestActionsSheet,{rid:mt,b:e,name:e.walkIn?(0,fe.privName)(e,Et):tt(e.name),view:Xs,now:St,otherDay:e.date!==Ht,turnBase:jt.settings.turnMins,onClose:()=>fs(null),onDetails:Vs,onDone:Es,onEdit:e=>{fs(null),as(e.id)},onPickOnPlan:(e,t)=>{gs(!1),Vt('plan'),Yt('all'),ms({id:e.id,tables:t})}}):null})():null,es?(0,qe.jsx)(ve.DetailsPanel,{title:es.title,onClose:()=>ts(null),children:es.body}):null,rn,rs?(0,qe.jsx)(ve.ServiceSummary,{r:jt,todays:Us,orders:wt,waitlistAll:Ss,walkInCount:Cs,onClose:()=>ds(!1)}):null,Ts?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Rs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsx)(Y.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Rs(!1)})]}):null,Ws?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ls(!1),Bs(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,$s?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(Q.ReviewsSection,{rid:mt,mode:"read",venueName:jt.name}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,ss?(0,qe.jsxs)(ve.DetailsPanel,{title:"Takeaway",onClose:()=>ls(!1),children:[(0,qe.jsx)(Y.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(ot,{list:qs,me:Lt,bookings:kt})]}):null,Os?(0,qe.jsx)(U.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,qe.jsx)(he.PlanDesigner,{initial:Nt,venue:jt.name,mode:"display",startStep:"arrange",onActivity:()=>{_s.current=Date.now(),null!==Gs&&Fs(null)},notice:null!==Gs?`Locking again in ${Gs} s \xb7 touch to keep editing`:null,onSave:e=>{ae.useFloor.getState().setPlan(mt,e),Ns(null),Es('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{ae.useFloor.getState().setPlan(mt,e),Es('Live seating plan updated on every screen.')},onCancel:()=>{Ns(null),Es('No changes kept. Editing is locked again.')}},Os.at)}):null,e?null:(0,qe.jsx)(ye.Screensaver,{rid:mt,idleMins:At.idleMins,pinOn:At.pinOn,wake:At,tonightCards:At.tonightCards,cfg:Ot}),e?null:(0,qe.jsx)(Ce.PrintHost,{rid:mt}),e?null:(0,qe.jsx)(Se.AlertHost,{variant:"display",rid:mt,skipTakeaway:!0}),e?null:(0,qe.jsx)(O.SeatAllergenReminder,{rid:mt}),e?null:(0,qe.jsx)(Te.TakeawayTakeover,{rid:mt,me:Lt})]});var un}function rt({rid:e,id:t,turnBase:s}){const l=(0,te.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1336,[1051,779,805,806,1337,813,1338,1092,843,1138,1339,1340,1341,1089,1119,1342,1343,1348,1349,1206,1350,856,1355,1356,1357,1112,1111,920,1358,1150,891,1102,1359,17,1070,1182,1016,1085,1360,378,363,385,278,85,409,19,777,1237,1241,857,845,863,858,804,1088,876,1096,1055,996,1074,1107,1361,1106,1362,1369,1371,1374,1379,1373,1380,1383,1384,1114,1093,1094,862,1389,1226,1390,1236,1228,993,1395,1400,1401,1052,1050,1116,1403,1404,1405,1069,1169,1406,1168,1159,853,1351,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 Je}}),_e2.DisplayBoard=function(e={}){const t=(0,ie.useOwner)(e=>e.site);return(0,te.useRestaurant)(t)?(0,qe.jsx)(at,{...e}):(0,qe.jsx)(U.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Y.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]),S=_r(_d[23]),v=_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=_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]),Se=_r(_d[76]),ve=_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]);const Ye='#221C12',Qe='#2E2618',Je=12e4,Xe={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},Ze={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},et={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},tt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),lt=e=>e.slotTime?(0,ee.hm)(new Date(e.slotTime)):'ASAP';function it({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,qe.jsxs)(U.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)(U.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)(U.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)(Y.T,{size:s?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,qe.jsx)(Y.T,{size:s?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,qe.jsx)(F.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)(U.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)(Y.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,qe.jsxs)(U.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,qe.jsx)(U.default,{style:{width:`${l.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,qe.jsx)(U.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,qe.jsxs)(F.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)(U.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,qe.jsx)(Y.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Y.T,{size:12,colour:se.colours.muted,children:s}):null]})}function ot({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ve.statusBlock)(e,t,(0,Ve.linkedBooking)(e,l));return e.length?(0,qe.jsx)(U.default,{style:{gap:8},children:e.map(e=>(0,qe.jsxs)(U.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:s?16:18,weight:"bold",children:[lt(e)," \xb7 ",tt(e.customerName)]}),(0,qe.jsx)(Y.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)(Y.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)(Y.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,Z.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Fe.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Y.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Y.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>te.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Y.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Y.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Ce.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Y.Muted,{children:"No takeaway orders right now."})}function at({embedded:e=!1,boardW:b,headerExtra:Z,subHeader:Fe,noVoice:Ve=!1}={}){const lt=(0,K.default)(),at=b??lt.width,dt=lt.height,ct=at<700,ut=at>=dt,ht=!ct&&ut&&at>=600,gt=ht,bt=Math.round(Math.min(520,Math.max(at>=1e3?448:280,.3*at))),yt=P.default.useRef(null),pt=P.default.useRef(0),[ft,xt]=(0,H.useState)({w:0,h:0}),mt=(0,ie.useOwner)(e=>e.site),jt=(0,te.useRestaurant)(mt);(0,Re.useAlertWatcher)(mt,{enabled:!e});const wt=(0,te.useOrders)(mt),It=(0,te.useBookings)(mt),kt=(0,te.useEvents)(mt),Dt=(0,te.useStore)(e=>e.skipMinutes),St=(0,te.useStore)(e=>e.clock.mode),vt=(0,te.useNow)(5e3),Ct=(0,ie.useOwner)(e=>e.staff),Tt=(0,ie.useOwner)(e=>e.attendance),Rt=(0,ie.useOwner)(e=>e.shifts),$t=(0,ie.useOwner)(e=>e.leave),Bt=P.default.useMemo(()=>(0,Ee.workingShifts)(Rt,$t),[Rt,$t]);P.default.useEffect(()=>{(0,oe.ensureAttendance)((0,ee.ymd)(vt),vt)},[(0,ee.ymd)(vt)]);const Wt=(0,R.useSession)(e=>e.meId),Lt=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:tt(Ct.find(e=>e.id===Wt)?.name)}),zt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Ht=(0,ee.ymd)(vt),Pt=(0,A.useTravelDay)('display',Ht),Mt=(0,ne.useFrontDoor)(Ht,ut),At=(0,ae.useDisplaySettings)(mt),Ot=At.privacy,Et=(0,pe.useSaverSync)(),Nt=(0,ae.usePlan)(mt),_t=(0,ae.useFloor)(e=>e.live[mt]),Gt=(0,$e.useBlocks)(e=>e.blocks),[Ft,Vt]=(0,H.useState)('plan'),[Ut,Kt]=(0,H.useState)(!1),[qt,Yt]=(0,H.useState)('all'),[Qt,Jt]=(0,H.useState)(null),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(!1),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(null),[rs,ds]=(0,H.useState)(!1),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(null),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(!1),Ds=P.default.useRef(0),Ss=e=>{Ds.current=Date.now(),ws(e)};P.default.useEffect(()=>{if(!js)return;const e=setInterval(()=>{Date.now()-Ds.current>=ze.DAY_IDLE_MS&&ws(null)},5e3);return()=>clearInterval(e)},[js]);const vs=(0,te.useWaitlist)(mt),Cs=(0,te.useStore)(e=>e.walkIns[mt]??0),[Ts,Rs]=(0,H.useState)(!1),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1);(0,J.useReviewAlerts)(mt);const[Ps,Ms]=(0,H.useState)({view:0,content:0}),[As,Os]=(0,H.useState)(null);P.default.useEffect(()=>{As&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:As,timeoutMs:4500,big:!0,testID:'floor-toast'}),Os(null))},[As]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[Es,Ns]=(0,H.useState)(null),_s=P.default.useRef(0),[Gs,Fs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Es)return;_s.current=Date.now();const e=setInterval(()=>{const e=Date.now()-_s.current;if(e>=Je)return Ns(null),void Os('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Fs(e>=105e3?Math.ceil((Je-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Es]);const Vs=e=>e.date!==Ht?ts({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Ht)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Ht?(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Ht)}, ${e.time}`,disabled:!wi.ok,accessibilityHint:wi.hint,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ts({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(rt,{rid:mt,id:e.id,turnBase:jt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(we.CancelWalkInButton,{rid:mt,b:e,big:!0,onDone:e=>{ts(null),Os(e)}}):null,e.walkIn?(0,qe.jsx)(we.ReinstateWalkInButton,{rid:mt,b:e,today:Ht,onDone:e=>{ts(null),Os(e)}}):null,(0,Se.bookingDetails)(e)]})}),Us=It.filter(e=>e.date===Ht).sort((e,t)=>e.time.localeCompare(t.time)),Ks=Us.filter(e=>!['cancelled','noshow'].includes(e.status)),qs=wt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,H.useMemo)(()=>(0,c.forecastToday)(jt,It,wt,kt,vt),[jt,It,wt,kt,vt.getTime()/6e4|0]),Qs=(0,$e.closedAreasAt)(Gt,mt,Ht,(0,ee.hm)(vt)),Js=[...Qs].join(','),Xs=(0,H.useMemo)(()=>(0,re.floorView)(Nt,It,wt,_t??{},vt,jt.settings.turnMins,Qs),[Nt,It,wt,_t,vt.getTime(),Js]),Zs=(0,De.hoursFor)(jt,vt),el=Zs?.open??new Date(`${Ht}T12:00:00`),tl=Zs?.close??new Date(`${Ht}T21:00:00`),sl=(0,ee.addMins)(el,-el.getMinutes()),ll=(0,ee.addMins)(tl,30),il=e=>new Date(`${Ht}T${e}:00`),nl=(0,$e.blocksOn)(Gt,mt,Ht).map(e=>({from:il(e.from),to:il(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(jt,vt,Ht)),ol=Object.keys(Xs).filter(e=>'blocked'===Xs[e]?.status),al=js&&js!==Ht?js:Ht,rl=al!==Ht,dl=(0,ze.dayWord)(al,Ht),cl=/^(Today|Yesterday|Tomorrow)$/.test(dl),ul=rl?(0,ze.bookingsForDay)(It,al,Ht).sort((e,t)=>e.time.localeCompare(t.time)):Us,hl=(0,ee.parseYmd)(al);hl.setHours(12);const gl=rl?(0,De.hoursFor)(jt,hl):Zs,bl=gl?.open??new Date(`${al}T12:00:00`),yl=gl?.close??new Date(`${al}T21:00:00`),pl=e=>new Date(`${al}T${e}:00`),fl=[...rl?(0,$e.blocksOn)(Gt,mt,al).map(e=>({from:pl(e.from),to:pl(e.to),label:e.reason??'Paused'})):nl,...rl?(0,n.queuedServicePauses)(jt,hl,al):[]],xl=(0,n.queuedServiceSessions)(jt,hl),ml=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),jl=(0,qe.jsxs)(U.default,{testID:"queued-hours-gate",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Y.Muted,{children:i.queuedVenues[mt]?.hours.note})]}),wl=rl?gl||ul.length?alrl?(0,re.dayFloorView)(Nt,ul,al):Xs,[rl,Nt,ul,al,Xs]),[kl,Dl]=(0,H.useState)(null),[Sl,vl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(!1),[Rl,$l]=(0,H.useState)(null),Bl=rl?ul.filter(e=>!['cancelled','noshow'].includes(e.status)):Ks,Wl=Bl.reduce((e,t)=>e+t.partySize,0),Ll=(0,u.coversSplit)(Bl,al),zl=(0,Pe.cancelledDayTally)(It,al),Hl=(0,Me.cancellationsFor)(It,al,e=>e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)','')),Pl=(0,Pe.cancelledTallyWords)(zl,cl?dl.toLowerCase():rl?`on ${dl}`:'today'),Ml=Gt.filter(e=>e.rid===mt&&e.date===al&&!e.removedAt),Al=60*bl.getHours()+bl.getMinutes(),Ol=60*yl.getHours()+yl.getMinutes(),El=(0,Le.chartBands)(Ml,Al,Ol),Nl=(0,Le.seasonClosedAreaIds)(Ml,Al,Ol),_l=Nl.size?{...Nt,areas:Nt.areas.filter(e=>!Nl.has(e.id)),tables:Nt.tables.filter(e=>!Nl.has(e.areaId))}:Nt,Gl=rl?[]:ol.filter(e=>!Nl.has(Nt.tables.find(t=>t.name===e)?.areaId??'')),Fl=new Set((0,Le.blockedHours)(El)),Vl=vt.getHours()+(vt.getMinutes()>=30?1:0),Ul=Ys.hours.filter(e=>e.hour>=Vl&&!Fl.has(e.hour)),Kl=Ul.reduce((e,t)=>e+t.coversHigh,0),ql=Ul.reduce((e,t)=>e+t.coversLow,0),Yl=Math.round((ql+Kl)/2),Ql=!Ys.example&&Ys.open&&Ys.enough&&Kl>0?`Usually ${(0,c.coversRange)(Yl,Yl)} more`:void 0,Jl=async(e,t)=>{const s=Xs[e]?.booking;if(!s||e===t)return;const l=Xs[t]?.status;if(l&&!['free','soon'].includes(l))return void Os('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${re.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(Os,{b:s,tables:[t]}))return;await te.repo.bookings.update(s.id,{table:t});const i=_t?.[e]?.stage;ae.useFloor.getState().setLive(mt,t,{stage:i??'seated',dirty:!1}),ae.useFloor.getState().setLive(mt,e,{stage:void 0,dirty:!0}),Os(`Saving: ${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(s.id,`${(0,fe.privName)(s,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}`,Os)},Xl=e=>{if(xs)return vl(null),void ms(t=>t?{...t,tables:(0,ke.toggleTable)(t.tables,e)}:t);rl?Dl(e):Xt?(e!==Xt&&Jl(Xt,e),Zt(null)):Jt(e)},Zl=xs?It.find(e=>e.id===xs.id):void 0,ei=xs&&Zl?(()=>{const e=Zl.walkIn?(0,fe.privName)(Zl,Ot):tt(Zl.name),t=(0,ke.seatsOf)(Nt,xs.tables).total,s=(0,ke.seatLine)(t,Zl.partySize),l=(0,ke.pickClashes)(Zl,xs.tables,It.filter(e=>e.date===Zl.date),jt.settings.turnMins),i=(0,ke.tableKey)(xs.tables)!==(0,ke.tableKey)((0,ae.tablesOf)(Zl.table));return(0,qe.jsxs)(U.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,qe.jsxs)(U.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Zl.date,Ht)} ${Zl.time}. Tap tables on the plan to add or take them off. ${(0,ke.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Zl.date,Ht)," ",Zl.time]}),(0,qe.jsxs)(Y.T,{size:16,colour:se.colours.text,children:[(0,ke.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Sl?(0,qe.jsx)(U.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Sl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,qe.jsx)(Y.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Sl})}):null,Cl&&Zl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Tl(!1),(async()=>{if(!(0,Ie.guardBookingChange)(Os,{b:Zl,tables:xs.tables}))return vl(null),void ms(null);const s=xs.tables;ms(null),await(0,Ie.saveTablesReported)(mt,Zl,s,e,t,Os)})()},onNo:()=>Tl(!1)}):null,(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.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,ke.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Zl)return void ms(null);if(!(0,Ie.guardBookingChange)(Os,{b:Zl,tables:xs.tables}))return vl(null),void ms(null);const s=(0,ke.overCapacityAsk)(xs.tables,t,Zl.partySize);if(s&&!Sl)return void vl(s);if('finished'===Zl.status&&xs.tables.length&&!Cl)return void Tl(!0);vl(null),Tl(!1);const l=xs.tables;ms(null),await(0,Ie.saveTablesReported)(mt,Zl,l,e,t,Os)}}),(0,qe.jsx)(Y.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{vl(null),ms(null)}})]})]})})():null,ti=_l.areas.filter(e=>_l.tables.some(t=>t.areaId===e.id)),si=e=>{const t=Nt.tables.filter(t=>t.areaId===e);return rl?`${t.filter(e=>!Il[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Xs[e.name]?.status??'free')).length}/${t.length} free`},li='all'===qt||ti.some(e=>e.id===qt)?qt:'all',ii=e=>(0,qe.jsx)(de.FloorCanvas,{plan:_l,areaId:e,mode:"live",fit:"contain",crop:!0,fill:ht,big:!0,view:Il,privacy:Ot,turnBase:jt.settings.turnMins,highlight:xs?xs.tables:Xt?[Xt]:void 0,onTap:e=>Xl(e.name),onDrop:(e,t)=>xs||rl?void 0:Jl(e.name,t.name)}),ni=ct?1:ut||ti.length>2?2:1,oi=e=>{const t=Nt.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},ai=[];for(let e=0;e{const t=(0,de.areaBounds)(Nt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,de.minReadableScale)(Nt,e.id)}}),ft.w,ft.h):null,di=e=>(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',height:ce.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:si(e.id)})]}),ci=(0,qe.jsx)(U.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-ft.w)>1||Math.abs(s-ft.h)>1)&&xt({w:t,h:s})},children:ri?(0,qe.jsx)(V.default,{style:{flex:1},scrollEnabled:ri.scroll,showsVerticalScrollIndicator:ri.scroll,contentContainerStyle:{gap:ce.GRID_GAP},children:ri.rows.map((e,t)=>(0,qe.jsx)(U.default,{style:{height:ri.rowHeights[t],flexDirection:'row',gap:ce.GRID_GAP},children:e.map(e=>{const t=ti.find(t=>t.id===e);return(0,qe.jsxs)(U.default,{testID:`area-cell-${e}`,style:{width:ri.cellW,gap:2},children:[di(t),(0,qe.jsx)(U.default,{style:{flex:1},children:ii(e)})]},e)})},t))}):null}),ui=(0,qe.jsxs)(U.default,{testID:"venue-plan",style:{flex:ct?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:Nt}),Nt.tables.length?null:(0,qe.jsxs)(U.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,qe.jsx)(Y.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Y.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)(Y.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,qe.jsx)(nt,{chipId:"all",compact:!ct,label:"Whole venue",selected:'all'===li,onPress:()=>Yt('all')},"__all"),...ti.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ct,label:`${e.name}${(0,ue.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ct?Qs.has(e.id)?'closed':li===e.id?si(e.id):void 0:void 0,selected:li===e.id,onPress:()=>Yt(e.id)},e.id))];return ct?(0,qe.jsx)(U.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,qe.jsx)(V.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:Ps.view>0&&Ps.content>0&&Ps.content<=Ps.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ps.view>0&&Ps.content<=Ps.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),ei,Xt?(0,qe.jsxs)(Y.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Y.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Xt),": tap the new table."]}),(0,qe.jsx)(Y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Zt(null)})]}):null,'all'===li&&ht?ci:'all'===li?(0,qe.jsx)(U.default,{style:{flex:ct?void 0:1,gap:12,minHeight:gt?void 0:360},children:ai.map((e,t)=>(0,qe.jsxs)(U.default,{style:{flex:ct?void 0:Math.max(.3,...e.map(e=>oi(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(U.default,{style:{flex:1,gap:2},children:[ct?(0,qe.jsxs)(U.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Y.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{center:!0,children:si(e.id)})]}):(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{children:si(e.id)})]}),(0,qe.jsx)(U.default,{style:ct?{height:Math.max(280,Math.round((at-40)*oi(e.id)))}:{flex:1},children:ii(e.id)})]},e.id)),e.length{if(rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},al)}),gi='timeline'===Ft,bi=Ut?(0,qe.jsx)(_.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Kt(!1),supportedOrientations:['landscape','portrait'],children:(0,qe.jsxs)(U.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,qe.jsx)(F.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Kt(!1),style:{minHeight:64,minWidth:at<600?120:180,paddingHorizontal:at<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,qe.jsx)(U.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,qe.jsx)(Y.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${rl?(0,ze.dayLong)(al):'Today'}`})}),at<600?null:(0,qe.jsx)(U.default,{style:{minWidth:180}})]}),ml?jl:(0,qe.jsx)(U.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(be.Timeline,{hideNow:!0,fit:!0,plan:_l,bookings:rl?ul:Us,now:rl?bl:vt,privacy:Ot,turnBase:jt.settings.turnMins,t0:rl?(0,ee.addMins)(bl,-bl.getMinutes()):sl,t1:rl?(0,ee.addMins)(yl,30):ll,pauses:rl?fl:nl,blockedTables:Gl,onOpen:e=>{if(Kt(!1),rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},`full-${al}`)})]})}):null,yi=rl?(0,qe.jsxs)(U.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:cl?`Showing ${dl} \xb7 ${(0,ee.niceDate)((0,ee.parseYmd)(al))}`:`Showing ${(0,ze.dayWord)(al,Ht)}`}),(0,qe.jsx)(U.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Pl}. Showing ${(0,ze.dayLong)(al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Y.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ms(null),Ss(null)},style:{minHeight:44}})]}):null,pi=(0,qe.jsx)(U.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:ct?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(gi||Ut);return(0,qe.jsx)(F.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?(Vt('plan'),Kt(!0)):(Kt(!1),Vt('plan'))},style:{flex:ct?1:void 0,minHeight:ct?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',...Ne.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)(Y.T,{size:ct?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),fi='display'===k.APP_VARIANT&&!e,xi='display'===k.APP_VARIANT&&!e,mi=!e&&!k.IS_CAR&&!ct,ji=fi?(0,qe.jsxs)(U.default,{testID:"display-view-row",style:{flexDirection:ct?'column':'row',flexWrap:ct||mi?'nowrap':'wrap',gap:6,alignItems:ct||mi?'stretch':'center'},children:[pi,(0,qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ct,fill:mi,shifts:Rt,staff:Ct,today:Ht,leave:$t})]}):pi,wi=(0,h.useBookingWrite)(),Ii=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Walk-in",onPress:Mt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"New booking",onPress:Mt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint})]});(0,Ke.useDisplayNotices)(mt,!e);const ki=!e&&!k.IS_CAR&&!ct,Di=ct?180:202,[Si,vi]=(0,H.useState)(ct?180:168),Ci=P.default.useRef(ct?180:168),Ti=P.default.useRef(null),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(!1),[Wi,Li]=(0,H.useState)(!1),zi=!ct&&dt<=800,Hi=We.DAY_GRAPH_CHROME+(zi?24:8),Pi=P.default.useRef(0),[Mi,Ai]=(0,H.useState)(Hi),[Oi,Ei]=(0,H.useState)(!0),[Ni,Gi]=(0,H.useState)(!1);P.default.useEffect(()=>{Gi(!1)},[at,dt]);const Fi=P.default.useRef(()=>{}),Vi=P.default.useCallback(e=>{Math.abs(e-Pi.current)>=2&&(Pi.current=e,setTimeout(()=>Fi.current(),0))},[]),Ui=()=>{const e=Ti.current,t=Ri.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=t>Ci.current?Math.ceil(t-Ci.current):0,o=ki?Math.max(Hi,Pi.current):Math.max(Hi,n);ki&&o!==Mi&&Ai(o);const a=!ct&&dt>=700?140:70,r=Math.floor(s-4-e)-o-l,d=i>0&&r-i>=a;ki&&d!==Oi&&Ei(d),ki&&!Ni&&r<48&&Gi(!0);const c=r-(d?i:0),u=Math.min(Di,c>=a?Math.max(a,c):Math.max(0,c));Math.abs(Ci.current-u)>=2&&(Ci.current=u,vi(u))},l=44+(dt<820?4:8),i=46+(dt<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=$i.current;ki&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=dt<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Bi.current?44+d:0)}):s(n,a,t,ki?i:l)})})};Fi.current=Ui,P.default.useEffect(()=>{const e=setTimeout(()=>Fi.current(),60),t=setTimeout(()=>Fi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[at,dt,al]);const Ki=(0,qe.jsxs)(U.default,{ref:Ri,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ui()},style:{flexDirection:'row',flexWrap:at>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ct?12:zi?2:6,justifyContent:ct?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ue.DisplayClockButton,{}),(0,qe.jsx)(ge.HoldToEdit,{quiet:!0,onUnlock:()=>{Fs(null),Ns({at:Date.now()})},onHint:()=>Os('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(Be.BlockBookingsButton,{rid:mt,r:jt,now:vt,by:Lt,quiet:!0,display:!0,day:al}),Nt.areas.some(e=>e.outdoor)?(0,qe.jsx)(Be.CloseGardenButton,{rid:mt,r:jt,now:vt,by:Lt,quiet:!0,short:!0}):null,(0,qe.jsx)(F.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Hs(!0),style:({pressed:e})=>({...Ne.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,qe.jsx)(f.GiftQrButton,{rid:mt,venue:jt.name})]}),qi=qs.length?(0,qe.jsxs)(U.default,{testID:"takeaway-panel",style:[Ne.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Y.T,{size:12,colour:se.colours.muted,children:[qs.length," live"]})]}),(0,qe.jsx)(U.default,{style:{padding:10},children:(0,qe.jsx)(ot,{list:qs,me:Lt,compact:!0,bookings:It})})]}):null,Yi=(Oe.DueToday,jt.settings.turnMins||90),Qi=rl?ul:(0,S.todaysGuestList)(Us,vt,Yi),Ji=rl?[]:(0,S.todaysFinishedList)(Us,vt,Yi),Xi=rl?cl?`${dl}\u2019s guests`:`Guests ${dl}`:'Today\u2019s guests',Zi=(0,qe.jsxs)(qe.Fragment,{children:[0===Qi.length?(0,qe.jsx)(Y.Muted,{children:rl?al{const t=(0,S.isLeftEarly)(e,vt,Yi),s=(0,le.isSeatedHighlight)(e.status,{otherDay:rl})&&!t,l=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=se.colours.text,n=s?se.colours.goldLight:se.colours.muted,o=se.colours.gold,a=l.depositWarn?se.colours.amber:se.colours.goldLight;return(0,qe.jsxs)(F.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:rl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,le.seatedHighlightStyle)({backgroundColor:e?Qe:Ye,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,qe.jsx)(Y.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)(U.default,{style:{paddingTop:2},children:(0,qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,qe.jsx)(Y.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,qe.jsx)(Y.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&re.OCCASION_ICON[l.occasion]?(0,qe.jsx)(Y.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:re.OCCASION_ICON[l.occasion]}):null]}),(0,qe.jsxs)(Y.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Y.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}),(0,qe.jsx)(Y.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,qe.jsx)(Y.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(U.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(me.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,qe.jsx)(Y.T,{size:15,colour:se.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),Ji.length?(0,qe.jsxs)(U.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(F.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ji.length}${bs?', expanded':', collapsed'}`,accessibilityState:{expanded:bs},onPress:()=>ys(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Y.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ji.length,")"]}),(0,qe.jsx)(Y.T,{size:16,colour:se.colours.muted,children:bs?'\u25be':'\u25b8'})]}),bs?Ji.map(e=>{const t=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,qe.jsxs)(F.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Y.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Y.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,qe.jsx)(U.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,qe.jsx)(v.BookingUndo,{b:e,rid:mt,today:Ht,who:t.name,allowed:wi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ae.CancellationsSection,{items:Hl,dayWord:rl?cl?dl.toLowerCase():`on ${dl}`:'today'})]}),en=(0,qe.jsx)(V.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Zi}),tn=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&gs(!1)}}),sn=(0,qe.jsxs)(F.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Xi}, ${Qi.length}`,accessibilityState:{expanded:hs},'aria-expanded':hs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>gs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:hs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:hs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Y.T,{size:16,weight:"bold",colour:se.colours.gold,children:Qi.length}),(0,qe.jsx)(U.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(U.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,qe.jsxs)(Y.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Xi," ",hs?'\u2039':'\u203a']})})})]}),ln=Math.min(560,Math.max(320,.44*at))<400,nn=hs?(0,qe.jsxs)(U.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,qe.jsxs)(U.default,{testID:"guests-drawer",...tn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*at)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,...Ne.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,qe.jsxs)(U.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,qe.jsxs)(U.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsxs)(U.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,qe.jsxs)(Y.T,{testID:"guests-heading",size:ln?14:17,weight:"semibold",colour:se.colours.gold,style:{flexShrink:1,minWidth:0},children:[Xi.toUpperCase()," (",Qi.length,")"]}),(0,qe.jsx)(F.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:cs},'aria-expanded':cs,onPress:()=>us(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:ln?8:12,borderRadius:12,borderWidth:1,borderColor:cs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?se.colours.tilePressed:cs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:se.colours.goldLight,children:[ln?'Key':'Guest key'," ",cs?'\u25b4':'\u25be']})})]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Xi}`,onPress:()=>gs(!1),style:{marginRight:-6,flexShrink:0}})]}),zl.count?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Pl}):null,cs?(0,qe.jsxs)(U.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:se.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,qe.jsxs)(U.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:se.colours.amber,ink:se.colours.bg}),(0,qe.jsx)(Y.T,{size:14,children:"allergy"})]}),(0,qe.jsxs)(U.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(me.DogIcon,{size:18}),(0,qe.jsx)(Y.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,qe.jsxs)(U.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(Y.T,{size:16,children:e}),(0,qe.jsx)(Y.T,{size:14,children:t})]},t))]}):null]}),en]}),(0,qe.jsx)(F.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Xi}`,accessibilityRole:"button",onPress:()=>gs(!1),style:{flex:1}})]}):null,on=ml?jl:l.IS_KIRKTON&&!Object.values(jt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(U.default,{testID:"kirkton-hours-to-confirm",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Y.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(jt,It,vt).busy,todays:ul,open:bl,close:yl,now:vt,turnBase:jt.settings.turnMins,blocks:Ml,pauses:fl,compact:ct,dense:!ct,fit:ht,tight:ht&&dt<=600,height:ht?Si:Di,forecastNote:rl?void 0:Ql,emptyText:wl,past:al{Ds.current=Date.now(),ks(!0)},shortDay:!ct&&at<1100}),dn=(0,qe.jsx)(He.DisplayCalendar,{visible:Is,today:Ht,day:al,bookings:It,restaurant:jt,now:vt,onDay:Ss,onClose:()=>ks(!1)}),cn=()=>{rl?gs(!0):Kt(!0)},un=(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',padding:zi?4:dt<820?8:12,paddingTop:zi?ki?2:4:dt<820?ki?4:6:ki?8:10,gap:zi?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:yi,Pt?(0,qe.jsx)(V.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"})}):gi?hi:ui,bi,nn]}),(0,qe.jsxs)(U.default,{testID:"display-side",style:{width:bt,gap:dt<820?4:8,minHeight:0},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Ii(!1)}),(0,qe.jsx)(U.default,{style:{flexShrink:0},children:ji}),Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",onLayout:Ui,style:ki&&!Ni?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:dt<820,snug:dt<820,tight:dt<800,fill:ki&&!Ni,sound:(0,O.flapSoundOn)(),onPress:cn})}),Pt?null:(0,qe.jsx)(U.default,{ref:Ti,testID:"day-graph-slot",onLayout:Ui,style:{flexGrow:0,flexShrink:ki?0:1,flexBasis:(ct?Di:Si)+(ki?Mi:Hi),height:(ct?Di:Si)+(ki?Mi:Hi),minHeight:dt<=600?90:Math.min((ct?Di:Si)+We.DAY_GRAPH_CHROME,!ct&&dt>=768?140+We.DAY_GRAPH_CHROME:120),overflow:'visible'},children:an}),ki&&!Pt?(0,qe.jsx)(U.default,{ref:$i,testID:"display-side-split",onLayout:Ui,style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})}):null,(0,qe.jsxs)(V.default,{testID:"display-side-scroll",style:ki?{flexGrow:0,flexShrink:1,minHeight:Wi&&Oi?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Bi.current&&(Bi.current=s,Li(s),setTimeout(Ui,0))},children:[ki||xi?null:(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),qi,(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt})]})]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Ds.current=Date.now()},onMouseDown:()=>{Ds.current=Date.now()},children:[ct?(0,qe.jsx)(U.default,{style:{flex:1},children:(0,qe.jsxs)(V.default,{ref:yt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,qe.jsxs)(U.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,qe.jsx)(U.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,qe.jsx)(j.ExitButton,{})}),(0,qe.jsx)(X.RestaurantLogo,{rid:mt,size:64}),(0,qe.jsx)(Y.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:jt.name}),(0,qe.jsx)(X.PoweredBy,{}),(0,qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(U.default,{accessible:!0,accessibilityLabel:`Current time ${(0,ee.hm)(vt)}`,children:(0,qe.jsx)(Y.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,ee.hm)(vt)})}),(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:"m"}),(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",size:"m"}),Z]}),Fe,k.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:mt}),rn,(0,qe.jsx)(U.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(it,{phone:!0,split:Ll,items:[{label:`Tables \xb7 ${dl}`,value:Bl.length,testID:'badge-tables'},{label:`Covers \xb7 ${dl}`,value:Wl,testID:'badge-covers'},{label:'Takeaway',value:qs.length,alert:qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ls(!0)}]})}),(0,qe.jsx)(U.default,{testID:"primary-actions",style:{gap:8},children:Ii(!0)}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt}),ji,(0,qe.jsxs)(U.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[gi?hi:ui,bi]}),(0,qe.jsxs)(U.default,{onLayout:e=>{pt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ne.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Y.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Xi," (",Qi.length,")"]}),(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{gap:4},children:Zi})]}),qi,an,(0,qe.jsx)(U.default,{testID:"covers-dock",children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>yt.current?.scrollTo({y:pt.current,animated:!0})})}),(0,qe.jsxs)(U.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,qe.jsx)(Y.T,{center:!0,size:14,colour:Ot?se.colours.muted:se.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Y.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Rs(!0),style:{minHeight:48,alignSelf:'stretch'}}),xi?null:(0,qe.jsx)(Y.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ki]})}):(0,qe.jsxs)(qe.Fragment,{children:[ki?(0,qe.jsx)(U.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:se.colours.hairline},children:(0,qe.jsx)(U.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)(U.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,paddingVertical:zi?2:dt<820?4:8,gap:8,minHeight:zi&&ki?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ne.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(U.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:ki?16:8,minWidth:0,overflow:'hidden',...ki?{justifyContent:'flex-start'}:null},children:[(0,qe.jsx)(U.default,{testID:"display-header-brand",style:ki?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(X.RestaurantBrand,{rid:jt.id,size:at<900?32:40,beside:!0,noLogo:ki})}),(0,qe.jsxs)(U.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Y.T,{size:at<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,ee.hm)(vt)}),at>=900?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:(0,ee.niceDate)(vt)}):null]})]}),Pt?(0,qe.jsx)(U.default,{style:{width:220}}):(0,qe.jsx)(U.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:rn}),(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,qe.jsxs)(U.default,{testID:"display-header-chips",style:{flexDirection:at>=1400||ki?'row':'column',alignItems:at>=1400||ki?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:at<1240?'xs':at<1280||dt<700?'s':'m'}),Pt?null:(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",slot:ki,size:at<1340?'xs':at<1400||dt<700?'s':'m'})]}),'simulated'===St?(0,qe.jsx)(F.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>Dt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,Z,e?null:(0,qe.jsx)(U.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(j.ExitButton,{size:44})})]})]}),Fe,k.IS_CAR||!Pt||ki?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:mt,margin:{marginHorizontal:12,marginTop:6}}),Pt||ki?null:(0,qe.jsx)(U.default,{testID:"display-day-stats",style:Xe,children:(0,qe.jsxs)(U.default,{style:Ze,children:[k.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(U.default,{style:et,children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})})]})}),ht?un:(hn=(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{testID:"front-door-bar",style:{gap:10},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Ii(!1)}),ji]}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt}),Pt?(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"}):(0,qe.jsx)(qe.Fragment,{children:(0,qe.jsxs)(U.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[yi,gi?hi:ui,bi,nn]})]})}),qi,Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,sound:(0,O.flapSoundOn)(),onPress:cn})}),Pt?null:(0,qe.jsx)(U.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Di+We.DAY_GRAPH_CHROME},children:an})]}),(0,qe.jsx)(V.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:hn})),Ki]}),(0,qe.jsx)($.SoldOutStrip,{rid:mt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:zs,onClose:()=>Hs(!1),rid:mt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:mt}),Mt.elements,is?(0,qe.jsx)(y.EditBookingPicker,{rid:mt,today:Ht,who:Lt,onClose:()=>ns(!1)}):null,os?(0,qe.jsx)(y.EditBookingSheet,{rid:mt,id:os,who:Lt,onClose:()=>as(null)}):null,Qt?(0,qe.jsx)(Se.TableSheet,{rid:mt,name:Qt,view:Xs,plan:Nt,todays:Us,now:vt,privacy:Ot,turnBase:jt.settings.turnMins,onClose:()=>Jt(null),onWalkIn:e=>Mt.openWalkInAt(e),onMove:e=>Zt(e),onDetails:Vs}):null,kl?(()=>{const e=Il[kl],t=e?.dayBookings??[];return(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>{$l(null),Dl(null)},title:`${(0,d.tableNumbersA11y)(kl)} \xb7 ${cl?dl:(0,ze.dayLong)(al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Y.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${cl?dl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${cl?dl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Ot):tt(e.name);return(0,qe.jsx)(Y.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,ke.tablesWords)((0,ae.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Dl(null),fs(e.id)},style:{minHeight:56}},e.id)}),al>=Ht?(()=>{const t=e?.table.maxSeats??0,s=It.filter(e=>e.date===al&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,ae.tablesOf)(e.table).includes(kl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,qe.jsxs)(U.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(kl)]}),Rl?(0,qe.jsxs)(U.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Rl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Rl.ask}),(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!wi.ok,accessibilityHint:wi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Rl.id);if($l(null),!e)return;const s=tt(e.name);Dl(null),await(0,Ie.saveTablesReported)(mt,e,[kl],s,t,Os)}}),(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>$l(null)})]})]}):null,Rl?null:s.slice(0,12).map(e=>{const s=tt(e.name),l=e.partySize>t;return(0,qe.jsx)(Y.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:!wi.ok,accessibilityHint:wi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(kl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(Os,{b:e,tables:[kl]}))return;const l=(0,ke.overCapacityAsk)([kl],t,e.partySize);l?$l({id:e.id,ask:l}):(Dl(null),await(0,Ie.saveTablesReported)(mt,e,[kl],s,t,Os))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Y.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{$l(null),Dl(null)},style:{minHeight:56}})]})})():null,ps?(()=>{const e=It.find(e=>e.id===ps);return e?(0,qe.jsx)(je.GuestActionsSheet,{rid:mt,b:e,name:e.walkIn?(0,fe.privName)(e,Ot):tt(e.name),view:Xs,now:vt,otherDay:e.date!==Ht,turnBase:jt.settings.turnMins,onClose:()=>fs(null),onDetails:Vs,onDone:Os,onEdit:e=>{fs(null),as(e.id)},onPickOnPlan:(e,t)=>{gs(!1),Vt('plan'),Yt('all'),ms({id:e.id,tables:t})}}):null})():null,es?(0,qe.jsx)(Se.DetailsPanel,{title:es.title,onClose:()=>ts(null),children:es.body}):null,dn,rs?(0,qe.jsx)(Se.ServiceSummary,{r:jt,todays:Us,orders:wt,waitlistAll:vs,walkInCount:Cs,onClose:()=>ds(!1)}):null,Ts?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Rs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsxs)(U.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:se.colours.amber,ink:se.colours.bg}),(0,qe.jsx)(Y.T,{size:14,children:"allergy"})]}),(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(me.DogIcon,{size:18}),(0,qe.jsx)(Y.T,{size:14,children:"dog"})]}),(0,qe.jsx)(Y.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Rs(!1)})]}):null,Ws?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ls(!1),Bs(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,$s?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(Q.ReviewsSection,{rid:mt,mode:"read",venueName:jt.name}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,ss?(0,qe.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>ls(!1),children:[(0,qe.jsx)(Y.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(ot,{list:qs,me:Lt,bookings:It})]}):null,Es?(0,qe.jsx)(U.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,qe.jsx)(he.PlanDesigner,{initial:Nt,venue:jt.name,mode:"display",startStep:"arrange",onActivity:()=>{_s.current=Date.now(),null!==Gs&&Fs(null)},notice:null!==Gs?`Locking again in ${Gs} s \xb7 touch to keep editing`:null,onSave:e=>{ae.useFloor.getState().setPlan(mt,e),Ns(null),Os('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{ae.useFloor.getState().setPlan(mt,e),Os('Live seating plan updated on every screen.')},onCancel:()=>{Ns(null),Os('No changes kept. Editing is locked again.')}},Es.at)}):null,e?null:(0,qe.jsx)(ye.Screensaver,{rid:mt,idleMins:At.idleMins,pinOn:At.pinOn,wake:At,tonightCards:At.tonightCards,cfg:Et}),e?null:(0,qe.jsx)(Ce.PrintHost,{rid:mt}),e?null:(0,qe.jsx)(ve.AlertHost,{variant:"display",rid:mt,skipTakeaway:!0}),e?null:(0,qe.jsx)(E.SeatAllergenReminder,{rid:mt}),e?null:(0,qe.jsx)(Te.TakeawayTakeover,{rid:mt,me:Lt})]});var hn}function rt({rid:e,id:t,turnBase:s}){const l=(0,te.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1336,[1051,779,805,806,1337,813,1338,1092,843,1138,1339,1340,1341,1089,1120,1342,1343,1348,1349,1206,1350,856,1355,1356,1357,1113,1111,920,1358,1150,891,1102,1359,17,1070,1182,1016,1085,1360,378,363,385,278,85,409,19,777,1237,1241,857,845,863,858,804,1088,876,1096,1055,996,1074,1107,1361,1106,1362,1369,1371,1374,1379,1373,1380,1383,1384,1115,1093,1094,862,1389,1226,1390,1236,1228,993,1395,1400,1401,1052,1050,1117,1403,1404,1405,1069,1169,1406,1168,1159,853,1351,1407,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},1339,[]); @@ -1437,7 +1437,7 @@ __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(t,c){return}},1354,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.displayActionBy=function(t){if(t.isCar)return'Car';if(t.isDisplayApp)return'Display';return(t.personName??'').trim()||'Duty Manager'}},1355,[]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"finishClearPatch",{enumerable:!0,get:function(){return s.finishClearPatch}}),Object.defineProperty(e,"DEFAULT_TURN_MINS",{enumerable:!0,get:function(){return a}}),e.bookingEndAt=u,e.isLeftEarly=o,e.todaysGuestList=function(t,n,s=a){return t.filter(t=>'confirmed'===t.status||'seated'===t.status||o(t,n,s)).sort((t,n)=>t.time.localeCompare(n.time))},e.todaysFinishedList=function(t,n,s=a){return t.filter(t=>'finished'===t.status&&!o(t,n,s)).sort((t,n)=>t.time.localeCompare(n.time))};var t=r(d[0]),n=r(d[1]),s=r(d[2]);const a=90;function u(s,u=a){if(!s.date||!s.time)return null;const o=(0,n.atTime)((0,n.parseYmd)(s.date),s.time),f=u>0?u:a,c=s.durationMins&&s.durationMins>=15?s.durationMins:(0,t.turnFor)(s.partySize??2,f);return new Date(o.getTime()+6e4*c)}function o(t,s,o=a){if('finished'!==t.status||!t.date||!t.time||!t.finishedAt)return!1;const f=(0,n.atTime)((0,n.parseYmd)(t.date),t.time);if(new Date(t.finishedAt).getTime()>=f.getTime())return!1;const c=u(t,o);return!!c&&(s??new Date).getTime()1?'are':'is'} free again`:'',"."]}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${$}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>I(t,e,{stage:void 0,dirty:!1})),j(!1)}}),(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${$} seated`,onPress:()=>j(!1)})]})]}):(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${$}: ${e.walkIn?'removes the walk-in':'back to booked'}${v?`, frees ${v}`:''}`,onPress:()=>j(!0)});const L='undo-finished'===x?'seated':'confirmed';return(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===x?`Undo finished: ${$} back to seated${v?` at ${v}`:''}`:`Undo no-show: ${$} back to booked`,onPress:async()=>{'undo-finished'!==x?await n.repo.bookings.setStatus(e.id,L):await(0,b.undoFinishedNow)(t,e)}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),h=r(d[7]),f=r(d[8]);function k(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1357,[17,85,858,996,777,804,1112,1111,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=k,_e.BookingUndo=function({b:e,rid:t,today:w,who:$,allowed:y=!0}){const[p,j]=(0,s.useState)(!1),x=k(e,w);if(!x||!y)return null;const U=(0,h.tableForUndo)(e),v=(0,l.tableCardLabel)(U),I=l.useFloor.getState().setLive;if('unseat'===x)return p?(0,f.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,f.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",$,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',v?` and ${v} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${$}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>I(t,e,{stage:void 0,dirty:!1})),j(!1)}}),(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${$} seated`,onPress:()=>j(!1)})]})]}):(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${$}: ${e.walkIn?'removes the walk-in':'back to booked'}${v?`, frees ${v}`:''}`,onPress:()=>j(!0)});const L='undo-finished'===x?'seated':'confirmed';return(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===x?`Undo finished: ${$} back to seated${v?` at ${v}`:''}`:`Undo no-show: ${$} back to booked`,onPress:async()=>{'undo-finished'!==x?await n.repo.bookings.setStatus(e.id,L):await(0,b.undoFinishedNow)(t,e)}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),h=r(d[7]),f=r(d[8]);function k(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1357,[17,85,858,996,777,804,1113,1111,8]); __d(function(g,r,i,a,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},1358,[813,812,17,219,385,278,85,777,1150,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])},1359,[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])},1360,[17,85,780,804,8]); @@ -1460,16 +1460,16 @@ __d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?global __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||'')}},1377,[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},1379,[17,831,928,899,1378]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=$,e.guestRowText=function(n,p){const l=n.partySize,b=Math.max(0,Math.min(l-1,Math.round(Number(n.children)||0))),f=`${l} ${1===l?'person':'people'}${b?` (${b} ${1===b?'child':'children'})`:''}`,h=(0,o.tablesOf)(n.table??void 0),c=h.length?`${p.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',w=p.leftEarly?"Left early"+(c?` \xb7 ${c}`:''):p.finished?"Finished"+(c?` \xb7 ${c}`:''):p.seated?"Seated"+(c?` \xb7 ${c}`:''):c||'No table yet',x=$(n),y=h.length?`table${h.length>1?'s':''} ${u(h.map(t.plainTableNumber))}`:p.finished?'finished':'no table yet',D=!!n.dog,m=(0,s.allergyLine)(n),k=(0,d.guestChangeLine)(n),v=[n.time,p.name,m?`allergy noted: ${m}`:'',f,p.leftEarly?'left early':p.finished?'finished':p.seated?'seated':'',x?.spoken??'',y,D?'dog':''].filter(Boolean).join(', ')+'.'+(k?` ${k}`:'');return{time:n.time,name:p.name,people:f,deposit:x?.text??null,depositWarn:!!x?.warn,table:w,dog:D,allergy:m,guestChange:k,a11y:v}};var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),s=r(_d[3]),d=r(_d[4]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,l=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 o=(0,n.depositBadge)(t,p);if(!o)return null;const s=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||d>0&&u>d&&!o.label.startsWith('Deposit paid')){const t=d||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${l(t).replace(' pounds','')} of ${l(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(o.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const $=o.label.match(/\xa3[\d.,]+/);if(o.label.startsWith('Deposit paid')){const t=/about/.test(o.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(o.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(o.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}}},1380,[843,841,996,1381,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}}},1380,[843,841,996,1381,1382]); __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])},1381,[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}},1382,[]); __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])},1383,[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'},1384,[1385,843,1093,996,17,85,777,1096,858,1113,1380,1094,863,1091,1114,1115,1116,804,1340,1387,1388,1112,1357,1111,8]); +__d(function(_g,r,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'},1384,[1385,843,1093,996,17,85,777,1096,858,1114,1380,1094,863,1091,1115,1116,1117,804,1340,1387,1388,1113,1357,1111,8]); __d(function(g,r,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])},1385,[17,362,385,85,858,920,876,994,1386,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')}`}},1386,[]); __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},1389,[1169,1385,813,1093,812,843,1138,1089,1114,863,17,1076,219,385,278,85,777,1096,1373,858,996,845,1087,1074,1318,804,1340,1387,1388,1112,1111,8]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"Card",{enumerable:!0,get:function(){return M}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const l=e.filter(e=>'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},1389,[1169,1385,813,1093,812,843,1138,1089,1115,863,17,1076,219,385,278,85,777,1096,1373,858,996,845,1087,1074,1318,804,1340,1387,1388,1113,1111,8]); __d(function(g,_r,_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.']}]},1390,[812,17,219,385,85,777,858,996,1391,804,1392,1394,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))},1391,[]); __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)}},1392,[831,858,996,1391,1393,1394]); @@ -1495,7 +1495,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1412,[13,17,1413,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])},1413,[17,856,1414,1555,8]); __d(function(g,_r,i,_a,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,{})]})}},1414,[805,813,899,1190,1224,1206,1026,1023,891,1024,880,1030,1085,17,356,378,385,278,409,85,19,777,857,858,876,804,1415,1181,1055,884,1423,920,219,1428,1468,839,856,1470,1477,1478,1479,1187,1242,1480,1454,1481,1483,1452,1158,1226,1390,1228,1241,1485,1082,1084,1551,1552,1571,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])},1415,[805,1416,1093,1266,1417,812,822,1114,1115,1089,1119,1418,1120,1116,1403,1404,1055,1340,994,1117,1087,841,1382,1123,1420,1237,1421,1395,1076,1053,1088,17,85,777,1360,858,845,851,863,1318,804,1181,1096,1112,996,1357,1060,1159,1422,1228,899,1183,1400,862,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1415,[805,1416,1093,1266,1417,812,822,1115,1116,1089,1120,1418,1112,1117,1403,1404,1055,1340,994,1118,1087,841,1382,1123,1420,1237,1421,1395,1076,1053,1088,17,85,777,1360,858,845,851,863,1318,804,1181,1096,1113,996,1357,1060,1159,1422,1228,899,1183,1400,862,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.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])},1417,[806,17,85,777,899,1270,8]); __d(function(g,r,_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])},1418,[17,385,85,1419,899,928,804,777,8]); @@ -1508,7 +1508,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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])},1425,[17,278,85,777,857,804,1426,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(' ')},1426,[]); __d(function(g,_r,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]})}},1427,[888,813,17,1067,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,{}),'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%'}}),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,(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}})]})]})]})})}},1428,[843,1138,1429,17,780,1182,1072,1073,1421,1340,861,1076,264,385,85,777,858,876,1207,1190,845,1157,863,1053,866,804,1181,1055,1137,1142,1143,1006,839,1147,886,899,915,1439,1440,1146,1441,1159,853,1444,1185,1205,856,1204,1029,1030,1064,1096,1395,1150,1339,1462,8]); +__d(function(g,_r,_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}})]})]})]})})}},1428,[843,1138,1429,17,780,1182,1072,1073,1421,1340,861,1076,264,385,85,777,858,876,1207,1190,845,1157,863,1053,866,804,1181,1055,1137,1142,1143,1006,839,1147,886,899,915,1439,1440,1146,1441,1159,853,1444,1185,1205,856,1204,1029,1030,1064,1096,1395,1150,1339,1462,8]); __d(function(_g,_r,_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."})]})}},1429,[1051,1031,805,1416,812,1430,1431,1433,1434,1435,1200,1029,1030,1006,1012,17,385,85,777,841,1436,816,862,1053,861,804,1055,858,1184,926,927,876,1437,1390,996,1438,1003,1140,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)},1430,[812,17,85,777,1138,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)},1431,[843,17,219,85,777,858,996,1151,1259,899,1334,1432,8]); @@ -1558,12 +1558,12 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ThingsToHaveReady=function({onOpenTablePlan:e}){return(0,h.jsxs)(s.default,{testID:"onboard-ready",style:{width:'100%',alignItems:'center',gap:14},children:[b('Things to have ready'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Gather these before you check the questionnaire. Nothing here is sent."}),d.READY_ITEMS.map((t,a)=>(0,h.jsxs)(s.default,{testID:`ready-item-${a+1}`,accessible:!0,accessibilityLabel:t,style:{width:'100%',alignItems:'center',gap:6,minHeight:48},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:"\u2713"}),(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:t}),0===a&&e?(0,h.jsx)(n.Button,{kind:"ghost",label:"Open the table plan",accessibilityLabel:"Open the table plan to add a drawing or picture",onPress:e}):null]},t))]})},_e.QuestionnaireAnswers=function({q:e,rid:t,onEdit:y}){const E=(0,i.usePlan)(t),j=(0,a.useMenu)(t),f=(0,l.useAccounts)(e=>e.byVenue[t])??p,x=(E.areas??[]).map(e=>{const t=(0,o.planCounts)(E,e.id);return t.tables?`${e.name}: ${t.tables} ${1===t.tables?'table':'tables'}, ${t.seats} Covers`:e.name}),$=x.length?x:(e.tables.areas??[]).map(e=>e);(e.tables.tables||e.tables.covers)&&$.unshift([e.tables.tables?`${e.tables.tables} tables`:'',e.tables.covers?`${e.tables.covers} Covers`:''].filter(Boolean).join(', '));const w=c.WEEK_ORDER.map(t=>`${c.DAY_NAMES[t]}: ${e.hours.days[t]?`${e.hours.days[t][0]} to ${e.hours.days[t][1]}`:'Closed'}`),D=e.team.map(e=>{const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff',s=e.job&&e.job.trim().toLowerCase()!==t.toLowerCase()?e.job.trim():'';return[e.name,s,t].filter(Boolean).join(', ')}),v=e.suppliers.map(e=>[e.name,e.category,e.phone,e.email].filter(Boolean).join(', ')),I=f.filter(e=>e.accountNo).map(e=>`${e.customName||e.provider}: ${e.accountNo}`),L=e.pay?["Tips "+('fortnightly'===e.pay.tipsFrequency?'every two weeks':'weekly'===e.pay.tipsFrequency?'every week':'monthly'),e.pay.tipsAnchorPayday?`Next tips payday anchor ${e.pay.tipsAnchorPayday}`:'',e.pay.wagePayDay?`Wages on day ${e.pay.wagePayDay}`:''].filter(Boolean):[],T=j.filter(e=>Object.keys(e.allergens??{}).length).length,q=j.length?[`${j.length} ${1===j.length?'dish':'dishes'} on the menu`]:[],N=j.length?[T?`Recorded on ${T} ${1===T?'dish':'dishes'}`:d.NOT_ANSWERED]:[],_=[e.venue.name,e.venue.tagline,e.venue.address,e.venue.phone,e.venue.email,e.venue.website].filter(e=>!!e&&''!==e.trim());return(0,h.jsxs)(s.default,{testID:"onboard-questionnaire",style:{width:'100%',alignItems:'center',gap:4},children:[b('Your questionnaire'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Tap a section to edit it. Blank answers stay blank."}),(0,h.jsx)(m,{testID:"q-venue",title:"Venue",lines:_,onEdit:()=>y('venue'),editLabel:"Edit venue"}),(0,h.jsx)(m,{testID:"q-hours",title:"Opening hours",lines:w,onEdit:()=>y('hours'),editLabel:"Edit opening hours"}),(0,h.jsx)(m,{testID:"q-tables",title:"Table plan",lines:$,onEdit:()=>y('tables'),editLabel:"Edit table plan"}),(0,h.jsx)(m,{testID:"q-team",title:"Staff and roles",lines:D,onEdit:()=>y('team'),editLabel:"Edit staff and roles"}),(0,h.jsx)(m,{testID:"q-pay",title:"Pay and tips dates",lines:L,onEdit:()=>y('pay'),editLabel:"Edit pay and tips"}),(0,h.jsx)(m,{testID:"q-suppliers",title:"Suppliers",lines:v,onEdit:()=>y('suppliers'),editLabel:"Edit suppliers"}),(0,h.jsx)(m,{testID:"q-accounts",title:"Supplier account numbers",lines:I,onEdit:()=>y('accounts'),editLabel:"Edit account numbers"}),(0,h.jsx)(m,{testID:"q-logo",title:"Logo",lines:e.venue.hasLogo?['Logo added']:[],onEdit:()=>y('branding'),editLabel:"Edit logo"}),(0,h.jsx)(m,{testID:"q-menu",title:"Menu",lines:q,onEdit:()=>y('menu'),editLabel:"Edit menu"}),(0,h.jsx)(m,{testID:"q-allergens",title:"Allergens",lines:N,onEdit:()=>y('menu'),editLabel:"Edit allergens"}),(0,h.jsx)(m,{testID:"q-cashup",title:"What to record at nightly cash up",lines:e.cashUp??[],onEdit:()=>y('cashup'),editLabel:"Edit cash up"})]})},r(_d[0]);var t=e(r(_d[1])),s=e(r(_d[2])),n=r(_d[3]),a=r(_d[4]),l=r(_d[5]),i=r(_d[6]),o=r(_d[7]),d=r(_d[8]),c=r(_d[9]),u=r(_d[10]),h=r(_d[11]);const p=[],b=e=>(0,h.jsx)(n.T,{accessibilityRole:"header",center:!0,size:22,weight:"bold",colour:u.colours.gold,style:{width:'100%'},children:e});const y=e=>e.replace(/([@.])/g,'$1\u200b');function m({testID:e,title:s,lines:a,onEdit:l,editLabel:i}){const o=a.length?a.join('. '):d.NOT_ANSWERED;return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"button",accessibilityLabel:`${s}. ${o}. ${i}.`,onPress:l,style:{width:'100%',minHeight:48,alignItems:'center',gap:4,paddingVertical:10,paddingHorizontal:8,borderTopWidth:1,borderColor:u.colours.border},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:s}),(a.length?a:[d.NOT_ANSWERED]).map((e,t)=>(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:y(e)},`${s}-${t}`)),(0,h.jsx)(n.T,{center:!0,size:14,colour:u.colours.gold,children:i})]})}},1475,[17,385,85,777,860,1474,996,842,1476,1471,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'},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}),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}},1477,[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])},1478,[1182,1070,1114,1087,17,385,85,777,876,863,804,1088,1168,1165,1055,1117,1179,1441,1159,860,1183,853,1181,884,1357,996,843,1112,1196,1203,1069,8]); +__d(function(g,_r,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])},1478,[1182,1070,1115,1087,17,385,85,777,876,863,804,1088,1168,1165,1055,1118,1179,1441,1159,860,1183,853,1181,884,1357,996,843,1113,1196,1203,1069,8]); __d(function(g,_r,_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']}},1479,[17,1053,85,409,777,858,1139,1138,861,863,804,876,1181,1055,1146,1142,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}))},1480,[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]})]})}},1481,[805,1416,843,1390,17,85,777,858,860,866,845,851,1157,1103,863,804,1181,1055,1158,1159,853,1422,848,900,1482,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])},1482,[17,85,777,858,851,1156,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},{id:'support',title:'Customer support',sub:'Send a message or a picture to CoverCharge',group:'Start here',can:e=>'owner'===e&&!r.IS_CAR,C:fe.SupportChatPage}]),(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}])},1483,[822,1048,856,1484,876,920,909,816,866,1486,1493,1495,1454,1496,1497,1499,1500,1158,1479,1501,1502,1503,1462,1199,1190,1481,1504,1452,1505,1506,17,1196,1179,1453,1441,1455,1511,1210,1517,1518,1468,1519,1444,1429,1520,1459,1521,886,1522,1523,1525,1185,1470,1526,1390,1472,1538,1079,1055,1200,1150,1542,1545,1548,1550]); +__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}])},1483,[822,1048,856,1484,876,920,909,816,866,1486,1493,1495,1454,1496,1497,1499,1500,1158,1479,1501,1502,1503,1462,1199,1190,1481,1504,1452,1505,1506,17,1196,1179,1453,1441,1455,1511,1210,1517,1518,1468,1519,1444,1429,1520,1459,1521,886,1522,1523,1525,1185,1470,1526,1390,1472,1538,1079,1055,1200,1150,1542,1545,1548,1550]); __d(function(g,r,i,a,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)}},1484,[17,378,219,385,85,19,777,1024,1336,876,804,1485,1187,1480,1055,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}))},1485,[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}},1486,[812,1450,17,851,85,777,876,804,1055,884,885,1487,899,916,1029,1448,1488,1489,1491,994,1492,8]); @@ -1606,12 +1606,12 @@ __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule? __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})},1523,[820,896,1452,17,219,85,777,816,876,895,998,897,899,1524,804,880,1160,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'}},1524,[]); __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])},1525,[17,85,777,804,1431,1507,1055,8]); -__d(function(g,_r,_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,c]=(0,a.useState)(null),[p,m]=(0,a.useState)(null),w=(0,a.useMemo)(()=>[...u.HELP,...f],[]),b=(0,a.useMemo)(()=>s.trim()?(0,h.searchHelp)(w,s,10).map(e=>e.a):w.filter(e=>!r||e.topic===r),[s,r,w]);return(0,y.jsxs)(l.default,{style:{gap:10},testID:"help-page",children:[(0,y.jsxs)(l.default,{style:[i.styles.input,{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:4}],children:[(0,y.jsx)(i.T,{colour:x.colours.muted,children:"\ud83d\udd0d"}),(0,y.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:x.colours.text,paddingVertical:8,fontSize:16,outlineStyle:'none'}}),s?(0,y.jsx)(n.GoldClose,{testID:"help-search-clear",size:"sm",label:"Clear search",onPress:()=>o('')}):null]}),s?(0,y.jsx)(i.Muted,{children:b.length?`${b.length} result${1===b.length?'':'s'} for \u201c${s.trim()}\u201d`:`Nothing for \u201c${s.trim()}\u201d. Try other words, or ask the Assistant above.`}):(0,y.jsx)(i.Row,{wrap:!0,gap:6,children:[null,...u.HELP_TOPICS].map(e=>(0,y.jsx)(i.Chip,{label:e??'All',selected:r===e,onPress:()=>c(e)},e??'all'))}),b.map((t,n)=>(0,y.jsx)(j,{a:t,go:e,open:p===t.id||!!s&&0===n&&null===p,onToggle:()=>m(p===t.id?'':t.id)},t.id)),(0,y.jsxs)(i.Card,{style:{alignItems:'center'},children:[(0,y.jsx)(i.T,{center:!0,weight:"semibold",colour:x.colours.gold,children:"Chat with CoverCharge support"}),(0,y.jsx)(i.Muted,{center:!0,children:"Send a message to the CoverCharge team. Nobody replies automatically."}),(0,y.jsx)(i.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,m.useCtx)(6e4),n={rid:t,today:s,go:(t,s)=>e(t,s??null)},[o,r]=(0,a.useState)(''),[c,h]=(0,a.useState)(null),[f,j]=(0,a.useState)(null),C=async()=>{const e=o.trim();if(!e)return;j(null),h(null);const t=(0,p.matchIntent)(e,s);if('action'!==t.kind)'help'!==t.kind?j({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'}):j({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 j({text:'done'===e.status?e.message:e.message??'',kind:'done'})}h({action:t.action,params:{...b(t.action,s),...t.params},asked:e})}};return(0,y.jsx)(l.default,{testID:"ask-assistant",children:(0,y.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(l.default,{style:{width:28,height:28,borderRadius:14,backgroundColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(i.T,{weight:"bold",colour:"#1A1408",children:"\u2726"})}),(0,y.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Ask the Assistant"})]}),(0,y.jsxs)(l.default,{testID:"help-assistant-stack",style:{gap:8,width:'100%',minWidth:0},children:[(0,y.jsx)(i.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,y.jsx)(i.Button,{label:"Ask",testID:"assistant-ask",disabled:!o.trim(),onPress:C,style:{width:'100%',minWidth:0,minHeight:52}})]}),(0,y.jsx)(i.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,y.jsx)(i.Chip,{label:e,onPress:()=>r(e)},e))}),c?(0,y.jsx)(k,{p:c,today:s,onChange:e=>h({...c,params:e}),onConfirm:async()=>{if(!c)return;const e=await(0,p.runAction)(c.action.id,c.params,n,!0);h(null),r(''),j('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:()=>{h(null),j({text:'Cancelled. Nothing was changed.',kind:'note'})}}):null,f?(0,y.jsxs)(l.default,{style:{gap:6},testID:"assistant-reply",children:[(0,y.jsx)(i.Banner,{kind:'done'===f.kind?'success':'error'===f.kind?'warn':'demo'===f.kind?'demo':'info',title:f.text}),f.help?.map(t=>{const s=(0,u.helpById)(t);return(0,y.jsxs)(i.Row,{gap:6,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.T,{style:{flex:1},children:s.title}),s.showMe?(0,y.jsx)(i.Button,{small:!0,kind:"success",label:"Show me",onPress:()=>w(s,e)}):null]},t)})]}):null,(0,y.jsx)(i.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])),l=e(_r(d[5])),i=_r(d[6]),r=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),p=_r(d[11]),x=_r(d[12]),m=_r(d[13]),y=_r(d[14]);const f=[{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 on Home and under 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.'}}];function w(e,t){e.showMe&&(t(e.showMe.tab,e.showMe.page??null),setTimeout(()=>c.useCoach.getState().show(e.showMe.target,e.showMe.hint),300))}function j({a:e,go:t,open:s,onToggle:n}){return(0,y.jsx)(l.default,{testID:`help-${e.id}`,children:(0,y.jsxs)(i.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:n,children:(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(i.T,{weight:"semibold",children:e.title}),(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(i.Badge,{kind:'guide'===e.kind?'gold':'neutral',label:'guide'===e.kind?'Step by step':'FAQ'}),(0,y.jsx)(i.Muted,{size:12,children:e.topic})]})]}),(0,y.jsx)(i.T,{colour:x.colours.muted,children:s?'\u25be':'\u203a'})]})}),s?(0,y.jsxs)(l.default,{style:{gap:6},children:[(0,y.jsx)(i.Muted,{children:e.body}),e.steps?.map((e,t)=>(0,y.jsxs)(i.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,y.jsx)(l.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(i.T,{size:12,weight:"bold",colour:"#1A1408",children:t+1})}),(0,y.jsx)(i.T,{style:{flex:1},children:e})]},t))]}):null,e.showMe?(0,y.jsx)(i.Row,{wrap:!0,gap:6,children:(0,y.jsx)(i.Button,{small:!0,kind:"success",label:"Show me",testID:`showme-${e.id}`,onPress:()=>w(e,t)})}):null]})})}function b(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 c=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),u=(0,p.demoOnly)(e.action.risk),h=(t,s)=>n({...e.params,[t]:s}),m=e.action,f=e.params,w=m.params.every(e=>!e.required||void 0!==f[e.name]&&''!==f[e.name]);return(0,y.jsxs)(l.default,{testID:"assistant-confirm",style:{borderWidth:2,borderColor:u?x.colours.red:x.colours.ok,borderRadius:14,padding:12,gap:8,backgroundColor:u?'#2a1010':x.colours.okBg},children:[(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(i.Badge,{kind:u?'red':'ok',label:p.RISK_LABEL[m.risk]}),(0,y.jsx)(i.T,{weight:"semibold",style:{flex:1},children:m.title})]}),m.form&&'add_walkin'===m.id?(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Covers",value:void 0===f.covers?'':String(f.covers),onChangeText:e=>h('covers',e.replace(/\D/g,'')?Number(e.replace(/\D/g,'')):void 0),keyboardType:"number-pad"})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Table (optional)",value:void 0===f.table?'':String(f.table),onChangeText:e=>h('table',e.trim()?e.trim().toUpperCase():void 0)})})]}):null,m.form&&'add_rota_shift'===m.id?(0,y.jsxs)(l.default,{style:{gap:6},children:[(0,y.jsx)(i.Muted,{size:12,children:"Who"}),(0,y.jsx)(i.Row,{wrap:!0,gap:6,children:c.slice(0,14).map(e=>(0,y.jsx)(i.Chip,{label:e.name.replace(' (example)','').split(' ')[0],selected:f.staffId===e.id,onPress:()=>h('staffId',e.id)},e.id))}),(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(l.default,{style:{flex:1.3},children:(0,y.jsx)(i.Field,{label:"Date (DD/MM/YYYY)",...(0,s.slashBox)(String(f.date??t),e=>h('date',e)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Start (24h)",value:String(f.start??''),onChangeText:e=>h('start',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"End (24h)",value:String(f.end??''),onChangeText:e=>h('end',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})})]})]}):null,(0,y.jsx)(i.T,{children:w?m.preview(f,{rid:'',today:t,go:()=>{}}):'Fill in the missing details above.'}),u?(0,y.jsx)(i.Muted,{children:"This Assistant does not send, pay or delete. Confirm only shows what would happen."}):(0,y.jsx)(i.Muted,{children:"Nothing happens until you tap Confirm."}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.Button,{kind:u?'danger':'success',label:u?'Confirm (nothing is sent)':'Confirm',testID:"assistant-confirm-yes",disabled:!w,onPress:a,style:{flex:1}}),(0,y.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:o,style:{flex:1}})]})]})}},1526,[812,1031,779,17,385,85,777,876,1477,1527,1528,1529,804,1055,8]); +__d(function(g,_r,_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,n.useState)(''),[r,c]=(0,n.useState)(null),[p,m]=(0,n.useState)(null),w=(0,n.useMemo)(()=>[...u.HELP,...f],[]),j=(0,n.useMemo)(()=>s.trim()?(0,h.searchHelp)(w,s,10).map(e=>e.a):w.filter(e=>!r||e.topic===r),[s,r,w]);return(0,y.jsxs)(l.default,{style:{gap:10},testID:"help-page",children:[(0,y.jsxs)(l.default,{style:[i.styles.input,{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:4}],children:[(0,y.jsx)(i.T,{colour:x.colours.muted,children:"\ud83d\udd0d"}),(0,y.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:x.colours.text,paddingVertical:8,fontSize:16,outlineStyle:'none'}}),s?(0,y.jsx)(a.GoldClose,{testID:"help-search-clear",size:"sm",label:"Clear search",onPress:()=>o('')}):null]}),s?(0,y.jsx)(i.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,y.jsx)(i.Row,{wrap:!0,gap:6,children:[null,...u.HELP_TOPICS].map(e=>(0,y.jsx)(i.Chip,{label:e??'All',selected:r===e,onPress:()=>c(e)},e??'all'))}),j.map((t,a)=>(0,y.jsx)(b,{a:t,go:e,open:p===t.id||!!s&&0===a&&null===p,onToggle:()=>m(p===t.id?'':t.id)},t.id)),(0,y.jsxs)(i.Card,{style:{alignItems:'center'},children:[(0,y.jsx)(i.T,{center:!0,weight:"semibold",colour:x.colours.gold,children:"Chat with CoverCharge support"}),(0,y.jsx)(i.Muted,{center:!0,children:"Send a message to the CoverCharge team. Nobody replies automatically."}),(0,y.jsx)(i.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,m.useCtx)(6e4),a={rid:t,today:s,go:(t,s)=>e(t,s??null)},[o,r]=(0,n.useState)(''),[c,h]=(0,n.useState)(null),[f,b]=(0,n.useState)(null),C=async()=>{const e=o.trim();if(!e)return;b(null),h(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,a);return void b({text:'done'===e.status?e.message:e.message??'',kind:'done'})}h({action:t.action,params:{...j(t.action,s),...t.params},asked:e})}};return(0,y.jsx)(l.default,{testID:"ask-assistant",children:(0,y.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(l.default,{style:{width:28,height:28,borderRadius:14,backgroundColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(i.T,{weight:"bold",colour:"#1A1408",children:"\u2726"})}),(0,y.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Ask the Assistant"})]}),(0,y.jsxs)(l.default,{testID:"help-assistant-stack",style:{gap:8,width:'100%',minWidth:0},children:[(0,y.jsx)(i.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,y.jsx)(i.Button,{label:"Ask",testID:"assistant-ask",disabled:!o.trim(),onPress:C,style:{width:'100%',minWidth:0,minHeight:52}})]}),(0,y.jsx)(i.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,y.jsx)(i.Chip,{label:e,onPress:()=>r(e)},e))}),c?(0,y.jsx)(k,{p:c,today:s,onChange:e=>h({...c,params:e}),onConfirm:async()=>{if(!c)return;const e=await(0,p.runAction)(c.action.id,c.params,a,!0);h(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:()=>{h(null),b({text:'Cancelled. Nothing was changed.',kind:'note'})}}):null,f?(0,y.jsxs)(l.default,{style:{gap:6},testID:"assistant-reply",children:[(0,y.jsx)(i.Banner,{kind:'done'===f.kind?'success':'error'===f.kind?'warn':'demo'===f.kind?'demo':'info',title:f.text}),f.help?.map(t=>{const s=(0,u.helpById)(t);return(0,y.jsxs)(i.Row,{gap:6,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.T,{style:{flex:1},children:s.title}),s.showMe?(0,y.jsx)(i.Button,{small:!0,kind:"success",label:"Show me",onPress:()=>w(s,e)}):null]},t)})]}):null,(0,y.jsx)(i.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]),a=_r(d[2]),n=_r(d[3]),o=e(_r(d[4])),l=e(_r(d[5])),i=_r(d[6]),r=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),p=_r(d[11]),x=_r(d[12]),m=_r(d[13]),y=_r(d[14]);const f=[{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.'}}];function w(e,t){e.showMe&&(t(e.showMe.tab,e.showMe.page??null),setTimeout(()=>c.useCoach.getState().show(e.showMe.target,e.showMe.hint),300))}function b({a:e,go:t,open:s,onToggle:a}){return(0,y.jsx)(l.default,{testID:`help-${e.id}`,children:(0,y.jsxs)(i.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:a,children:(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(i.T,{weight:"semibold",children:e.title}),(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(i.Badge,{kind:'guide'===e.kind?'gold':'neutral',label:'guide'===e.kind?'Step by step':'FAQ'}),(0,y.jsx)(i.Muted,{size:12,children:e.topic})]})]}),(0,y.jsx)(i.T,{colour:x.colours.muted,children:s?'\u25be':'\u203a'})]})}),s?(0,y.jsxs)(l.default,{style:{gap:6},children:[(0,y.jsx)(i.Muted,{children:e.body}),e.steps?.map((e,t)=>(0,y.jsxs)(i.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,y.jsx)(l.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(i.T,{size:12,weight:"bold",colour:"#1A1408",children:t+1})}),(0,y.jsx)(i.T,{style:{flex:1},children:e})]},t))]}):null,e.showMe?(0,y.jsx)(i.Row,{wrap:!0,gap:6,children:(0,y.jsx)(i.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:a,onConfirm:n,onCancel:o}){const c=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),u=(0,p.demoOnly)(e.action.risk),h=(t,s)=>a({...e.params,[t]:s}),m=e.action,f=e.params,w=m.params.every(e=>!e.required||void 0!==f[e.name]&&''!==f[e.name]);return(0,y.jsxs)(l.default,{testID:"assistant-confirm",style:{borderWidth:2,borderColor:u?x.colours.red:x.colours.ok,borderRadius:14,padding:12,gap:8,backgroundColor:u?'#2a1010':x.colours.okBg},children:[(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(i.Badge,{kind:u?'red':'ok',label:p.RISK_LABEL[m.risk]}),(0,y.jsx)(i.T,{weight:"semibold",style:{flex:1},children:m.title})]}),m.form&&'add_walkin'===m.id?(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Covers",value:void 0===f.covers?'':String(f.covers),onChangeText:e=>h('covers',e.replace(/\D/g,'')?Number(e.replace(/\D/g,'')):void 0),keyboardType:"number-pad"})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Table (optional)",value:void 0===f.table?'':String(f.table),onChangeText:e=>h('table',e.trim()?e.trim().toUpperCase():void 0)})})]}):null,m.form&&'add_rota_shift'===m.id?(0,y.jsxs)(l.default,{style:{gap:6},children:[(0,y.jsx)(i.Muted,{size:12,children:"Who"}),(0,y.jsx)(i.Row,{wrap:!0,gap:6,children:c.slice(0,14).map(e=>(0,y.jsx)(i.Chip,{label:e.name.replace(' (example)','').split(' ')[0],selected:f.staffId===e.id,onPress:()=>h('staffId',e.id)},e.id))}),(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(l.default,{style:{flex:1.3},children:(0,y.jsx)(i.Field,{label:"Date (DD/MM/YYYY)",...(0,s.slashBox)(String(f.date??t),e=>h('date',e)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Start (24h)",value:String(f.start??''),onChangeText:e=>h('start',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"End (24h)",value:String(f.end??''),onChangeText:e=>h('end',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})})]})]}):null,(0,y.jsx)(i.T,{children:w?m.preview(f,{rid:'',today:t,go:()=>{}}):'Fill in the missing details above.'}),u?(0,y.jsx)(i.Muted,{children:"This Assistant does not send, pay or delete. Confirm only shows what would happen."}):(0,y.jsx)(i.Muted,{children:"Nothing happens until you tap Confirm."}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.Button,{kind:u?'danger':'success',label:u?'Confirm (nothing is sent)':'Confirm',testID:"assistant-confirm-yes",disabled:!w,onPress:n,style:{flex:1}}),(0,y.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:o,style:{flex:1}})]})]})}},1526,[812,1031,779,17,385,85,777,876,1477,1527,1528,1529,804,1055,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.'},{id:'wipe-device',kind:'faq',topic:'Settings',title:'Sign out and wipe a shared tablet or phone',keywords:['wipe','sign out','shared','tablet','leaver','lost','reset device'],body:'Tap the sync badge (bottom left), or go to Settings \u203a Display, and choose Sign out and wipe this device. It signs out and removes everything CoverCharge keeps on that device: sign-ins, pairing, saved screens and changes not sent yet. The venue\u2019s shared data is not touched. On the Display you type the wake PIN first.'}],o=t=>a.find(a=>a.id===t)},1527,[]); __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}},1528,[]); __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}},1529,[1530,1098,843,1531,1532,876,858,996,1477,1527,1528,1534,1533,1536,1537,994,995]); __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))}}]},1530,[1062,1061,1021]); -__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.`)}}]},1531,[896,1098,820,843,1118,1096,1112,922,858,816,996,895,897,1008,876,1065,867,847,845]); +__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.`)}}]},1531,[896,1098,820,843,1119,1096,1113,922,858,816,996,895,897,1008,876,1065,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.'}}]},1532,[820,858,816,996,876,1001,1012,1013,927,926,1006,839,1032,1033,1034,1002,1065,867,1074,993,854,1533,1531]); __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.'}}]},1533,[820,891,1098,843,1138,1259,858,816,996,1001,910,846,845,1074,1075,993,1002,851,1534,1535]); __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)}))},1534,[824,831,834]); @@ -1643,7 +1643,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.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},1560,[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}`},1561,[1556]); __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)},1562,[]); -__d(function(_g,_r,_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]}},1563,[17,385,85,409,812,777,1070,1030,1177,1119,1089,858,1006,876,1053,839,889,899,804,1415,1055,1454,1564,1553,1562,1565,8]); +__d(function(_g,_r,_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]}},1563,[17,385,85,409,812,777,1070,1030,1177,1120,1089,858,1006,876,1053,839,889,899,804,1415,1055,1454,1564,1553,1562,1565,8]); __d(function(g,_r,_i,_a,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},1564,[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)}.`}},1565,[17,85,780,777,804,1564,1562,8]); __d(function(_g,_r,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}]},1566,[17,264,385,85,780,777,858,876,1567,915,1211,1461,804,1557,1055,1564,1568,1562,1565,1563,8]); diff --git a/owner-app/admin.html b/owner-app/admin.html index 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 7a4189ffaed949dfe9b488a9dee8dd6509f4b5d4..e3b2312d30f49b9856b9e6f137b4db56f3913f3a 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 cfcc085cc2eac90aacd0743a2f2c8a4ff327cb78..97796f33235c3485b6d62020358f915fea3e4ea9 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-cb68d22af7"; +const V = "cc-owner-f6fc0be2d9"; 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=cb68d22af7ca1bce0417ca98c9c8897613f65412b6b34a5c252995f9ec3a1151"]; +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=f6fc0be2d97182e08c1ff2c4f13de629200a2bef9695cc4b9507c5d82fcf8c1c"]; // 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 2a3bef8d7d597580774c2bd3a07b2d4ff409806d..3a7a92f37416362f9528d8c844dce0d285de7940 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 038ea01f5a4f7b34e75e707d5c2dc3b3b2b79f65..56994041acb8370c4f2c9e50af981a7d3470bdc3 100644 --- a/owner-desktop/_expo/static/js/web/bundle.js +++ b/owner-desktop/_expo/static/js/web/bundle.js @@ -1058,7 +1058,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.205'},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.206'},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 c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},979,[980,981,928,972,976]); __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]); @@ -1166,17 +1166,17 @@ __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,"useChatOpen",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)()(t=>({request:n=>t({ch:n})}))},1083,[831]); __d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},1084,[912,17,1010,876,816,913,927,1066,916,1065]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:u}){const h=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const f=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==u||'seated'!==s.status||s.date!==(0,c.venueYmd)(new Date)||!(0,l.hasAllergens)(s)||h.current.has(s.id))continue;const n=f.get(s.id);n&&'seated'!==n&&(h.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} Covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[u]),null},e.useKitchenTodoChime=function(t,c,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=c&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,u.soundAllowed)()&&(0,u.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} Covers \xb7 ${t.date===c?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6])},1085,[843,17,916,858,1053,863,1016]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:s,today:o,by:S,app:j}){const $=(0,n.useBookings)(s).filter(e=>e.date===o&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),w=$.reduce((e,t)=>e+(t.diet?.vegan??0),0),T=$.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,x.jsxs)(a.default,{style:{gap:12},testID:"todays-bookings",children:[(0,x.jsx)(p.CoversToday,{rid:s}),(0,x.jsx)(b.PlattersBooked,{rid:s,date:o,label:"Platters booked today"}),w||T?(0,x.jsxs)(l.T,{colour:h.colours.ok,children:["\u24cb ",w?`${w} vegan`:'',w&&T?' \xb7 ':'',T?`${T} vegetarian`:''," today"]}):null,(0,x.jsx)(b.KitchenSignoffs,{rid:s,today:o,by:S,app:j,showAll:!0}),$.length?$.map(o=>(0,x.jsxs)(a.default,{testID:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?`kitchen-seated-${o.id}`:`kitchen-booking-${o.id}`,style:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?{gap:6,padding:14,borderRadius:16,...(0,c.seatedHighlightStyle)()}:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface,opacity:'finished'===o.status?.55:1},children:[(0,x.jsxs)(l.T,{weight:"semibold",colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,accessibilityLabel:`${o.time}, ${o.walkIn?`Walk-in ${o.ref}`:o.name}, ${o.partySize} Covers${o.table?`, ${(0,e.tableNumbersA11y)(o.table)}`:''}`,children:[o.time," \xb7 ",o.walkIn?`Walk-in ${o.ref}`:o.name," \xb7 ",o.partySize," Covers",o.table?` \xb7 ${(0,e.tableNumbers)(o.table)}`:'']}),(0,x.jsx)(t.DepositChip,{b:o,money:!0,testID:`kitchen-deposit-${o.id}`}),(0,x.jsx)(k.BookingTableButton,{rid:s,booking:o,readOnly:'chef'===j}),'chef'!==j&&o.walkIn?(0,x.jsx)(y.CancelWalkInButton,{rid:s,b:o,small:!0}):null,o.notes?(0,x.jsxs)(l.T,{size:16,colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,testID:`kitchen-notes-${o.id}`,children:["Notes: ",o.notes]}):null,(0,x.jsx)(f.BookingEditButton,{rid:s,booking:o,who:S,inStaffApp:'staff'===j}),(0,x.jsx)(b.BookingNeeds,{b:o}),'seated'===(0,u.shownStatus)(o)?(0,x.jsx)(l.T,{weight:"semibold",colour:c.SEATED_FG,children:"Seated"}):'finished'===o.status?(0,x.jsx)(l.Muted,{children:"Finished"}):null]},o.id)):(0,x.jsx)(l.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var s,o=r(d[3]),a=(s=o)&&s.__esModule?s:{default:s},l=r(d[4]),n=r(d[5]),u=r(d[6]),h=r(d[7]),c=r(d[8]),b=r(d[9]),k=r(d[10]),y=r(d[11]),f=r(d[12]),p=r(d[13]),x=r(d[14])},1086,[843,1087,17,85,777,858,1053,804,1088,1076,1089,1114,1119,1070,8]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:s,today:o,by:S,app:j}){const $=(0,n.useBookings)(s).filter(e=>e.date===o&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),w=$.reduce((e,t)=>e+(t.diet?.vegan??0),0),T=$.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,x.jsxs)(a.default,{style:{gap:12},testID:"todays-bookings",children:[(0,x.jsx)(p.CoversToday,{rid:s}),(0,x.jsx)(b.PlattersBooked,{rid:s,date:o,label:"Platters booked today"}),w||T?(0,x.jsxs)(l.T,{colour:h.colours.ok,children:["\u24cb ",w?`${w} vegan`:'',w&&T?' \xb7 ':'',T?`${T} vegetarian`:''," today"]}):null,(0,x.jsx)(b.KitchenSignoffs,{rid:s,today:o,by:S,app:j,showAll:!0}),$.length?$.map(o=>(0,x.jsxs)(a.default,{testID:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?`kitchen-seated-${o.id}`:`kitchen-booking-${o.id}`,style:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?{gap:6,padding:14,borderRadius:16,...(0,c.seatedHighlightStyle)()}:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface,opacity:'finished'===o.status?.55:1},children:[(0,x.jsxs)(l.T,{weight:"semibold",colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,accessibilityLabel:`${o.time}, ${o.walkIn?`Walk-in ${o.ref}`:o.name}, ${o.partySize} Covers${o.table?`, ${(0,e.tableNumbersA11y)(o.table)}`:''}`,children:[o.time," \xb7 ",o.walkIn?`Walk-in ${o.ref}`:o.name," \xb7 ",o.partySize," Covers",o.table?` \xb7 ${(0,e.tableNumbers)(o.table)}`:'']}),(0,x.jsx)(t.DepositChip,{b:o,money:!0,testID:`kitchen-deposit-${o.id}`}),(0,x.jsx)(k.BookingTableButton,{rid:s,booking:o,readOnly:'chef'===j}),'chef'!==j&&o.walkIn?(0,x.jsx)(y.CancelWalkInButton,{rid:s,b:o,small:!0}):null,o.notes?(0,x.jsxs)(l.T,{size:16,colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,testID:`kitchen-notes-${o.id}`,children:["Notes: ",o.notes]}):null,(0,x.jsx)(f.BookingEditButton,{rid:s,booking:o,who:S,inStaffApp:'staff'===j}),(0,x.jsx)(b.BookingNeeds,{b:o}),'seated'===(0,u.shownStatus)(o)?(0,x.jsx)(l.T,{weight:"semibold",colour:c.SEATED_FG,children:"Seated"}):'finished'===o.status?(0,x.jsx)(l.Muted,{children:"Finished"}):null]},o.id)):(0,x.jsx)(l.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var s,o=r(d[3]),a=(s=o)&&s.__esModule?s:{default:s},l=r(d[4]),n=r(d[5]),u=r(d[6]),h=r(d[7]),c=r(d[8]),b=r(d[9]),k=r(d[10]),y=r(d[11]),f=r(d[12]),p=r(d[13]),x=r(d[14])},1086,[843,1087,17,85,777,858,1053,804,1088,1076,1089,1115,1120,1070,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DepositChip=function({b:e,money:o,big:n,testID:b}){const f=(0,s.depositView)(e,o);if(!f)return null;const h={gold:[t.colours.goldTint,t.colours.goldLight,t.colours.gold],amber:[t.colours.amberBg,'#FFE2A8',t.colours.amber],red:[t.colours.redBg,'#FFD9D4',t.colours.red],neutral:[t.colours.surface2,t.colours.muted,t.colours.border]}[f.kind];return(0,u.jsxs)(l.default,{accessible:!0,accessibilityRole:"text",accessibilityLabel:f.a11y,testID:b??'deposit-chip',style:{alignSelf:'flex-start',maxWidth:'100%'},children:[(0,u.jsx)(l.default,{style:{backgroundColor:h[0],borderColor:h[2],borderWidth:n?2:1,borderRadius:8,paddingHorizontal:n?12:8,paddingVertical:n?6:3},children:(0,u.jsx)(c.T,{size:16,weight:"semibold",colour:h[1],children:f.label})}),f.note?(0,u.jsx)(c.Muted,{size:12,children:f.note}):null]})},r(d[0]);var e,o=r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),c=r(d[4]),u=r(d[5])},1087,[17,85,841,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEATED_BG",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SEATED_FG",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEATED_MUTED",{enumerable:!0,get:function(){return u}}),e.isSeatedHighlight=function(t,o){return'seated'===t&&!o?.otherDay},e.seatedHighlightStyle=function(u){return{backgroundColor:o,borderColor:t.colours.goldLight,borderWidth:1.5,borderLeftWidth:8,borderLeftColor:n,...u}};var t=r(d[0]);const o=t.colours.gold,n=t.colours.onGold,u='#3F3218'},1088,[804]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f,canClear:h=!0}){const[j,k]=(0,t.useState)(!1),x=(0,s.tableButtonLabel)(l.table),_=f??`table-btn-${l.id}`;if(y)return(0,b.jsx)(n.default,{testID:_,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,b.jsx)(u.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:x})});return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u.Button,{kind:"secondary",label:x,testID:_,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>k(!0),style:{minHeight:44}}),j?(0,b.jsx)(c.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>k(!1),canClear:h}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6])},1089,[17,85,1090,804,1091,777,8]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const u={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(u)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(u,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}}),e.splitChoices=function(t){const n=String(t??'').split('+').map(t=>t.trim()).filter(Boolean);return n.length>1?[...new Set(n)]:[]};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1090,[843,1074]); -__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,t,s){const l=(0,p.tableKey)(s);if('finished'===t.status&&l)return void await(0,j.restoreFinishedToTable)(e,t,s);const o=(0,g.tablesOf)(t.table);await h.repo.bookings.update(t.id,(0,y.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(t=>g.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,m.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:m=90,onClose:T,onSaved:S,onPickOnPlan:L,canClear:P=!0}){const W=(0,g.usePlan)(e),z=(0,h.useBookings)(e),[D,I]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),R=(0,l.useMemo)(()=>(0,p.pickGroups)(W),[W]),B=z.filter(e=>e.date===y.date),O=(0,p.seatsOf)(W,D),N=(0,p.seatLine)(O.total,y.partySize),F=(0,p.pickClashes)(y,D,B,m),M=e=>(0,p.pickClashes)(y,[e],B,m)[0]?.with,Y=(0,p.tableKey)(D)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,C.useBlocks)(e=>e.blocks),A=(0,C.blockAt)(_,e,y.date,y.time),[G,K]=(0,l.useState)(null),E=e=>{K(null),I(t=>(0,p.toggleTable)(t,e))},[H]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{H&&(0,c.announce)(`Tables can't be saved: ${H}.`)},[H]);const[U,V]=(0,l.useState)(!1),[q,J]=(0,l.useState)(!1),Q=async t=>{(0,o.guardBookingChange)(S,{b:y,tables:t})?(V(!0),T(),await(0,o.saveTablesReported)(e,y,t,f,(0,p.seatsOf)(W,t).total,e=>S?.(e))):T()},X=(0,w.jsxs)(u.default,{style:{gap:8},children:[(0,w.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(D)} picked. ${N.text}.`,children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(D)}),(0,w.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:N.text})]}),A?(0,w.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,w.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,F.length?(0,w.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(F)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,w.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(F)," You can still save."]})}):null,q?(0,w.jsx)(j.RestoreSeatedConfirm,{prompt:(0,v.restoreSeatedPrompt)(f,(0,p.tableKey)(D)),onYes:()=>{J(!1),Q(D)},onNo:()=>J(!1)}):null,G?(0,w.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:G,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,w.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:G}),(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(D)} for ${f}, ${y.partySize} people`,disabled:U,onPress:()=>{Q(D)},style:[$,{flexGrow:1}]}),(0,w.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>K(null),style:$})]})]}):null,(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[G?null:(0,w.jsx)(x.Button,{testID:"table-pick-save",label:U?'Saving\u2026':F.length?'Save anyway':'Save tables',disabled:!Y||!D.length||U,accessibilityLabel:`${F.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(D)} for ${f}. ${N.text}.${F.length?` ${(0,p.clashWords)(F)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(S,{b:y,tables:D}))return void T();const e=(0,p.overCapacityAsk)(D,O.total,y.partySize);!e||G?'finished'!==y.status||!D.length||q?Q(D):J(!0):K(e)},style:[$,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&P?(0,w.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:U,onPress:()=>Q([]),style:$}):null,(0,w.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:T,style:$})]})]});return(0,w.jsxs)(x.Sheet,{visible:!0,onClose:T,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:X,children:[(0,w.jsx)(t.TableNumberWarning,{plan:W}),H?(0,w.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${H}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,w.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${H}.`})}):null,(0,w.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),L?(0,w.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>L(D),style:$}):null,R.map(e=>(0,w.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,w.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,w.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=D.includes(e.name),l=M(e.name);return(0,w.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,t,l),onPress:()=>E(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",colour:t?k.colours.onGold:k.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,w.jsxs)(x.T,{size:14,colour:t?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),R.length?null:(0,w.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),m=r(d[15]),j=r(d[16]),v=r(d[17]),C=r(d[18]),w=r(d[19]);const $={minHeight:56}},1091,[1092,843,17,1093,899,1095,385,85,858,996,1090,1094,804,863,777,1096,1112,1111,993,8]); +__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,t,s){const l=(0,p.tableKey)(s);if('finished'===t.status&&l)return void await(0,j.restoreFinishedToTable)(e,t,s);const o=(0,g.tablesOf)(t.table);await h.repo.bookings.update(t.id,(0,y.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(t=>g.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,m.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:m=90,onClose:T,onSaved:S,onPickOnPlan:L,canClear:P=!0}){const W=(0,g.usePlan)(e),z=(0,h.useBookings)(e),[D,I]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),R=(0,l.useMemo)(()=>(0,p.pickGroups)(W),[W]),B=z.filter(e=>e.date===y.date),O=(0,p.seatsOf)(W,D),N=(0,p.seatLine)(O.total,y.partySize),F=(0,p.pickClashes)(y,D,B,m),M=e=>(0,p.pickClashes)(y,[e],B,m)[0]?.with,Y=(0,p.tableKey)(D)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,C.useBlocks)(e=>e.blocks),A=(0,C.blockAt)(_,e,y.date,y.time),[G,K]=(0,l.useState)(null),E=e=>{K(null),I(t=>(0,p.toggleTable)(t,e))},[H]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{H&&(0,c.announce)(`Tables can't be saved: ${H}.`)},[H]);const[U,V]=(0,l.useState)(!1),[q,J]=(0,l.useState)(!1),Q=async t=>{(0,o.guardBookingChange)(S,{b:y,tables:t})?(V(!0),T(),await(0,o.saveTablesReported)(e,y,t,f,(0,p.seatsOf)(W,t).total,e=>S?.(e))):T()},X=(0,w.jsxs)(u.default,{style:{gap:8},children:[(0,w.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(D)} picked. ${N.text}.`,children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(D)}),(0,w.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:N.text})]}),A?(0,w.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,w.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,F.length?(0,w.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(F)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,w.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(F)," You can still save."]})}):null,q?(0,w.jsx)(j.RestoreSeatedConfirm,{prompt:(0,v.restoreSeatedPrompt)(f,(0,p.tableKey)(D)),onYes:()=>{J(!1),Q(D)},onNo:()=>J(!1)}):null,G?(0,w.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:G,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,w.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:G}),(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(D)} for ${f}, ${y.partySize} people`,disabled:U,onPress:()=>{Q(D)},style:[$,{flexGrow:1}]}),(0,w.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>K(null),style:$})]})]}):null,(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[G?null:(0,w.jsx)(x.Button,{testID:"table-pick-save",label:U?'Saving\u2026':F.length?'Save anyway':'Save tables',disabled:!Y||!D.length||U,accessibilityLabel:`${F.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(D)} for ${f}. ${N.text}.${F.length?` ${(0,p.clashWords)(F)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(S,{b:y,tables:D}))return void T();const e=(0,p.overCapacityAsk)(D,O.total,y.partySize);!e||G?'finished'!==y.status||!D.length||q?Q(D):J(!0):K(e)},style:[$,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&P?(0,w.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:U,onPress:()=>Q([]),style:$}):null,(0,w.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:T,style:$})]})]});return(0,w.jsxs)(x.Sheet,{visible:!0,onClose:T,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:X,children:[(0,w.jsx)(t.TableNumberWarning,{plan:W}),H?(0,w.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${H}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,w.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${H}.`})}):null,(0,w.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),L?(0,w.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>L(D),style:$}):null,R.map(e=>(0,w.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,w.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,w.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=D.includes(e.name),l=M(e.name);return(0,w.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,t,l),onPress:()=>E(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",colour:t?k.colours.onGold:k.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,w.jsxs)(x.T,{size:14,colour:t?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),R.length?null:(0,w.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),m=r(d[15]),j=r(d[16]),v=r(d[17]),C=r(d[18]),w=r(d[19]);const $={minHeight:56}},1091,[1092,843,17,1093,899,1095,385,85,858,996,1090,1094,804,863,777,1096,1113,1111,993,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},1092,[17,842,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.guardBookingChange=w,_e.saveTablesReported=async function(e,t,n,o,s,u){if(!w(u,{b:t,tables:n}))return!1;const v=n.length?(0,h.notSavedWhat)({...t,name:o,table:n.join('+')}):`Taking the table off ${o}`;u(`Saving ${v}\u2026`);try{await(0,b.saveBookingTables)(e,t,n)}catch(e){const t=`${v} did not save: ${String(e?.message??e).slice(0,120)}`;return u(t),(0,l.announce)(t),!1}const y=await(0,c.waitForBookingSave)(t.id);if('saved'===y.state||'local'===y.state){const e=(0,r.savedWords)(o,t.partySize,n,s);return u(e),(0,l.announce)(e),!0}const k='waiting'===y.state?`${v}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${v} did not save. ${f("why"in y?y.why:"the shared system did not take it")}. Tap the red banner to try again.`;return u(k),(0,l.announce)(k),!1},_e.reportBookingSave=async function(e,t,n,o){const s=await(0,c.waitForBookingSave)(e);if('saved'===s.state||'local'===s.state)return o(t),(0,l.announce)(t),!0;const r='waiting'===s.state?`${n}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${n} did not save. ${f('why'in s?s.why:'the shared system did not take it')}. Tap the red banner to try again.`;return o(r),(0,l.announce)(r),!1},_e.BookingSaveBanner=function({rid:e,testID:r="booking-save-banner",margin:c}){const b=(0,h.useBookingSaves)(e=>e.notSaved),w=(0,s.useBookings)(e).filter(e=>b[e.id]).map(e=>void 0!==b[e.id].want?{...e,table:b[e.id].want||void 0}:e),{msg:S,retry:$}=k(),m=(0,t.useRef)(''),p=w.map(e=>(0,h.notSavedLine)(e)),B=w.map(e=>e.id).sort().join(',');if((0,t.useEffect)(()=>{B&&B!==m.current&&(0,l.announce)(1===w.length?p[0]:`${w.length} booking changes did not save. Tap the red banner to try again.`),m.current=B},[B]),!w.length)return null;const j=1===w.length?p[0]:`${w.length} booking changes did not save. Tap to try again.`;return(0,y.jsx)(n.default,{testID:r,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${j}${w.length>1?` ${w.map(e=>(0,h.notSavedWhat)(e)).join('. ')}.`:''} ${f(b[w[0].id].why)}.`,onPress:$,style:{...c??{},alignSelf:'stretch',gap:4,padding:12,borderRadius:12,borderWidth:2,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:(0,y.jsxs)(o.default,{accessibilityRole:"alert",style:{alignItems:'center',gap:4},children:[(0,y.jsx)(v.T,{testID:`${r}-title`,size:17,weight:"semibold",center:!0,colour:"#FFD2CC",children:j}),w.length>1?w.slice(0,6).map(e=>(0,y.jsx)(v.T,{testID:`${r}-line`,size:15,center:!0,colour:"#FFD2CC",children:(0,h.notSavedWhat)(e)},e.id)):null,(0,y.jsx)(v.T,{testID:`${r}-why`,size:14,center:!0,colour:"#FFB3AA",children:w.length>1?`${f(b[w[0].id].why)}${w.length>6?` \xb7 and ${w.length-6} more`:''}`:f(b[w[0].id].why)}),S?(0,y.jsx)(v.T,{testID:`${r}-msg`,size:14,center:!0,colour:u.colours.goldLight,children:S}):null]})})},_e.BookingNotSavedLine=function({b:e}){const t=(0,h.useBookingSaves)(t=>t.notSaved[e.id]),{msg:o,retry:s}=k();if(!t)return null;void 0!==t.want&&(e={...e,table:t.want||void 0});return(0,y.jsxs)(n.default,{testID:`booking-not-saved-${e.id}`,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${(0,h.notSavedLine)(e)} ${f(t.why)}.`,onPress:s,style:{alignSelf:'stretch',padding:8,borderRadius:10,borderWidth:1.5,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:[(0,y.jsx)(v.T,{size:15,weight:"semibold",center:!0,colour:"#FFD2CC",children:(0,h.notSavedLine)(e)}),o?(0,y.jsx)(v.T,{size:13,center:!0,colour:u.colours.goldLight,children:o}):null]})};var t=_r(d[0]),n=e(_r(d[1])),o=e(_r(d[2])),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),b=_r(d[9]),v=_r(d[10]),y=_r(d[11]);const f=e=>e.charAt(0).toUpperCase()+e.slice(1);function w(e,t){const n=(0,c.bookingSaveBlocker)();if(!n)return!0;t&&h.useBookingSaves.getState().mark({id:t.b.id,table:t.b.walkIn?'walk_ins':'bookings',why:n,...t.tables?{want:t.tables.join('+')}:{}});const o=`${t?(0,h.notSavedWhat)({...t.b,...t.tables?{table:t.tables.join('+')||void 0}:{}}):'This change'} did not save: ${n}.`;return e?.(o),(0,l.announce)(o),!1}function k(){const[e,n]=(0,t.useState)('');return{msg:e,retry:async()=>{n('Saving\u2026'),(0,l.announce)('Saving');const e=await(0,c.saveBookingsNow)(!0),t=e?`Not saved: ${e}.`:h.useBookingSaves.getState().count()?'Sent again. The banner clears when the shared system takes it.':'Nothing is left waiting. Check the plan and make the change again if it is not there.';n(t),(0,l.announce)(t)}}}},1093,[17,385,85,858,1094,1095,899,983,804,1091,777,8]); __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=u,e.requestedFreeTable=function(t,n,a,s,l=90){const o={id:n.id??'new',status:'confirmed',...n};for(const n of t)if(a.includes(n)&&!u(o,[n],s,l).length)return n;return null},e.overCapacityAsk=function(n,s,l){const u=a(o(n));if(!u.length||s>=l)return null;const c=u.map(n=>(0,t.tableNumbers)(n));return`${1===c.length?`Table ${c[0]} seats`:`Tables ${c.slice(0,-1).join(', ')} and ${c[c.length-1]} seat`} ${s} \u2013 this booking is ${l}. Use it anyway?`},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=c,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${c(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${c(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${c(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))}function c(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1094,[843,1074]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.primeAnnouncer=function(){u()},_e.announce=function(t){const e=String(t??'').trim();if(!e)return;{const t=u();if(!t)return;const n=++o;return t.textContent='',void setTimeout(()=>{n===o&&(t.textContent=e)},80)}},Object.defineProperty(_e,"lastAnnounced",{enumerable:!0,get:function(){return c}});var t,e=r(d[0]);(t=e)&&t.__esModule;r(d[1]);let n=null,o=0;function u(){if('undefined'==typeof document||!document.body)return null;if(n&&document.body.contains(n))return n;const t=document.createElement('div');return t.id='cc-announcer',t.setAttribute('aria-live','assertive'),t.setAttribute('aria-atomic','true'),t.setAttribute('role','status'),t.setAttribute('data-testid','cc-announcer'),Object.assign(t.style,{position:'absolute',width:'1px',height:'1px',margin:'-1px',padding:'0',overflow:'hidden',clip:'rect(0 0 0 0)',whiteSpace:'nowrap',border:'0'}),document.body.appendChild(t),n=t,t}const c=()=>n?.textContent??''},1095,[264,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,"TABLES",{enumerable:!0,get:function(){return A}}),_e.useTableNames=R,_e.resetTableLive=W,_e.seatBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'seated'),W(e,t.table)},_e.finishBookingNow=async function(e,t){const s=(new Date).toISOString();await k.repo.bookings.update(t.id,(0,N.finishClearPatch)(s,t.table)),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=E,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return _}}),_e.TablePicker=H,_e.WalkInSheet=q,_e.AssignTableSheet=G,_e.undoNotice=Y,_e.NewBookingSheet=V,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[n,i]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>i({b:e}),combineTables:e=>i({b:e,combine:!0}),elements:(0,L.jsxs)(L.Fragment,{children:[s?(0,L.jsx)(q,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,L.jsx)(V,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,L.jsx)(G,{booking:n.b,combine:n.combine,onClose:()=>i(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),z=_r(_d[29]),B=_r(_d[30]),M=_r(_d[31]),N=_r(_d[32]),L=_r(_d[33]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),A=Array.from({length:12},(e,t)=>String(t+1));function R(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function W(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function E(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=R(e),a=(0,v.useFloor)(t=>t.live[e])??{},n=(0,v.usePlan)(e),i=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(i,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const _=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function H({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=n?6:8,f=n?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(i??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,L.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],i=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!i,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,L.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:i?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,L.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,L.jsx)(C.T,{weight:"bold",size:22,colour:i?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,L.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,L.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,L.jsx)(C.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const U=[1,2,3,4,5,6,7,8];function q({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:r,r:d,now:u}=(0,y.useCtx)(15e3),x=E(r,u),[T,I]=(0,c.useState)(2),[P,$]=(0,c.useState)(!1),[O,z]=(0,c.useState)(i??null),B=(0,v.usePlan)(r),N=(0,k.useBookings)(r),A=(0,D.useBlocks)(e=>e.blocks),R=(0,D.closedAreasAt)(A,r,(0,w.ymd)(u),(0,w.hm)(u)),_=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(x).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(B,N.filter(e=>e.date===(0,w.ymd)(u)),e,T,u,(0,j.turnFor)(T,d.settings.turnMins),90,void 0,{closed:R})?.table??null},[B,N,x,T,R.size,u.getTime()]);(0,c.useEffect)(()=>{O&&(0,v.tablesOf)(O).some(e=>'Closed'===x[e]?.label)&&z(null)},[O,R.size]);const[q,G]=(0,c.useState)(!1),[Y,V]=(0,c.useState)(''),K=(e,t=String(e),s=()=>{$(!1),I(e)})=>{const o='9+'===t?P:!P&&T===e;return(0,L.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,L.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},Q=(0,L.jsx)(s.PartySizeInput,{value:T,onChange:I,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),X=(0,L.jsxs)(m.default,{style:{gap:8,width:n?256:void 0},children:[(0,L.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,L.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[U.map(e=>K(e)),K(9,'9+',()=>{$(!0),I(e=>e>=9?e:9)})]}),P?Q:null]}),[J,Z]=(0,c.useState)(!1),ee=async(t=O)=>{if(!J&&(0,M.guardBookingChange)(F)){Z(!0);try{const s=await k.repo.bookings.seatWalkIn(r,T,t??void 0,Y);W(r,t??void 0),a(s),e()}finally{Z(!1)}}},te=(0,L.jsxs)(m.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,L.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,L.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),O?(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>z(null)}):null]}),(0,L.jsx)(H,{use:x,value:O,onPick:e=>{x[e]&&!x[e].busy?ee(e):z(O===e?null:e)},big:n,dense:n,best:_,bestSet:(0,h.bestTables)(B)}),(0,L.jsxs)(C.Muted,{children:["Tap a free table to seat them there",_&&!O?` (suggested for ${T}: ${(0,l.tableNumbers)(_)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(u)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,L.jsx)(C.Button,{label:`Seat walk-in \xb7 ${T} ${1===T?'person':'people'}${O?` \xb7 ${(0,l.tableNumbers)(O)}`:''}`,disabled:J,onPress:()=>{ee()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,L.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[X,te]}):(0,L.jsxs)(L.Fragment,{children:[X,te]}),(0,L.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[q?(0,L.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:Y,onChangeText:V,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,L.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,L.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function G({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,y.useCtx)(15e3),i=E(o,n),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(n)),t,e.partySize,n,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,n.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),P=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,$=D.reduce((e,t)=>e+P(t),0),O=D.length>0&&${if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&W(o,l),t()},B=x?(0,L.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,L.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,L.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${$} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,L.jsx)(m.default,{testID:"combine-short",children:(0,L.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-$," more needed. Add another table."]})}):null,(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,L.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,L.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,L.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,L.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${_(e)}`,testID:"assign-table-sheet",footer:B,children:[f&&!x?(0,L.jsx)(m.default,{testID:"assign-suggested",children:(0,L.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,L.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,L.jsx)(H,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function Y(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${_(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function V({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:N}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const A=(0,w.ymd)(p),[R,W]=(0,c.useState)(ee.blocks),[H,U]=(0,c.useState)(!1),[q,G]=(0,c.useState)(''),[Y,V]=(0,c.useState)(2),[K,Q]=(0,c.useState)(0),X=Math.min(K,Math.max(0,Y-1)),[J,Z]=(0,c.useState)(null),[ee,te]=(0,c.useState)(''),[se,oe]=(0,c.useState)(''),[le,ae]=(0,c.useState)(''),[ne,ie]=(0,c.useState)(!1),[re,de]=(0,c.useState)('phone'),[ue,ce]=(0,c.useState)((0,P.emptyNeeds)()),be=(0,P.needsMissing)(ue),[ge,he]=(0,c.useState)(null),pe=(0,v.usePlan)(b),me=(0,O.dogSetUp)(pe),fe=!0===ue.dog&&me,ye=ue.dog?ue.dogs:0,ke=(0,w.parseYmd)(R),xe=(0,j.turnFor)(Y,h.settings.turnMins),je=E.filter(e=>e.date===R),we=e=>(0,j.dogTablesAt)(pe,je,Y,(0,j.slotStart)(R,e),xe,h.settings.turnMins,(0,D.closedAreasAt)(_,b,R,e)),Se=fe&&J?we(J):[];(0,c.useEffect)(()=>{he(null)},[fe,J,Y]);const Te=(0,x.bookingSlots)(h,ke,e=>E.filter(t=>t.date===R&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Y,R===(0,w.ymd)(p)?p:(0,w.addMins)(ke,0),e=>E.filter(t=>t.date===R&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),Ce=(0,T.guestPhone)(se),[ve,De]=(0,c.useState)(!1),Ie=J?Te.find(e=>e.time===J):void 0,Pe=Ie&&Ie.left=2&&!!J&&(!Oe||ve)&&(0,o.validParty)(Y)&&Ce.ok&&(0,T.emailOk)(le)&&(!ze||Be&&H)&&(!fe||Se.length>0)&&!Me,Le=ue.wheelchair>0||ue.stepFree,Fe=(0,$.bookingRulesOf)(h),Ae=(0,$.largeGroupTables)(Fe,Y),Re=(0,$.dogPartyCheck)(Fe,Y,!0===ue.dog,ue.assistDog),We=(0,$.bookingDepositSplit)((0,n.depositOf)(h.settings),Y,X,(0,P.needsPatch)(ue),(0,O.reservablesOf)(h));return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(ke)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,L.jsx)(P.FirstQuestions,{rid:b,value:ue,onChange:ce,party:Y,audience:"staff"}),ue.dog&&!me?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,L.jsx)(I.BookingDatePicker,{r:h,today:p,value:R,onChange:e=>{e!==R&&(W(e),Z(null),U(!1))}}),(0,L.jsxs)(C.Row,{gap:6,children:[(0,L.jsx)(C.Chip,{label:"Phone",selected:'phone'===re,onPress:()=>de('phone')}),(0,L.jsx)(C.Chip,{label:"In person",selected:'in-person'===re,onPress:()=>de('in-person')})]}),(0,L.jsx)(C.Field,{label:"Name",value:q,onChangeText:G,placeholder:"e.g. Reid",testID:"nb-name"}),(0,L.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:se,onChangeText:oe,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!Ce.ok&&se?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:Ce.error}):null,(0,L.jsx)(C.Field,{label:"Email (optional)",value:le,onChangeText:ae,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email",testID:"nb-email"}),(0,T.emailOk)(le)?null:(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),le.trim()&&Fe.marketingOptIn?(0,L.jsx)(C.Toggle,{label:Fe.marketingWords,value:ne,onChange:ie,testID:"nb-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,L.jsx)(i.AdultsChildren,{value:(0,r.peopleOf)(Y,X),onChange:e=>{V(e.partySize),Q(e.children),De(!1)},depositsOn:(0,n.depositOf)(h.settings).on&&(0,n.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:Te.map(e=>{const t=fe&&e.available&&!we(e.time).length||!(0,P.dogTimeOk)(h,E,R,e.time,ye);return(0,L.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(_,b,R,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:J===e.time,onPress:()=>{Z(e.time),U(!1),De(!1)}},e.time)})}),Oe?(0,L.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[Pe?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Y,Pe.left,Pe.time)}):null,$e?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)($e.time,$e.cap)}):null,(0,L.jsx)(C.Chip,{label:ve?'Booking over the limit: on':'Book anyway (over the limit)',selected:ve,onPress:()=>De(e=>!e),testID:"nb-over-ok"})]}):null,fe&&J?(0,L.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,L.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,L.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",pe.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),Se.length?pe.areas.filter(e=>Se.some(t=>t.area===e.name)).map(e=>(0,L.jsxs)(m.default,{style:{gap:6},accessibilityLabel:e.name,children:[(0,L.jsxs)(C.T,{size:13,center:!0,colour:S.colours.muted,children:[e.name,e.outdoor?' (outdoor)':'']}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:Se.filter(t=>t.area===e.name).map(e=>{const t=Se[0]?.table===e.table;return(0,L.jsx)(C.Chip,{testID:`nb-dog-table-${(0,l.tableNumbers)(e.table)}`,label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.seats} seats${t?' \xb7 best':''}${Le&&(0,O.accessibleSetUp)(pe)&&!(0,O.isAccessible)(pe,e.table)?' \xb7 not step-free':''}`,selected:(ge??Se[0].table)===e.table,onPress:()=>he(e.table)},e.table)})})]},e.id)):(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Y," at ",J,". Try another time."]})]}):null,ze?(0,L.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,L.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",ze.from,"\u2013",ze.to,ze.reason?` (${ze.reason})`:'']}),Be?(0,L.jsx)(C.Chip,{label:H?'Manager override on':'Override and book anyway',selected:H,onPress:()=>U(e=>!e)}):(0,L.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,Te.length?null:(0,L.jsx)(m.default,{testID:"nb-closed",children:(0,L.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(ke)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,L.jsx)(P.MoreQuestions,{rid:b,r:h,value:ue,onChange:ce,party:Y,date:R,time:J,today:(0,w.ymd)(p),bookings:E,audience:"staff",showTables:!1!==h.settings.tableRequests}),Le&&!(0,O.accessibleSetUp)(pe)?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,Ae&&!fe?(0,L.jsxs)(C.T,{size:14,colour:S.colours.goldLight,testID:"nb-large-group",children:["Large group: tables ",Ae.join(' + ')," joined."]}):null,Re.ok?null:(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,testID:"nb-dog-cap",children:["Online, a dog booking is for up to ",Fe.dogMaxParty," people. You can still book it here: check where they can sit."]}),(0,L.jsx)(C.Field,{label:"Notes (optional)",value:ee,onChangeText:te,placeholder:Fe.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"nb-notes"}),We.preorders?(0,L.jsxs)(C.Muted,{testID:"nb-preorder-deposit",children:["Pre-order deposit: ",(0,a.gbp)(We.preorders),We.adults?`, plus the group deposit: ${(0,a.gbp)(We.total)} in total`:'',". Staff can waive it."]}):null,(0,n.depositDue)((0,n.depositOf)(h.settings),Y,X)?(0,L.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(h.settings),Y,X))," (",(0,a.gbp)((0,n.depositOf)(h.settings).perPersonPence)," per adult for tables of ",(0,n.depositOf)(h.settings).fromParty,"+ adults",X?`; ${X} ${1===X?'child':'children'} free`:'; children free, and they do not count towards the number that needs a deposit',"). Staff can waive it. Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,L.jsx)(C.Muted,{children:"CoverCharge confirms the guest by email automatically (preview mode: shown in the Outbox, not sent)."}),Me?(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",J,". Try another time: dogs are very welcome then."]}):null,(0,L.jsx)(C.Button,{label:be.length?be[0]:'Save booking',testID:"nb-save",disabled:!Ne,onPress:()=>{if(R<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,P.needsPatch)(ue),s=ue.tableReq.find(e=>!fe||Se.some(t=>t.table===e)),o=fe?null:(0,B.requestedFreeTable)(ue.tableReq,{date:R,time:J,partySize:Y},pe.tables.map(e=>e.name),je,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:q.trim(),partySize:Y,date:R,time:J,notes:ee.trim(),security:We.total?'deposit':'none',depositPaid:0,...X?{children:X}:{},...We.total?{...(0,$.depositFields)(We),depositPolicy:(0,n.depositWords)((0,n.depositOf)(h.settings),Y,h.name,X).join(' '),depositRefundable:(0,n.depositOf)(h.settings).refundable,depositCutoffHours:(0,n.depositOf)(h.settings).cutoffHours}:{},phone:Ce.pretty,email:le.trim()||void 0,...ne?(0,$.marketingChoice)(le,!0):{},source:re,...e,...Te.find(e=>e.time===J)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...fe?{table:ge??s??Se[0]?.table}:o?{table:o}:{}}).then(e=>(0,z.postNewBookingToKitchen)(e,N)).catch(()=>{}),u?.({date:R,time:J,name:q.trim()}),t()}})]})}},1096,[812,1097,1098,843,851,841,1099,1100,1101,1102,17,842,385,85,856,1055,858,1103,1074,863,804,848,777,996,993,1104,1105,1077,1053,1076,1094,1093,1111,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return R}}),_e.useTableNames=W,_e.resetTableLive=E,_e.seatBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'seated'),E(e,t.table)},_e.finishBookingNow=async function(e,t){const s=(new Date).toISOString();await k.repo.bookings.update(t.id,(0,N.finishClearPatch)(s,t.table)),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=_,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return H}}),_e.TablePicker=U,_e.WalkInSheet=G,_e.AssignTableSheet=V,_e.undoNotice=Y,_e.NewBookingSheet=K,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[n,i]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>i({b:e}),combineTables:e=>i({b:e,combine:!0}),elements:(0,A.jsxs)(A.Fragment,{children:[s?(0,A.jsx)(G,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,A.jsx)(K,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,A.jsx)(V,{booking:n.b,combine:n.combine,onClose:()=>i(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),z=_r(_d[29]),B=_r(_d[30]),M=_r(_d[31]),N=_r(_d[32]),L=_r(_d[33]),A=_r(_d[34]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),R=Array.from({length:12},(e,t)=>String(t+1));function W(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function E(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function _(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=W(e),a=(0,v.useFloor)(t=>t.live[e])??{},n=(0,v.usePlan)(e),i=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(i,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const H=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function U({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=n?6:8,f=n?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(i??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,A.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],i=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!i,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,A.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:i?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,A.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,A.jsx)(C.T,{weight:"bold",size:22,colour:i?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,A.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,A.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,A.jsx)(C.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const q=[1,2,3,4,5,6,7,8];function G({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:r,r:d,now:u}=(0,y.useCtx)(15e3),x=_(r,u),[T,I]=(0,c.useState)(2),[P,$]=(0,c.useState)(!1),[O,z]=(0,c.useState)(i??null),B=(0,v.usePlan)(r),N=(0,k.useBookings)(r),L=(0,D.useBlocks)(e=>e.blocks),R=(0,D.closedAreasAt)(L,r,(0,w.ymd)(u),(0,w.hm)(u)),W=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(x).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(B,N.filter(e=>e.date===(0,w.ymd)(u)),e,T,u,(0,j.turnFor)(T,d.settings.turnMins),90,void 0,{closed:R})?.table??null},[B,N,x,T,R.size,u.getTime()]);(0,c.useEffect)(()=>{O&&(0,v.tablesOf)(O).some(e=>'Closed'===x[e]?.label)&&z(null)},[O,R.size]);const[H,G]=(0,c.useState)(!1),[V,Y]=(0,c.useState)(''),K=(e,t=String(e),s=()=>{$(!1),I(e)})=>{const o='9+'===t?P:!P&&T===e;return(0,A.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,A.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},Q=(0,A.jsx)(s.PartySizeInput,{value:T,onChange:I,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),X=(0,A.jsxs)(m.default,{style:{gap:8,width:n?256:void 0},children:[(0,A.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,A.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[q.map(e=>K(e)),K(9,'9+',()=>{$(!0),I(e=>e>=9?e:9)})]}),P?Q:null]}),[J,Z]=(0,c.useState)(!1),ee=async(t=O)=>{if(!J&&(0,M.guardBookingChange)(F)){Z(!0);try{const s=await k.repo.bookings.seatWalkIn(r,T,t??void 0,V);E(r,t??void 0),a(s),e()}finally{Z(!1)}}},te=(0,A.jsxs)(m.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,A.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,A.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),O?(0,A.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>z(null)}):null]}),(0,A.jsx)(U,{use:x,value:O,onPick:e=>{x[e]&&!x[e].busy?ee(e):z(O===e?null:e)},big:n,dense:n,best:W,bestSet:(0,h.bestTables)(B)}),(0,A.jsxs)(C.Muted,{children:["Tap a free table to seat them there",W&&!O?` (suggested for ${T}: ${(0,l.tableNumbers)(W)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(u)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,A.jsx)(C.Button,{label:`Seat walk-in \xb7 ${T} ${1===T?'person':'people'}${O?` \xb7 ${(0,l.tableNumbers)(O)}`:''}`,disabled:J,onPress:()=>{ee()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,A.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[X,te]}):(0,A.jsxs)(A.Fragment,{children:[X,te]}),(0,A.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[H?(0,A.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:V,onChangeText:Y,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,A.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,A.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,A.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function V({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,y.useCtx)(15e3),i=_(o,n),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(n)),t,e.partySize,n,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,n.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),P=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,$=D.reduce((e,t)=>e+P(t),0),O=D.length>0&&${if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&E(o,l),t()},B=x?(0,A.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,A.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,A.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${$} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,A.jsx)(m.default,{testID:"combine-short",children:(0,A.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-$," more needed. Add another table."]})}):null,(0,A.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,A.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,A.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,A.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,A.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,A.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${H(e)}`,testID:"assign-table-sheet",footer:B,children:[f&&!x?(0,A.jsx)(m.default,{testID:"assign-suggested",children:(0,A.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,A.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,A.jsx)(U,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function Y(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${H(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function K({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:N}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const R=(0,w.ymd)(p),[W,E]=(0,c.useState)(ee.blocks),[U,q]=(0,c.useState)(!1),[G,V]=(0,c.useState)(''),[Y,K]=(0,c.useState)(2),[Q,X]=(0,c.useState)(0),J=Math.min(Q,Math.max(0,Y-1)),[Z,ee]=(0,c.useState)(null),[te,se]=(0,c.useState)(''),[oe,le]=(0,c.useState)(''),[ae,ne]=(0,c.useState)(''),[ie,re]=(0,c.useState)(!1),[de,ue]=(0,c.useState)('phone'),[ce,be]=(0,c.useState)([]),[ge,he]=(0,c.useState)(''),[pe,me]=(0,c.useState)((0,P.emptyNeeds)()),fe=(0,P.needsMissing)(pe),[ye,ke]=(0,c.useState)(null),xe=(0,v.usePlan)(b),je=(0,O.dogSetUp)(xe),we=!0===pe.dog&&je,Se=pe.dog?pe.dogs:0,Te=(0,w.parseYmd)(W),Ce=(0,j.turnFor)(Y,h.settings.turnMins),ve=_.filter(e=>e.date===W),De=e=>(0,j.dogTablesAt)(xe,ve,Y,(0,j.slotStart)(W,e),Ce,h.settings.turnMins,(0,D.closedAreasAt)(H,b,W,e)),Ie=we&&Z?De(Z):[];(0,c.useEffect)(()=>{ke(null)},[we,Z,Y]);const Pe=(0,x.bookingSlots)(h,Te,e=>_.filter(t=>t.date===W&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Y,W===(0,w.ymd)(p)?p:(0,w.addMins)(Te,0),e=>_.filter(t=>t.date===W&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),$e=(0,T.guestPhone)(oe),[Oe,ze]=(0,c.useState)(!1),Be=Z?Pe.find(e=>e.time===Z):void 0,Me=Be&&Be.left=2&&!!Z&&(!Le||Oe)&&(0,o.validParty)(Y)&&$e.ok&&(0,T.emailOk)(ae)&&(!Ae||Fe&&U)&&(!we||Ie.length>0)&&!Re,Ee=pe.wheelchair>0||pe.stepFree,He=(0,$.bookingRulesOf)(h),Ue=(0,$.largeGroupTables)(He,Y),qe=(0,$.dogPartyCheck)(He,Y,!0===pe.dog,pe.assistDog),Ge=(0,$.bookingDepositSplit)((0,n.depositOf)(h.settings),Y,J,(0,P.needsPatch)(pe),(0,O.reservablesOf)(h));return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(Te)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,A.jsx)(P.FirstQuestions,{rid:b,value:pe,onChange:me,party:Y,audience:"staff"}),pe.dog&&!je?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,A.jsx)(I.BookingDatePicker,{r:h,today:p,value:W,onChange:e=>{e!==W&&(E(e),ee(null),q(!1))}}),(0,A.jsxs)(C.Row,{gap:6,children:[(0,A.jsx)(C.Chip,{label:"Phone",selected:'phone'===de,onPress:()=>ue('phone')}),(0,A.jsx)(C.Chip,{label:"In person",selected:'in-person'===de,onPress:()=>ue('in-person')})]}),(0,A.jsx)(C.Field,{label:"Name",value:G,onChangeText:V,placeholder:"e.g. Reid",testID:"nb-name"}),(0,A.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:oe,onChangeText:le,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!$e.ok&&oe?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:$e.error}):null,(0,A.jsx)(C.Field,{label:"Email (optional)",value:ae,onChangeText:ne,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email",testID:"nb-email"}),(0,T.emailOk)(ae)?null:(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),ae.trim()&&He.marketingOptIn?(0,A.jsx)(C.Toggle,{label:He.marketingWords,value:ie,onChange:re,testID:"nb-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,A.jsx)(i.AdultsChildren,{value:(0,r.peopleOf)(Y,J),onChange:e=>{K(e.partySize),X(e.children),ze(!1)},depositsOn:(0,n.depositOf)(h.settings).on&&(0,n.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,children:Pe.map(e=>{const t=we&&e.available&&!De(e.time).length||!(0,P.dogTimeOk)(h,_,W,e.time,Se);return(0,A.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(H,b,W,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:Z===e.time,onPress:()=>{ee(e.time),q(!1),ze(!1)}},e.time)})}),Le?(0,A.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[Me?(0,A.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Y,Me.left,Me.time)}):null,Ne?(0,A.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)(Ne.time,Ne.cap)}):null,(0,A.jsx)(C.Chip,{label:Oe?'Booking over the limit: on':'Book anyway (over the limit)',selected:Oe,onPress:()=>ze(e=>!e),testID:"nb-over-ok"})]}):null,we&&Z?(0,A.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,A.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,A.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",xe.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),Ie.length?xe.areas.filter(e=>Ie.some(t=>t.area===e.name)).map(e=>(0,A.jsxs)(m.default,{style:{gap:6},accessibilityLabel:e.name,children:[(0,A.jsxs)(C.T,{size:13,center:!0,colour:S.colours.muted,children:[e.name,e.outdoor?' (outdoor)':'']}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,children:Ie.filter(t=>t.area===e.name).map(e=>{const t=Ie[0]?.table===e.table;return(0,A.jsx)(C.Chip,{testID:`nb-dog-table-${(0,l.tableNumbers)(e.table)}`,label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.seats} seats${t?' \xb7 best':''}${Ee&&(0,O.accessibleSetUp)(xe)&&!(0,O.isAccessible)(xe,e.table)?' \xb7 not step-free':''}`,selected:(ye??Ie[0].table)===e.table,onPress:()=>ke(e.table)},e.table)})})]},e.id)):(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Y," at ",Z,". Try another time."]})]}):null,Ae?(0,A.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,A.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",Ae.from,"\u2013",Ae.to,Ae.reason?` (${Ae.reason})`:'']}),Fe?(0,A.jsx)(C.Chip,{label:U?'Manager override on':'Override and book anyway',selected:U,onPress:()=>q(e=>!e)}):(0,A.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,Pe.length?null:(0,A.jsx)(m.default,{testID:"nb-closed",children:(0,A.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(Te)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,A.jsx)(P.MoreQuestions,{rid:b,r:h,value:pe,onChange:me,party:Y,date:W,time:Z,today:(0,w.ymd)(p),bookings:_,audience:"staff",showTables:!1!==h.settings.tableRequests}),Ee&&!(0,O.accessibleSetUp)(xe)?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,Ue&&!we?(0,A.jsxs)(C.T,{size:14,colour:S.colours.goldLight,testID:"nb-large-group",children:["Large group: tables ",Ue.join(' + ')," joined."]}):null,qe.ok?null:(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,testID:"nb-dog-cap",children:["Online, a dog booking is for up to ",He.dogMaxParty," people. You can still book it here: check where they can sit."]}),(0,A.jsx)(C.T,{size:16,center:!0,children:"VIP or regular"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:L.TAGS.map(e=>{const t=ce.includes(e);return(0,A.jsx)(C.Chip,{label:e,selected:t,testID:`nb-tag-${e}`,onPress:()=>be(t?ce.filter(t=>t!==e):[...ce,e].sort())},e)})}),(0,A.jsx)(C.T,{size:16,center:!0,children:"Occasion"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:L.OCCASIONS.map(e=>(0,A.jsx)(C.Chip,{label:e.label,selected:ge===e.id,testID:`nb-occasion-${e.id||'none'}`,onPress:()=>he(e.id)},e.id||'none'))}),(0,A.jsx)(C.Field,{label:"Notes (optional)",value:te,onChangeText:se,placeholder:He.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"nb-notes"}),Ge.preorders?(0,A.jsxs)(C.Muted,{testID:"nb-preorder-deposit",children:["Pre-order deposit: ",(0,a.gbp)(Ge.preorders),Ge.adults?`, plus the group deposit: ${(0,a.gbp)(Ge.total)} in total`:'',". Staff can waive it."]}):null,(0,n.depositDue)((0,n.depositOf)(h.settings),Y,J)?(0,A.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(h.settings),Y,J))," (",(0,a.gbp)((0,n.depositOf)(h.settings).perPersonPence)," per adult for tables of ",(0,n.depositOf)(h.settings).fromParty,"+ adults",J?`; ${J} ${1===J?'child':'children'} free`:'; children free, and they do not count towards the number that needs a deposit',"). Staff can waive it. Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,A.jsx)(C.Muted,{children:"CoverCharge confirms the guest by email automatically (preview mode: shown in the Outbox, not sent)."}),Re?(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",Z,". Try another time: dogs are very welcome then."]}):null,(0,A.jsx)(C.Button,{label:fe.length?fe[0]:'Save booking',testID:"nb-save",disabled:!We,onPress:()=>{if(W<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,P.needsPatch)(pe),s=pe.tableReq.find(e=>!we||Ie.some(t=>t.table===e)),o=we?null:(0,B.requestedFreeTable)(pe.tableReq,{date:W,time:Z,partySize:Y},xe.tables.map(e=>e.name),ve,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:G.trim(),partySize:Y,date:W,time:Z,notes:te.trim(),security:Ge.total?'deposit':'none',depositPaid:0,...J?{children:J}:{},...Ge.total?{...(0,$.depositFields)(Ge),depositPolicy:(0,n.depositWords)((0,n.depositOf)(h.settings),Y,h.name,J).join(' '),depositRefundable:(0,n.depositOf)(h.settings).refundable,depositCutoffHours:(0,n.depositOf)(h.settings).cutoffHours}:{},phone:$e.pretty,email:ae.trim()||void 0,...ie?(0,$.marketingChoice)(ae,!0):{},source:de,...e,...Pe.find(e=>e.time===Z)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...ce.length?{tags:ce}:{},...ge?{occasion:ge}:{},...we?{table:ye??s??Ie[0]?.table}:o?{table:o}:{}}).then(e=>(0,z.postNewBookingToKitchen)(e,N)).catch(()=>{}),u?.({date:W,time:Z,name:G.trim()}),t()}})]})}},1096,[812,1097,1098,843,851,841,1099,1100,1101,1102,17,842,385,85,856,1055,858,1103,1074,863,804,848,777,996,993,1104,1105,1077,1053,1076,1094,1093,1111,1112,8]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,S]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{S(String(e))},[e]);const T=e=>p((0,s.clampParty)(e,b,y)),$=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>T(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:u.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(c.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:u.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?$(-10,'\u221210',"10 fewer people"):null,$(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{S(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&T((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);S(String(e)),T(e)},returnKeyType:"done",blurOnSubmit:!0,onSubmitEditing:e=>{e?.target?.blur?.()},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:u.colours.border,color:u.colours.text,backgroundColor:u.colours.surface,textAlign:'center',fontSize:20,fontFamily:u.fonts.semibold}}),$(1,'+','One more person'),y-b>=20?$(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),u=r(_d[5]),c=r(_d[6]),d=r(_d[7])},1097,[17,385,395,85,1098,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"overCapacityNote",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"overPartiesNote",{enumerable:!0,get:function(){return b}});const t=100,n=1,o=`Bookings are for ${n} to ${t} people.`,u=o=>'number'==typeof o&&Number.isInteger(o)&&o>=n&&o<=t,c=(o,u=n,c=t)=>{const s=parseInt(String(o??'').replace(/\D/g,'').slice(0,4),10);return Math.max(u,Math.min(c,Number.isFinite(s)?s:u))},s=(o,u=n,c=t)=>Math.max(u,Math.min(c,Math.round(Number(o)||u))),f=(t,n,o)=>n<=0?`${o} is already full for booked Covers. Booking ${t} more goes over the venue\u2019s limit: check tables and staffing.`:`${t} is more than the ${n} Covers left at ${o}. Booking goes over the venue\u2019s limit by ${t-n}: check tables and staffing.`,b=(t,n)=>`${t} already has the most bookings we take at one start time (${n}). Booking another goes over the venue\u2019s limit: check tables and staffing.`},1098,[]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdultsChildren=function({value:e,onChange:t,depositsOn:h,testID:x="people"}){const p=e=>t((0,s.storedPeople)(e)),b=(0,s.totalLine)(e);return(0,o.jsxs)(l.default,{testID:x,style:{gap:8,alignItems:'center',width:'100%'},children:[(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",children:"Adults"}),(0,o.jsx)(n.PartySizeInput,{value:e.adults,min:1,max:(0,s.maxAdults)(e.children),onChange:t=>p({adults:t,children:e.children}),label:"Adults",testID:`${x}-adults`}),(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",children:"Children"}),(0,o.jsx)(n.PartySizeInput,{value:e.children,min:0,max:(0,s.maxKids)(e.adults),onChange:t=>p({adults:e.adults,children:t}),label:"Children",testID:`${x}-children`}),(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",colour:c.colours.goldLight,testID:`${x}-total`,accessibilityLabel:b,children:b}),h?(0,o.jsx)(u.Muted,{center:!0,children:"Children never pay a deposit."}):null]})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4]),c=r(d[5]),o=r(d[6])},1099,[17,85,1100,1097,777,804,8]); @@ -1192,18 +1192,18 @@ __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,"ARM_MS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SELECT_HINT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SELECTED_A11Y",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"TABLE_SELECT_HINT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isArmed",{enumerable:!0,get:function(){return l}}),e.releaseOn=function(n,o,c,u){const b=l(n,o,u);return c?b?{arm:null,action:'move'}:{arm:n&&u-n.at!!n&&n.id===o&&c-n.at!e.signOff),S=k.filter(e=>e.signOff),_=j.map(o.allergenLabel).join(', '),C=e=>e.map(e=>e.name).join(', ')||'none';return(0,f.jsxs)(l.default,{testID:"menu-allergy-check",style:{gap:6,borderWidth:1,borderColor:p.length?h.colours.red:h.colours.border,borderRadius:12,padding:10,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(u.T,{weight:"semibold",children:["Allergy check against the menu (",_,")"]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.red,children:["Contains: ",p.length," dish",1===p.length?'':'es']}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.amber,children:["May contain: ",M.length]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.ok,children:["Free from ",1===j.length?'it':'them'," (signed off): ",S.length]}),w.length?(0,f.jsxs)(u.Muted,{children:[w.length," more awaiting the head chef's sign-off, so not shown as safe."]}):null,(0,f.jsx)(n.default,{testID:"menu-allergy-details",accessibilityRole:"button",onPress:()=>y(!x),hitSlop:6,children:(0,f.jsx)(u.T,{size:14,colour:h.colours.gold,children:x?'Hide dishes':'Show dishes'})}),x?(0,f.jsxs)(l.default,{style:{gap:4},children:[(0,f.jsxs)(u.Muted,{children:["Contains: ",C(p)]}),(0,f.jsxs)(u.Muted,{children:["May contain: ",C(M)]}),(0,f.jsxs)(u.Muted,{children:["Free from: ",C(S)]})]}):null,(0,f.jsx)(u.Muted,{children:'guest'===m?'From the kitchen\u2019s signed-off recipe cards. Specials on the board are checked by staff on the day.':'From the signed-off recipe cards. Specials on the board have their own allergens. Still check with the guest and the kitchen.'})]})};var s=r(d[0]),n=e(r(d[1])),l=e(r(d[2])),t=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8])},1110,[17,385,85,858,845,847,804,777,8]); __d(function(g,r,i,_a,m,_e,d){"use strict";function t(t){return String(t??'').split('+').map(t=>t.trim()).filter(Boolean)}function e(t){return t.length<=1?t[0]??'':2===t.length?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`}function n(n){const o=t(n);return o.length>1?`tables ${e(o)}`:o.length?`table ${o[0]}`:''}Object.defineProperty(_e,'__esModule',{value:!0}),_e.tableWords=n,Object.defineProperty(_e,"RECENT_SEATED_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"FINISH_UNDO_MS",{enumerable:!0,get:function(){return a}}),_e.seatedAgoMs=s,_e.seatedAgoWords=u,_e.needsRecentSeatedWarning=c,_e.finishConfirmPrompt=function(t){const e=t.name.trim()||'This party',n=t.parties&&t.parties>1?t.parties:1,o=t.seated&&c({seatedAt:t.seatedAt},t.now),a=o?u(s({seatedAt:t.seatedAt},t.now)):'',l=f(t.table);if(!t.seated)return`Mark ${e} finished without seating?`;if(n>1){return`${n} parties seated here${o?`, including ${e} seated ${a}`:''}. Mark all finished${l}?`}return o?`${e} seated ${a}. Mark finished${l}?`:`Mark ${e} finished${l}?`},_e.restoreSeatedPrompt=function(t,e){return`${t.trim()||'This party'} is finished. Seat them at ${n(e)}?`},_e.lastTableFromAudit=l,_e.tableForUndo=function(t,e){const n=String(t.table??'').trim();if(n)return n;const o=String(t.lastTable??'').trim();return o||l(e)},_e.finishClearPatch=function(t,e){const n=String(e??'').trim();return{status:'finished',finishedAt:t,table:void 0,...n?{lastTable:n}:{}}},_e.finishUndoPatch=function(t){const e=String(t??'').trim();return{status:'seated',finishedAt:void 0,lastTable:void 0,...e?{table:e}:{table:void 0}}};const o=15,a=15e3;function s(t,e){if(!t.seatedAt)return null;const n=new Date(t.seatedAt).getTime();return Number.isFinite(n)?Math.max(0,e.getTime()-n):null}function u(t){const e=Math.round(t/1e3);if(e<1)return'just now';if(e<60)return`${e} second${1===e?'':'s'} ago`;const n=Math.round(e/60);if(n<60)return`${n} minute${1===n?'':'s'} ago`;const o=Math.round(n/60);return`${o} hour${1===o?'':'s'} ago`}function c(t,e){const n=s(t,e);return null!=n&&n<9e5}function f(t){const e=t?n(t):'';return e?` and set ${e} to needs clearing`:''}function l(t){if(!t?.length)return;const e=[...t].sort((t,e)=>String(e.at??'').localeCompare(String(t.at??'')));for(const t of e){if(t.action&&'tables'!==t.action)continue;const e=String(t.from_value??'').trim(),n=String(t.to_value??'').trim();if(e&&!n)return e.replace(/\+/g,'+')}for(const t of e){if(t.action&&'tables'!==t.action)continue;const e=String(t.to_value??'').trim();if(e)return e;const n=String(t.from_value??'').trim();if(n)return n}}},1111,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FinishConfirm=I,_e.RestoreSeatedConfirm=function({prompt:e,onYes:t,onNo:n}){return(0,k.jsxs)(s.default,{testID:"restore-seated-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:"Yes, seat them",testID:"restore-seated-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"restore-seated-no",onPress:n,style:w})]})},Object.defineProperty(_e,"finishBookingNow",{enumerable:!0,get:function(){return p.finishBookingNow}}),_e.undoFinishedNow=D,_e.restoreFinishedToTable=async function(e,t,s){const o=(0,b.tableKey)(s);await n.repo.bookings.update(t.id,{...(0,f.tablePatch)(o||null),status:'seated',finishedAt:void 0,lastTable:void 0}),o&&(0,p.resetTableLive)(e,o)},_e.offerFinishUndo=F,_e.finishAndOfferUndo=v,_e.finishUnseatedAndOfferUndo=N,_e.FinishButton=function({rid:e,b:s,name:n,allowed:o=!0,hint:c,small:b,bigToast:f,testID:u,label:h="Finished",a11y:p,kind:D="secondary"}){const[F,j]=t.default.useState(!1);if(!o)return null;const x=(0,l.finishConfirmPrompt)({name:n,table:s.table,seatedAt:s.seatedAt,now:new Date,seated:'seated'===s.status});if(F)return(0,k.jsx)(I,{prompt:x,onNo:()=>j(!1),onYes:()=>{j(!1),'seated'===s.status?v(e,[s],n,{big:f,table:s.table}):N(e,s,n,{big:f})}});return(0,k.jsx)(y.Button,{small:b,kind:D,label:h,testID:u,accessibilityLabel:p??`${h}: ${n}`,accessibilityHint:c,disabled:!o,onPress:()=>j(!0),style:b?void 0:w})};var t=e(r(d[0])),s=e(r(d[1])),n=r(d[2]),o=r(d[3]),l=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),u=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]);const w={minHeight:64};function I({prompt:e,onYes:t,onNo:n,yesLabel:o="Yes, finish"}){return(0,k.jsxs)(s.default,{testID:"finish-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:o,testID:"finish-confirm-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"finish-confirm-no",onPress:n,style:w})]})}async function D(e,t,s){const c=(0,l.tableForUndo)(t,s);await n.repo.bookings.update(t.id,(0,l.finishUndoPatch)(c)),c&&(0,o.tablesOf)(c).forEach(t=>o.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function F(e){const t=e.bookings[0];if(!t)return;const s=e.bookings.length>1?`${e.bookings.length} parties finished.`:`${e.name} finished.`,n=e.table?`${(0,c.tableWords)(e.table).replace(/^t/,'T')} needs clearing.`:void 0,o=`finish-undo-${t.id}`;(0,u.notify)({id:o,title:s,body:n,timeoutMs:l.FINISH_UNDO_MS,big:e.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{for(const t of e.bookings)await D(e.rid,{...t,table:void 0,lastTable:t.table||t.lastTable});(0,u.dismissNotice)(o)})()}}]})}async function v(e,t,s,n){const o=n?.table??t.find(e=>e.table)?.table;for(const s of t)await(0,p.finishBookingNow)(e,s);F({rid:e,bookings:t,name:s,table:o,big:n?.big})}async function N(e,t,s,o){await n.repo.bookings.setStatus(t.id,'finished');const c=`finish-undo-${t.id}`;(0,u.notify)({id:c,title:`${s} finished.`,timeoutMs:l.FINISH_UNDO_MS,big:o?.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{await n.repo.bookings.setStatus(t.id,t.walkIn?'cancelled':'confirmed'),(0,u.dismissNotice)(c)})()}}]})}},1112,[17,85,858,996,1111,1113,1094,1090,916,804,777,1096,8]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return s.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return c}}),e.freeTablesNow=function(t,a,s=!1){const l=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),n=l.filter(([,t])=>t.table.maxSeats>=a),o=t=>t.map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}));return s?[...o(n),...o(l.filter(([,t])=>t.table.maxSeatsh[t]&&(l.includes(h[t].status)||'dirty'===h[t].status||'blocked'===h[t].status));if(p.length&&p.every(t=>h[t])&&!t.length)f.push({id:'seat',label:`Seat at ${b(s.table).replace(/^t/,'T')}`,a11y:`Seat ${n}, ${u(s.partySize)}, at ${b(s.table)}`,table:s.table});else if(c(s,$)){const a=p.length?t.length?`${b(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===h[t[0]].status?'waiting to be cleared':'blocked'===h[t[0]].status?'blocked':'in use'}`:`${b(s.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';f.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${n}, ${u(s.partySize)}. ${a}.`,note:a})}c(s,$)&&f.push({id:'finished',label:'Finished',a11y:`Finished, ${n}, ${s.time} booking, without seating at a table`}),o($,s)<=0&&f.push({id:'noshow',label:'No-show',a11y:`No-show, ${n}, ${s.time} booking`})}return f.push({id:'details',label:'Guest details',a11y:`Guest details, ${n}`}),f};var t=r(d[0]),a=r(d[1]),s=r(d[2]);const l=['seated','mains','dessert','bill'],n=t=>new Date(`${t.date}T${t.time}:00`),o=(t,a)=>(n(a).getTime()-t.getTime())/6e4,b=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},u=t=>`${t} ${1===t?'person':'people'}`,c=(t,a)=>o(a,t)<=45},1113,[996,863,1074]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return x}}),_e.cancelWalkInWords=I,_e.reinstateWalkInWords=$,_e.cancelWalkInNow=j,_e.reinstateWalkInNow=C,_e.CancelWalkInButton=function({rid:e,b:t,onDone:o,small:c,big:u}){const[b,f]=(0,n.useState)(!1),k=(0,l.useInStaffApp)(),x=(0,s.useSeatClearFinish)();return p(t)?k&&!x.ok?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(w.Button,{kind:"secondary",small:c,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>f(!0),style:u?{minHeight:64}:c?{minHeight:44}:h}),b?(0,y.jsx)(W,{rid:e,b:t,onClose:()=>f(!1),onDone:o}):null]}):null},_e.CancelWalkInConfirm=W,_e.ReinstateWalkInButton=function({rid:e,b:t,today:o,onDone:u,small:b}){const[f,p]=(0,n.useState)(!1),I=(0,l.useInStaffApp)(),j=(0,s.useSeatClearFinish)();if(!x(t,o))return null;if(I&&!j.ok)return null;const W=$(t);if(!f)return(0,y.jsx)(w.Button,{kind:"ghost",small:b,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>p(!0),style:b?{minHeight:44}:h});return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:()=>p(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:W,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:W})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[h,{flexGrow:1}],onPress:async()=>{await C(e,t),p(!1),u?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>p(!1),style:h})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]),o=r(d[4]),c=(e=o)&&e.__esModule?e:{default:e},u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]),w=r(d[9]),y=r(d[10]);const h={minHeight:56},p=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),x=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function I(e){const t=(0,b.tablesOf)(e.table),n=(0,f.tablesWords)(t);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${t.length?` at ${n}`:''}, arrived ${e.time}? It comes off the Covers${t.length?` and ${n} ${t.length>1?'go':'goes'} back to Free`:''}.`}function $(e){return`Put walk-in ${e.ref} back to seated? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`}async function j(e,n){await u.repo.bookings.setStatus(n.id,'cancelled'),await u.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,b.tablesOf)(n.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function C(e,t){await u.repo.bookings.setStatus(t.id,'seated'),(0,b.tablesOf)(t.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function W({rid:e,b:t,onClose:n,onDone:l}){const s=I(t);return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:s,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:s})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[h,{flexGrow:1}],onPress:async()=>{await j(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,b.tablesOf)(t.table).length?` ${(0,f.tablesWords)((0,b.tablesOf)(t.table))} free.`:''}`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:h})]})]})}},1114,[1115,17,1055,1117,85,858,996,1094,804,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.cancelStamp=C,_e.cancelBookingNow=w,_e.reinstateBookingNow=$,_e.CancelBookingButton=function({rid:e,b:n,name:o,onDone:s,big:l,small:c}){const[u,f]=(0,t.useState)(!1);return(0,b.canCancelBooking)(n)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(x.Button,{kind:"secondary",small:c,label:"Cancel booking",testID:`cancel-booking-${n.id}`,accessibilityLabel:`Cancel booking for ${o}, ${n.time}, ${n.partySize} Covers`,onPress:()=>f(!0),style:l?{minHeight:64}:c?{minHeight:44}:j}),u?(0,h.jsx)(D,{rid:e,b:n,name:o,onClose:()=>f(!1),onDone:s}):null]}):null},_e.CancelBookingConfirm=D,_e.ReinstateBookingButton=function({b:e,name:n,today:s,onDone:l}){const[c,u]=(0,t.useState)(!1);if(!(0,b.canReinstateBooking)(e,s))return null;const y=(0,b.reinstateBookingWords)(e,n);if(!c)return(0,h.jsx)(x.Button,{kind:"ghost",label:"Undo cancel",testID:`reinstate-booking-${e.id}`,accessibilityLabel:`Undo cancel for ${n}`,onPress:()=>u(!0),style:j});return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:()=>u(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center'},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, put back to booked",testID:"reinstate-booking-yes",accessibilityLabel:`Yes, put ${n} back to booked`,style:[j,{flexGrow:1}],onPress:async()=>{await $(e),u(!1),l?.(`${n} put back to booked.`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-booking-no",onPress:()=>u(!1),style:j})]})]})};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]),c=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]),y=r(d[8]),k=r(d[9]),p=r(d[10]),x=r(d[11]),h=r(d[12]);const j={minHeight:56},B={display:'Display',owner:'Managers app',staff:'Staff app',chef:'Kitchen app',customer:'Customer page'};function C(e){const t=y.useSession.getState().meId,n=t?k.useOwner.getState().staff.find(e=>e.id===t):void 0,o=B[p.APP_VARIANT]??'CoverCharge';return{by:n?`${n.name.replace(' (example)','')} (${o})`:o,at:(new Date).toISOString(),app:o,...e.table?{table:e.table}:{}}}async function w(e,t){const n=(0,l.tablesOf)(t.table);await s.repo.bookings.update(t.id,{status:'cancelled',cancelled:C(t),...(0,c.tablePatch)(null)}),n.forEach(t=>l.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function $(e){await s.repo.bookings.setStatus(e.id,'confirmed')}function D({rid:e,b:t,name:n,onClose:s,onDone:c}){const y=(0,b.cancelBookingWords)(t,n),k=(0,l.tablesOf)(t.table);return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:s,title:"Cancel booking?",maxWidth:560,testID:"cancel-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center',gap:8},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, cancel booking",testID:"cancel-booking-yes",accessibilityLabel:`Yes, cancel booking for ${n}`,style:[j,{flexGrow:1}],onPress:async()=>{await w(e,t),s(),c?.(`${n} cancelled.${k.length?` ${(0,u.tablesWords)(k)} free.`:''}`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep booking",testID:"cancel-booking-no",accessibilityLabel:`Keep booking for ${n}`,onPress:s,style:j})]})]})}},1115,[17,85,858,996,1090,1116,1094,804,920,876,856,777,8]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canCancelBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canReinstateBooking",{enumerable:!0,get:function(){return t}}),e.cancelBookingWords=function(n,t){const o=`${n.partySize} Cover${1===n.partySize?'':'s'}`;return`Cancel booking for ${t}, ${n.time}, ${o}? The table is freed. Website bookings will cancel it on the website and may email the guest.`},e.reinstateBookingWords=function(n,t){return`Put ${t} back to booked for ${n.time}? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`},e.cancelledOnDay=o,e.cancelledDayTally=function(n,t){const a=o(n,t),l=a.filter(n=>!!n.walkIn),c=a.filter(n=>!n.walkIn);return{count:a.length,covers:a.reduce((n,t)=>n+t.partySize,0),bookings:c.length,bookingCovers:c.reduce((n,t)=>n+t.partySize,0),walkIns:l.length,walkInCovers:l.reduce((n,t)=>n+t.partySize,0),list:a}},e.cancelledTallyWords=function(n,t="today"){if(!n.count)return`No cancellations ${t}`;const o=[],a=n.bookings??0,l=n.walkIns??0;a&&o.push(`${a} booking${1===a?'':'s'} (${n.bookingCovers??0} Cover${1===(n.bookingCovers??0)?'':'s'})`);l&&o.push(`${l} walk-in${1===l?'':'s'} (${n.walkInCovers??0} Cover${1===(n.walkInCovers??0)?'':'s'})`);if(!o.length)return`Cancelled ${t}: ${n.count} \xb7 ${n.covers} Cover${1===n.covers?'':'s'}`;return`Cancelled ${t}: ${o.join(' \xb7 ')}`};const n=n=>!n.walkIn&&('confirmed'===n.status||'pending'===n.status||'seated'===n.status),t=(n,t)=>!n.walkIn&&'cancelled'===n.status&&n.date>=t;function o(n,t){return n.filter(n=>n.date===t&&'cancelled'===n.status).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name))}},1116,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSeatClearFinish=function(){const t=(0,A.useSignedIn)(),o=(0,A.useInStaffApp)(),_='staff'===s.APP_VARIANT||'chef'===s.APP_VARIANT||o,l=(0,c.canSeatClearFinish)({device:s.IS_CAR||'display'===s.APP_VARIANT||!_&&!t,viaDisplay:(0,n.isKitchenViaDisplay)(),role:t?.role,ownerAccess:t?.ownerAccess,managerAccess:t?.managerAccess});return{ok:l,hint:l?void 0:c.SEAT_CLEAR_HINT}};var s=r(d[0]),n=r(d[1]),c=r(d[2]),A=r(d[3])},1117,[856,922,1118,1055]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEAT_CLEAR_HINT",{enumerable:!0,get:function(){return n}}),e.canSeatClearFinish=function(n){return!(!n.device&&!n.viaDisplay)||('owner'===n.role||'manager'===n.role||!(!n.ownerAccess&&!n.managerAccess))};const n='Ask a manager to seat, finish or clear a table.'},1118,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:s,who:i,role:n,inStaffApp:l,shiftManager:a,big:o,testID:d}){const[h,u]=(0,t.useState)(!1),p=(0,b.useSession)(e=>e.meId),y=(0,m.useOwner)(e=>e.staff.find(e=>e.id===p&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:l,role:n,shiftManager:a})||p&&!(0,x.canChangeBookings)(y)?null:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:d??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),h?(0,N.jsx)(V,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:n,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,l.useBookings)(e).filter(e=>!e.walkIn&&e.date>=s&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,200);return o?(0,N.jsx)(V,{rid:e,id:o,who:i,hidePrivate:a,onClose:n}):(0,N.jsxs)(z.Sheet,{visible:!0,onClose:n,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,N.jsx)(z.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${L(e.date,s)} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${L(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,N.jsx)(z.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,N.jsx)(z.Button,{kind:"ghost",label:"Close",onPress:n,style:{minHeight:44}})]})},_e.EditBookingSheet=V;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=(e=i)&&e.__esModule?e:{default:e},l=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),f=_r(_d[19]),C=_r(_d[20]),I=_r(_d[21]),k=_r(_d[22]),w=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),O=_r(_d[28]),W=_r(_d[29]),z=_r(_d[30]),B=_r(_d[31]),N=_r(_d[32]);const E=/^([01]\d|2[0-3]):[0-5]\d$/,R=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const L=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,D.ymd)(s)?'Tomorrow':F(e)};const A=e=>e?(e/100).toFixed(e%100?2:0):'',M=e=>{const t=(0,B.parseMoneyInput)(e);return null!=t&&t>=0?Math.round(100*t):NaN},F=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',H=e=>{const t=e.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);return t?`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`:''},_=e=>e.charAt(0).toUpperCase()+e.slice(1);function Y({title:e,children:t,testID:s}){return(0,N.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,N.jsx)(z.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const G=({label:e,value:t,onChange:s,max:i=20,testID:n})=>(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:e}),(0,N.jsx)(z.Stepper,{testID:n,value:t,min:0,max:i,onChange:s,label:e})]});function V({rid:e,id:i,who:b,onClose:m,hidePrivate:x=!1}){(0,$.useBlurOutside)();const B=(0,l.useBookings)(e),L=B.find(e=>e.id===i),V=(0,d.useRestaurant)(e),K=(0,a.usePlan)(e),U=(0,o.useBlocks)(e=>e.blocks),[q,X]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Q,J]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Z,ee]=(0,t.useState)(!1),[te,se]=(0,t.useState)(null),[ie,ne]=(0,t.useState)(null),[le,ae]=(0,t.useState)(!1),[oe,de]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositDue:0)),[re,ce]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositAmount:0)),[he,ue]=(0,t.useState)(F(L?(0,c.draftOf)(L).depositDate:''));if(!L||!q||!V)return null;const pe=e=>{se(null),ne(null),X({...q,...e})},ge=(0,O.depositOf)(V.settings),be=e=>{const t=e.partySize??q.partySize,s=Math.min(e.children??q.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(L)&&q.depositOn&&!q.depositPaid&&M(oe||'0')===(0,O.depositDue)(ge,q.partySize,q.children??0)){const e=(0,O.depositDue)(ge,t,s);e>0&&de(A(e))}pe({...e,children:s})},me=(0,v.bookingSlotMinutesOf)(V),xe=R(q.time),ye=E.test(xe),je=q.area?K.areas.filter(e=>e.name===q.area).map(e=>e.id):null,De=e=>!je||e.split('+').every(e=>je.includes(K.tables.find(t=>t.name===e)?.areaId??'')),ve=(0,y.tableOptions)(K,B.filter(e=>e.date===q.date),q.table).filter(e=>De(e)||e===q.table),fe=!(q.depositOn&&(Number.isNaN(M(oe||'0'))||q.depositPaid&&(Number.isNaN(M(re||'0'))||he.trim()&&!H(he)))),Ce={...q,time:xe,depositDue:M(oe||'0')||0,depositAmount:M(re||'0')||0,depositDate:H(he)},Ie=(0,c.changedDraftFields)(Q??(0,c.draftOf)(L),Ce),ke=V.settings.turnMins??90,we=!!q?.email?.trim()&&q.email.trim()!==(L?.email??'').trim(),Te=(0,u.bookingRulesOf)(V),Se=async()=>{const t=(0,c.editPatch)(L,Ce,{by:b||'Team member',app:r.APP_VARIANT});if(le&&we&&Object.assign(t,(0,u.marketingChoice)(Ce.email,!0)),Object.keys(t).length&&await l.repo.bookings.update(L.id,t),'seated'===L.status&&'table'in t&&t.table!==L.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(L.table),n=s(t.table),l=a.useFloor.getState(),o=i.map(t=>l.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!n.includes(e)).forEach(t=>l.setLive(e,t,{stage:void 0,dirty:!0})),n.forEach(t=>l.setLive(e,t,{stage:o,dirty:!1}))}ne(`Saved. Changed: ${(0,c.editedWords)(Ie)}.`),se(null),m()},$e=()=>{const t=ye?(0,o.blockAt)(U,e,q.date,xe):void 0,s=(0,c.editWarnings)(L,Ce,B,t,ke,K);!s.length||te?Se():se(s)},Pe=q.allergies??[],Oe=e=>pe({allergyNone:!1,allergies:Pe.some(t=>t.allergen===e)?Pe.filter(t=>t.allergen!==e):[...Pe,{allergen:e,severity:'allergy'}]}),We=(0,c.historyLines)(L);return(0,N.jsxs)(z.Sheet,{visible:!0,onClose:()=>{Ie.length?ee(!0):(ee(!1),m())},title:`Edit booking \xb7 ${L.name} \xb7 ${L.ref}`,maxWidth:760,testID:"edit-booking-sheet",onTypingDone:()=>{(0,C.hideKeyboard)(),Ie.length&&ye&&fe&&q.name.trim().length>=1&&$e()},typingDoneLabel:Ie.length?'Done, save changes':'Done, hide the keyboard',footer:(0,N.jsx)(z.Button,{label:te?'Save anyway':'Save changes',testID:"edit-save",disabled:!ye||!fe||q.name.trim().length<1||!Ie.length,onPress:$e,style:{minHeight:56,width:'100%'}}),children:[(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(w.DepositChip,{b:L,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(L)?(0,N.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,N.jsxs)(Y,{title:"Deposit",testID:"edit-section-deposit",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No deposit",selected:!q.depositOn,testID:"edit-deposit-none",onPress:()=>pe({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit due",selected:!!q.depositOn&&!q.depositPaid&&!q.depositWaived,testID:"edit-deposit-due",onPress:()=>pe({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit paid",selected:!!q.depositOn&&!!q.depositPaid,testID:"edit-deposit-paid",onPress:()=>{re||ce(oe),he||ue(F((0,D.ymd)(new Date))),pe({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsx)(z.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsxs)(z.T,{size:15,center:!0,colour:j.colours.goldLight,testID:"edit-deposit-waived-by",children:[L.depositWaived?.by?(0,O.waiverText)(L.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,q.depositWaived||Ie.includes('deposit')?null:(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(P.WaiveDepositButton,{b:L,who:b,onDone:e=>{const t={...q,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e};X(t),J(s=>s?{...s,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e}:t)}})}),q.depositOn?(0,N.jsx)(z.Field,{money:!0,label:"Deposit due (\xa3)",value:oe,onChangeText:e=>{de(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,q.depositOn&&q.depositPaid?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Field,{money:!0,label:"Amount paid (\xa3)",value:re,onChangeText:e=>{ce(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"How was it paid?"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,N.jsx)(z.Chip,{label:_(e),selected:q.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>pe({depositMethod:e})},e))}),(0,N.jsx)(z.Field,{label:"Date paid (DD/MM/YYYY)",value:he,onChangeText:e=>{ue((0,s.slashDate)(e,he)),pe({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),he.trim()&&!H(he)?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,fe?null:(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,N.jsx)(z.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,N.jsxs)(Y,{title:"When",testID:"edit-section-when",children:[(0,N.jsx)(k.BookingDatePicker,{r:V,today:new Date,value:q.date,onChange:e=>pe({date:e})}),(0,N.jsx)(I.TimeRoller,{testID:"edit-time",value:(0,f.snapTime)(q.time,me),onChange:e=>pe({time:e}),step:me}),ye?null:(0,N.jsx)(z.T,{size:15,colour:j.colours.amber,center:!0,children:"Choose a time on the roller."}),(0,N.jsx)(T.AdultsChildren,{value:(0,S.peopleOf)(q.partySize,q.children),onChange:e=>be(e),depositsOn:ge.on&&ge.perPersonPence>0,testID:"edit-people"}),(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:"Table time"}),(0,N.jsx)(z.Stepper,{testID:"edit-duration",value:q.duration||0,min:0,max:360,step:15,onChange:e=>pe({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,N.jsxs)(Y,{title:"Where",testID:"edit-section-where",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"Any area",selected:!q.area,testID:"edit-area-any",onPress:()=>pe({area:''})}),K.areas.map(e=>(0,N.jsx)(z.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:q.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>pe({area:e.name})},e.id))]}),(0,N.jsx)(z.T,{size:18,weight:"semibold",center:!0,children:(0,y.tableButtonLabel)(q.table)}),(0,y.splitChoices)(q.table).length?(0,N.jsxs)(n.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:"Split the joined tables"}),(0,N.jsx)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,y.splitChoices)(q.table).map(e=>(0,N.jsx)(z.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>pe({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:q.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(q.table?'':', chosen'),onPress:()=>pe({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),ve.map(e=>(0,N.jsx)(z.Button,{kind:e===q.table?'primary':'secondary',label:(0,y.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,y.tableButtonLabel)(e)}${e===q.table?', chosen':''}`,onPress:()=>pe({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,N.jsxs)(Y,{title:"Guest",testID:"edit-section-guest",children:[(0,N.jsx)(z.Field,{label:"Name",value:q.name,onChangeText:e=>pe({name:e}),testID:"edit-name"}),(0,N.jsx)(z.Field,{label:"Phone",value:q.phone,onChangeText:e=>pe({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,N.jsx)(z.Field,{label:"Email",value:q.email,onChangeText:e=>pe({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),we&&Te.marketingOptIn?(0,N.jsx)(z.Toggle,{label:Te.marketingWords,value:le,onChange:ae,testID:"edit-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,N.jsx)(z.T,{size:16,center:!0,children:"Booked by"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>pe({source:e.id})},e.id))}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(q.tags??[]).includes(e);return(0,N.jsx)(z.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>pe({tags:t?(q.tags??[]).filter(t=>t!==e):[...q.tags??[],e].sort()})},e)})})]}),(0,N.jsxs)(Y,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,N.jsx)(G,{label:"Dogs",value:q.dogs??0,max:6,onChange:e=>pe({dogs:e}),testID:"edit-dogs"}),(0,N.jsx)(G,{label:"High chairs",value:q.highChairs??0,max:10,onChange:e=>pe({highChairs:e}),testID:"edit-high-chairs"}),(0,N.jsx)(G,{label:"Wheelchair users",value:q.wheelchair??0,max:10,onChange:e=>pe({wheelchair:e}),testID:"edit-wheelchair"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"Occasion"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:(q.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>pe({occasion:e.id})},e.id||'none'))})]}),(0,N.jsxs)(Y,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No allergies",selected:!!q.allergyNone&&!Pe.length,testID:"edit-allergy-none",onPress:()=>pe({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,N.jsx)(z.Chip,{label:e.short,selected:Pe.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>Oe(e.id)},e.id))]}),Pe.map(e=>(0,N.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,N.jsxs)(z.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,N.jsx)(z.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>pe({allergies:Pe.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,N.jsx)(z.Field,{label:"Anything else about allergies",value:q.allergyNote,onChangeText:e=>pe({allergyNote:e}),testID:"edit-allergy-note"}),Ie.includes('allergies')&&Pe.length?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,N.jsx)(G,{label:"Vegan",value:q.vegan??0,max:q.partySize,onChange:e=>pe({vegan:e}),testID:"edit-vegan"}),(0,N.jsx)(G,{label:"Vegetarian",value:q.vegetarian??0,max:q.partySize,onChange:e=>pe({vegetarian:e}),testID:"edit-vegetarian"})]}),(q.holds??[]).length||(L.holds??[]).some(e=>e.qty>0&&!e.served)?(0,N.jsxs)(Y,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,N.jsx)(z.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(q.holds??[]).map(e=>{const t=(0,h.reservablesOf)(V),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),l=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,N.jsxs)(n.default,{testID:l,style:{gap:6,width:'100%'},children:[(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,N.jsx)(z.Stepper,{testID:l,value:e.qty,min:0,max:20,onChange:t=>pe({holds:(0,c.setEditableHoldQty)(q.holds??[],e.kind,e.id,t)}),label:i})]}),(0,N.jsx)(z.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${l}-remove`,onPress:()=>pe({holds:(0,c.removeEditableHold)(q.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(q.holds??[]).length?null:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==L.status?(0,N.jsxs)(Y,{title:"Status",testID:"edit-section-status",children:[(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>pe({status:e.id})},e.id))}),(0,N.jsx)(z.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,N.jsx)(Y,{title:"Notes",testID:"edit-section-notes",children:(0,N.jsx)(z.Field,{label:"Notes",value:q.notes,onChangeText:e=>pe({notes:e}),placeholder:Te.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),te?(0,N.jsxs)(n.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[te.map(e=>(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,ie?(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:ie}):null,Z?(0,N.jsxs)(n.default,{testID:"edit-discard-warn",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:j.colours.gold,backgroundColor:j.colours.surface2},children:[(0,N.jsx)(z.T,{size:20,weight:"bold",center:!0,children:"Discard unsaved changes?"}),(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.muted,children:"Your changes have not been saved."}),(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:"secondary",label:"Keep editing",testID:"edit-discard-keep",onPress:()=>ee(!1),style:{minHeight:52,flex:1}}),(0,N.jsx)(z.Button,{kind:"danger",label:"Discard changes",testID:"edit-discard-discard",onPress:()=>{ee(!1),m()},style:{minHeight:52,flex:1}})]})]}):null,We.length?(0,N.jsx)(Y,{title:"Changes",testID:"edit-history",children:We.slice(0,12).map((e,t)=>(0,N.jsx)(z.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,N.jsx)(W.CancelBookingButton,{rid:e,b:L,name:L.name,big:!0,onDone:()=>m()}),(0,N.jsx)(W.ReinstateBookingButton,{b:L,name:L.name,today:(0,D.ymd)(new Date),onDone:()=>m()})]})}},1119,[17,1031,85,858,996,993,860,856,1120,1053,1077,845,920,876,994,1090,804,863,1103,1121,815,1122,1104,1087,1099,1100,1101,1123,841,1115,777,840,8]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedDraftFields=W,_e.changedFields=j,_e.historyText=E,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=j(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:E(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${D(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!j(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return x}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: high chair, birthday, quiet table',o='This booking is on the website too. Saving here updates the website booking. The website may email the guest about a new date, time or status.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],u=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],h=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],k=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),w=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return w(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){return l.filter(i=>M(i,e)!==M(i,t))}function j(e,t){return W(y(e),t)}const A=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,D=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function E(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${A(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=k(o.holds),i=k(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${D(s)}`}const x=e=>e.map(e=>f[e]).join(', ')},1120,[1053,1098,1090,1094]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedDraftFields=W,_e.changedFields=j,_e.historyText=E,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=j(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:E(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${D(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!j(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return x}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: high chair, birthday, quiet table',o='This booking is on the website too. Saving here updates the website booking. The website may email the guest about a new date, time or status.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],u=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],h=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],k=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),w=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return w(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){return l.filter(i=>M(i,e)!==M(i,t))}function j(e,t){return W(y(e),t)}const A=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,D=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function E(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${A(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=k(o.holds),i=k(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${D(s)}`}const x=e=>e.map(e=>f[e]).join(', ')},1112,[1053,1098,1090,1094]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FinishConfirm=I,_e.RestoreSeatedConfirm=function({prompt:e,onYes:t,onNo:n}){return(0,k.jsxs)(s.default,{testID:"restore-seated-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:"Yes, seat them",testID:"restore-seated-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"restore-seated-no",onPress:n,style:w})]})},Object.defineProperty(_e,"finishBookingNow",{enumerable:!0,get:function(){return p.finishBookingNow}}),_e.undoFinishedNow=D,_e.restoreFinishedToTable=async function(e,t,s){const o=(0,b.tableKey)(s);await n.repo.bookings.update(t.id,{...(0,f.tablePatch)(o||null),status:'seated',finishedAt:void 0,lastTable:void 0}),o&&(0,p.resetTableLive)(e,o)},_e.offerFinishUndo=F,_e.finishAndOfferUndo=v,_e.finishUnseatedAndOfferUndo=N,_e.FinishButton=function({rid:e,b:s,name:n,allowed:o=!0,hint:c,small:b,bigToast:f,testID:u,label:h="Finished",a11y:p,kind:D="secondary"}){const[F,j]=t.default.useState(!1);if(!o)return null;const x=(0,l.finishConfirmPrompt)({name:n,table:s.table,seatedAt:s.seatedAt,now:new Date,seated:'seated'===s.status});if(F)return(0,k.jsx)(I,{prompt:x,onNo:()=>j(!1),onYes:()=>{j(!1),'seated'===s.status?v(e,[s],n,{big:f,table:s.table}):N(e,s,n,{big:f})}});return(0,k.jsx)(y.Button,{small:b,kind:D,label:h,testID:u,accessibilityLabel:p??`${h}: ${n}`,accessibilityHint:c,disabled:!o,onPress:()=>j(!0),style:b?void 0:w})};var t=e(r(d[0])),s=e(r(d[1])),n=r(d[2]),o=r(d[3]),l=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),u=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]);const w={minHeight:64};function I({prompt:e,onYes:t,onNo:n,yesLabel:o="Yes, finish"}){return(0,k.jsxs)(s.default,{testID:"finish-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:o,testID:"finish-confirm-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"finish-confirm-no",onPress:n,style:w})]})}async function D(e,t,s){const c=(0,l.tableForUndo)(t,s);await n.repo.bookings.update(t.id,(0,l.finishUndoPatch)(c)),c&&(0,o.tablesOf)(c).forEach(t=>o.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function F(e){const t=e.bookings[0];if(!t)return;const s=e.bookings.length>1?`${e.bookings.length} parties finished.`:`${e.name} finished.`,n=e.table?`${(0,c.tableWords)(e.table).replace(/^t/,'T')} needs clearing.`:void 0,o=`finish-undo-${t.id}`;(0,u.notify)({id:o,title:s,body:n,timeoutMs:l.FINISH_UNDO_MS,big:e.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{for(const t of e.bookings)await D(e.rid,{...t,table:void 0,lastTable:t.table||t.lastTable});(0,u.dismissNotice)(o)})()}}]})}async function v(e,t,s,n){const o=n?.table??t.find(e=>e.table)?.table;for(const s of t)await(0,p.finishBookingNow)(e,s);F({rid:e,bookings:t,name:s,table:o,big:n?.big})}async function N(e,t,s,o){await n.repo.bookings.setStatus(t.id,'finished');const c=`finish-undo-${t.id}`;(0,u.notify)({id:c,title:`${s} finished.`,timeoutMs:l.FINISH_UNDO_MS,big:o?.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{await n.repo.bookings.setStatus(t.id,t.walkIn?'cancelled':'confirmed'),(0,u.dismissNotice)(c)})()}}]})}},1113,[17,85,858,996,1111,1114,1094,1090,916,804,777,1096,8]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return s.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return c}}),e.freeTablesNow=function(t,a,s=!1){const l=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),n=l.filter(([,t])=>t.table.maxSeats>=a),o=t=>t.map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}));return s?[...o(n),...o(l.filter(([,t])=>t.table.maxSeatsh[t]&&(l.includes(h[t].status)||'dirty'===h[t].status||'blocked'===h[t].status));if(p.length&&p.every(t=>h[t])&&!t.length)f.push({id:'seat',label:`Seat at ${b(s.table).replace(/^t/,'T')}`,a11y:`Seat ${n}, ${u(s.partySize)}, at ${b(s.table)}`,table:s.table});else if(c(s,$)){const a=p.length?t.length?`${b(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===h[t[0]].status?'waiting to be cleared':'blocked'===h[t[0]].status?'blocked':'in use'}`:`${b(s.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';f.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${n}, ${u(s.partySize)}. ${a}.`,note:a})}c(s,$)&&f.push({id:'finished',label:'Finished',a11y:`Finished, ${n}, ${s.time} booking, without seating at a table`}),o($,s)<=0&&f.push({id:'noshow',label:'No-show',a11y:`No-show, ${n}, ${s.time} booking`})}return f.push({id:'details',label:'Guest details',a11y:`Guest details, ${n}`}),f};var t=r(d[0]),a=r(d[1]),s=r(d[2]);const l=['seated','mains','dessert','bill'],n=t=>new Date(`${t.date}T${t.time}:00`),o=(t,a)=>(n(a).getTime()-t.getTime())/6e4,b=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},u=t=>`${t} ${1===t?'person':'people'}`,c=(t,a)=>o(a,t)<=45},1114,[996,863,1074]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return x}}),_e.cancelWalkInWords=I,_e.reinstateWalkInWords=$,_e.cancelWalkInNow=j,_e.reinstateWalkInNow=C,_e.CancelWalkInButton=function({rid:e,b:t,onDone:o,small:c,big:u}){const[b,f]=(0,n.useState)(!1),k=(0,l.useInStaffApp)(),x=(0,s.useSeatClearFinish)();return p(t)?k&&!x.ok?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(w.Button,{kind:"secondary",small:c,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>f(!0),style:u?{minHeight:64}:c?{minHeight:44}:h}),b?(0,y.jsx)(W,{rid:e,b:t,onClose:()=>f(!1),onDone:o}):null]}):null},_e.CancelWalkInConfirm=W,_e.ReinstateWalkInButton=function({rid:e,b:t,today:o,onDone:u,small:b}){const[f,p]=(0,n.useState)(!1),I=(0,l.useInStaffApp)(),j=(0,s.useSeatClearFinish)();if(!x(t,o))return null;if(I&&!j.ok)return null;const W=$(t);if(!f)return(0,y.jsx)(w.Button,{kind:"ghost",small:b,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>p(!0),style:b?{minHeight:44}:h});return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:()=>p(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:W,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:W})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[h,{flexGrow:1}],onPress:async()=>{await C(e,t),p(!1),u?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>p(!1),style:h})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]),o=r(d[4]),c=(e=o)&&e.__esModule?e:{default:e},u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]),w=r(d[9]),y=r(d[10]);const h={minHeight:56},p=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),x=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function I(e){const t=(0,b.tablesOf)(e.table),n=(0,f.tablesWords)(t);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${t.length?` at ${n}`:''}, arrived ${e.time}? It comes off the Covers${t.length?` and ${n} ${t.length>1?'go':'goes'} back to Free`:''}.`}function $(e){return`Put walk-in ${e.ref} back to seated? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`}async function j(e,n){await u.repo.bookings.setStatus(n.id,'cancelled'),await u.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,b.tablesOf)(n.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function C(e,t){await u.repo.bookings.setStatus(t.id,'seated'),(0,b.tablesOf)(t.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function W({rid:e,b:t,onClose:n,onDone:l}){const s=I(t);return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:s,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:s})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[h,{flexGrow:1}],onPress:async()=>{await j(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,b.tablesOf)(t.table).length?` ${(0,f.tablesWords)((0,b.tablesOf)(t.table))} free.`:''}`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:h})]})]})}},1115,[1116,17,1055,1118,85,858,996,1094,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.cancelStamp=C,_e.cancelBookingNow=w,_e.reinstateBookingNow=$,_e.CancelBookingButton=function({rid:e,b:n,name:o,onDone:s,big:l,small:c}){const[u,f]=(0,t.useState)(!1);return(0,b.canCancelBooking)(n)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(x.Button,{kind:"secondary",small:c,label:"Cancel booking",testID:`cancel-booking-${n.id}`,accessibilityLabel:`Cancel booking for ${o}, ${n.time}, ${n.partySize} Covers`,onPress:()=>f(!0),style:l?{minHeight:64}:c?{minHeight:44}:j}),u?(0,h.jsx)(D,{rid:e,b:n,name:o,onClose:()=>f(!1),onDone:s}):null]}):null},_e.CancelBookingConfirm=D,_e.ReinstateBookingButton=function({b:e,name:n,today:s,onDone:l}){const[c,u]=(0,t.useState)(!1);if(!(0,b.canReinstateBooking)(e,s))return null;const y=(0,b.reinstateBookingWords)(e,n);if(!c)return(0,h.jsx)(x.Button,{kind:"ghost",label:"Undo cancel",testID:`reinstate-booking-${e.id}`,accessibilityLabel:`Undo cancel for ${n}`,onPress:()=>u(!0),style:j});return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:()=>u(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center'},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, put back to booked",testID:"reinstate-booking-yes",accessibilityLabel:`Yes, put ${n} back to booked`,style:[j,{flexGrow:1}],onPress:async()=>{await $(e),u(!1),l?.(`${n} put back to booked.`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-booking-no",onPress:()=>u(!1),style:j})]})]})};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]),c=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]),y=r(d[8]),k=r(d[9]),p=r(d[10]),x=r(d[11]),h=r(d[12]);const j={minHeight:56},B={display:'Display',owner:'Managers app',staff:'Staff app',chef:'Kitchen app',customer:'Customer page'};function C(e){const t=y.useSession.getState().meId,n=t?k.useOwner.getState().staff.find(e=>e.id===t):void 0,o=B[p.APP_VARIANT]??'CoverCharge';return{by:n?`${n.name.replace(' (example)','')} (${o})`:o,at:(new Date).toISOString(),app:o,...e.table?{table:e.table}:{}}}async function w(e,t){const n=(0,l.tablesOf)(t.table);await s.repo.bookings.update(t.id,{status:'cancelled',cancelled:C(t),...(0,c.tablePatch)(null)}),n.forEach(t=>l.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function $(e){await s.repo.bookings.setStatus(e.id,'confirmed')}function D({rid:e,b:t,name:n,onClose:s,onDone:c}){const y=(0,b.cancelBookingWords)(t,n),k=(0,l.tablesOf)(t.table);return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:s,title:"Cancel booking?",maxWidth:560,testID:"cancel-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center',gap:8},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, cancel booking",testID:"cancel-booking-yes",accessibilityLabel:`Yes, cancel booking for ${n}`,style:[j,{flexGrow:1}],onPress:async()=>{await w(e,t),s(),c?.(`${n} cancelled.${k.length?` ${(0,u.tablesWords)(k)} free.`:''}`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep booking",testID:"cancel-booking-no",accessibilityLabel:`Keep booking for ${n}`,onPress:s,style:j})]})]})}},1116,[17,85,858,996,1090,1117,1094,804,920,876,856,777,8]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canCancelBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canReinstateBooking",{enumerable:!0,get:function(){return t}}),e.cancelBookingWords=function(n,t){const o=`${n.partySize} Cover${1===n.partySize?'':'s'}`;return`Cancel booking for ${t}, ${n.time}, ${o}? The table is freed. Website bookings will cancel it on the website and may email the guest.`},e.reinstateBookingWords=function(n,t){return`Put ${t} back to booked for ${n.time}? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`},e.cancelledOnDay=o,e.cancelledDayTally=function(n,t){const a=o(n,t),l=a.filter(n=>!!n.walkIn),c=a.filter(n=>!n.walkIn);return{count:a.length,covers:a.reduce((n,t)=>n+t.partySize,0),bookings:c.length,bookingCovers:c.reduce((n,t)=>n+t.partySize,0),walkIns:l.length,walkInCovers:l.reduce((n,t)=>n+t.partySize,0),list:a}},e.cancelledTallyWords=function(n,t="today"){if(!n.count)return`No cancellations ${t}`;const o=[],a=n.bookings??0,l=n.walkIns??0;a&&o.push(`${a} booking${1===a?'':'s'} (${n.bookingCovers??0} Cover${1===(n.bookingCovers??0)?'':'s'})`);l&&o.push(`${l} walk-in${1===l?'':'s'} (${n.walkInCovers??0} Cover${1===(n.walkInCovers??0)?'':'s'})`);if(!o.length)return`Cancelled ${t}: ${n.count} \xb7 ${n.covers} Cover${1===n.covers?'':'s'}`;return`Cancelled ${t}: ${o.join(' \xb7 ')}`};const n=n=>!n.walkIn&&('confirmed'===n.status||'pending'===n.status||'seated'===n.status),t=(n,t)=>!n.walkIn&&'cancelled'===n.status&&n.date>=t;function o(n,t){return n.filter(n=>n.date===t&&'cancelled'===n.status).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name))}},1117,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSeatClearFinish=function(){const t=(0,A.useSignedIn)(),o=(0,A.useInStaffApp)(),_='staff'===s.APP_VARIANT||'chef'===s.APP_VARIANT||o,l=(0,c.canSeatClearFinish)({device:s.IS_CAR||'display'===s.APP_VARIANT||!_&&!t,viaDisplay:(0,n.isKitchenViaDisplay)(),role:t?.role,ownerAccess:t?.ownerAccess,managerAccess:t?.managerAccess});return{ok:l,hint:l?void 0:c.SEAT_CLEAR_HINT}};var s=r(d[0]),n=r(d[1]),c=r(d[2]),A=r(d[3])},1118,[856,922,1119,1055]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEAT_CLEAR_HINT",{enumerable:!0,get:function(){return n}}),e.canSeatClearFinish=function(n){return!(!n.device&&!n.viaDisplay)||('owner'===n.role||'manager'===n.role||!(!n.ownerAccess&&!n.managerAccess))};const n='Ask a manager to seat, finish or clear a table.'},1119,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:s,who:i,role:n,inStaffApp:l,shiftManager:a,big:o,testID:d}){const[h,u]=(0,t.useState)(!1),p=(0,b.useSession)(e=>e.meId),y=(0,m.useOwner)(e=>e.staff.find(e=>e.id===p&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:l,role:n,shiftManager:a})||p&&!(0,x.canChangeBookings)(y)?null:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:d??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),h?(0,N.jsx)(V,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:n,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,l.useBookings)(e).filter(e=>!e.walkIn&&e.date>=s&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,200);return o?(0,N.jsx)(V,{rid:e,id:o,who:i,hidePrivate:a,onClose:n}):(0,N.jsxs)(z.Sheet,{visible:!0,onClose:n,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,N.jsx)(z.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${L(e.date,s)} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${L(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,N.jsx)(z.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,N.jsx)(z.Button,{kind:"ghost",label:"Close",onPress:n,style:{minHeight:44}})]})},_e.EditBookingSheet=V;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=(e=i)&&e.__esModule?e:{default:e},l=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),f=_r(_d[19]),C=_r(_d[20]),I=_r(_d[21]),k=_r(_d[22]),w=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),O=_r(_d[28]),W=_r(_d[29]),z=_r(_d[30]),B=_r(_d[31]),N=_r(_d[32]);const E=/^([01]\d|2[0-3]):[0-5]\d$/,R=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const L=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,D.ymd)(s)?'Tomorrow':F(e)};const A=e=>e?(e/100).toFixed(e%100?2:0):'',M=e=>{const t=(0,B.parseMoneyInput)(e);return null!=t&&t>=0?Math.round(100*t):NaN},F=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',H=e=>{const t=e.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);return t?`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`:''},_=e=>e.charAt(0).toUpperCase()+e.slice(1);function Y({title:e,children:t,testID:s}){return(0,N.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,N.jsx)(z.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const G=({label:e,value:t,onChange:s,max:i=20,testID:n})=>(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:e}),(0,N.jsx)(z.Stepper,{testID:n,value:t,min:0,max:i,onChange:s,label:e})]});function V({rid:e,id:i,who:b,onClose:m,hidePrivate:x=!1}){(0,$.useBlurOutside)();const B=(0,l.useBookings)(e),L=B.find(e=>e.id===i),V=(0,d.useRestaurant)(e),K=(0,a.usePlan)(e),U=(0,o.useBlocks)(e=>e.blocks),[q,X]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Q,J]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Z,ee]=(0,t.useState)(!1),[te,se]=(0,t.useState)(null),[ie,ne]=(0,t.useState)(null),[le,ae]=(0,t.useState)(!1),[oe,de]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositDue:0)),[re,ce]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositAmount:0)),[he,ue]=(0,t.useState)(F(L?(0,c.draftOf)(L).depositDate:''));if(!L||!q||!V)return null;const pe=e=>{se(null),ne(null),X({...q,...e})},ge=(0,O.depositOf)(V.settings),be=e=>{const t=e.partySize??q.partySize,s=Math.min(e.children??q.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(L)&&q.depositOn&&!q.depositPaid&&M(oe||'0')===(0,O.depositDue)(ge,q.partySize,q.children??0)){const e=(0,O.depositDue)(ge,t,s);e>0&&de(A(e))}pe({...e,children:s})},me=(0,v.bookingSlotMinutesOf)(V),xe=R(q.time),ye=E.test(xe),je=q.area?K.areas.filter(e=>e.name===q.area).map(e=>e.id):null,De=e=>!je||e.split('+').every(e=>je.includes(K.tables.find(t=>t.name===e)?.areaId??'')),ve=(0,y.tableOptions)(K,B.filter(e=>e.date===q.date),q.table).filter(e=>De(e)||e===q.table),fe=!(q.depositOn&&(Number.isNaN(M(oe||'0'))||q.depositPaid&&(Number.isNaN(M(re||'0'))||he.trim()&&!H(he)))),Ce={...q,time:xe,depositDue:M(oe||'0')||0,depositAmount:M(re||'0')||0,depositDate:H(he)},Ie=(0,c.changedDraftFields)(Q??(0,c.draftOf)(L),Ce),ke=V.settings.turnMins??90,we=!!q?.email?.trim()&&q.email.trim()!==(L?.email??'').trim(),Te=(0,u.bookingRulesOf)(V),Se=async()=>{const t=(0,c.editPatch)(L,Ce,{by:b||'Team member',app:r.APP_VARIANT});if(le&&we&&Object.assign(t,(0,u.marketingChoice)(Ce.email,!0)),Object.keys(t).length&&await l.repo.bookings.update(L.id,t),'seated'===L.status&&'table'in t&&t.table!==L.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(L.table),n=s(t.table),l=a.useFloor.getState(),o=i.map(t=>l.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!n.includes(e)).forEach(t=>l.setLive(e,t,{stage:void 0,dirty:!0})),n.forEach(t=>l.setLive(e,t,{stage:o,dirty:!1}))}ne(`Saved. Changed: ${(0,c.editedWords)(Ie)}.`),se(null),m()},$e=()=>{const t=ye?(0,o.blockAt)(U,e,q.date,xe):void 0,s=(0,c.editWarnings)(L,Ce,B,t,ke,K);!s.length||te?Se():se(s)},Pe=q.allergies??[],Oe=e=>pe({allergyNone:!1,allergies:Pe.some(t=>t.allergen===e)?Pe.filter(t=>t.allergen!==e):[...Pe,{allergen:e,severity:'allergy'}]}),We=(0,c.historyLines)(L);return(0,N.jsxs)(z.Sheet,{visible:!0,onClose:()=>{Ie.length?ee(!0):(ee(!1),m())},title:`Edit booking \xb7 ${L.name} \xb7 ${L.ref}`,maxWidth:760,testID:"edit-booking-sheet",onTypingDone:()=>{(0,C.hideKeyboard)(),Ie.length&&ye&&fe&&q.name.trim().length>=1&&$e()},typingDoneLabel:Ie.length?'Done, save changes':'Done, hide the keyboard',footer:(0,N.jsx)(z.Button,{label:te?'Save anyway':'Save changes',testID:"edit-save",disabled:!ye||!fe||q.name.trim().length<1||!Ie.length,onPress:$e,style:{minHeight:56,width:'100%'}}),children:[(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(w.DepositChip,{b:L,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(L)?(0,N.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,N.jsxs)(Y,{title:"Deposit",testID:"edit-section-deposit",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No deposit",selected:!q.depositOn,testID:"edit-deposit-none",onPress:()=>pe({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit due",selected:!!q.depositOn&&!q.depositPaid&&!q.depositWaived,testID:"edit-deposit-due",onPress:()=>pe({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit paid",selected:!!q.depositOn&&!!q.depositPaid,testID:"edit-deposit-paid",onPress:()=>{re||ce(oe),he||ue(F((0,D.ymd)(new Date))),pe({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsx)(z.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsxs)(z.T,{size:15,center:!0,colour:j.colours.goldLight,testID:"edit-deposit-waived-by",children:[L.depositWaived?.by?(0,O.waiverText)(L.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,q.depositWaived||Ie.includes('deposit')?null:(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(P.WaiveDepositButton,{b:L,who:b,onDone:e=>{const t={...q,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e};X(t),J(s=>s?{...s,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e}:t)}})}),q.depositOn?(0,N.jsx)(z.Field,{money:!0,label:"Deposit due (\xa3)",value:oe,onChangeText:e=>{de(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,q.depositOn&&q.depositPaid?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Field,{money:!0,label:"Amount paid (\xa3)",value:re,onChangeText:e=>{ce(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"How was it paid?"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,N.jsx)(z.Chip,{label:_(e),selected:q.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>pe({depositMethod:e})},e))}),(0,N.jsx)(z.Field,{label:"Date paid (DD/MM/YYYY)",value:he,onChangeText:e=>{ue((0,s.slashDate)(e,he)),pe({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),he.trim()&&!H(he)?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,fe?null:(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,N.jsx)(z.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,N.jsxs)(Y,{title:"When",testID:"edit-section-when",children:[(0,N.jsx)(k.BookingDatePicker,{r:V,today:new Date,value:q.date,onChange:e=>pe({date:e})}),(0,N.jsx)(I.TimeRoller,{testID:"edit-time",value:(0,f.snapTime)(q.time,me),onChange:e=>pe({time:e}),step:me}),ye?null:(0,N.jsx)(z.T,{size:15,colour:j.colours.amber,center:!0,children:"Choose a time on the roller."}),(0,N.jsx)(T.AdultsChildren,{value:(0,S.peopleOf)(q.partySize,q.children),onChange:e=>be(e),depositsOn:ge.on&&ge.perPersonPence>0,testID:"edit-people"}),(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:"Table time"}),(0,N.jsx)(z.Stepper,{testID:"edit-duration",value:q.duration||0,min:0,max:360,step:15,onChange:e=>pe({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,N.jsxs)(Y,{title:"Where",testID:"edit-section-where",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"Any area",selected:!q.area,testID:"edit-area-any",onPress:()=>pe({area:''})}),K.areas.map(e=>(0,N.jsx)(z.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:q.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>pe({area:e.name})},e.id))]}),(0,N.jsx)(z.T,{size:18,weight:"semibold",center:!0,children:(0,y.tableButtonLabel)(q.table)}),(0,y.splitChoices)(q.table).length?(0,N.jsxs)(n.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:"Split the joined tables"}),(0,N.jsx)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,y.splitChoices)(q.table).map(e=>(0,N.jsx)(z.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>pe({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:q.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(q.table?'':', chosen'),onPress:()=>pe({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),ve.map(e=>(0,N.jsx)(z.Button,{kind:e===q.table?'primary':'secondary',label:(0,y.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,y.tableButtonLabel)(e)}${e===q.table?', chosen':''}`,onPress:()=>pe({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,N.jsxs)(Y,{title:"Guest",testID:"edit-section-guest",children:[(0,N.jsx)(z.Field,{label:"Name",value:q.name,onChangeText:e=>pe({name:e}),testID:"edit-name"}),(0,N.jsx)(z.Field,{label:"Phone",value:q.phone,onChangeText:e=>pe({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,N.jsx)(z.Field,{label:"Email",value:q.email,onChangeText:e=>pe({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),we&&Te.marketingOptIn?(0,N.jsx)(z.Toggle,{label:Te.marketingWords,value:le,onChange:ae,testID:"edit-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,N.jsx)(z.T,{size:16,center:!0,children:"Booked by"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>pe({source:e.id})},e.id))}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(q.tags??[]).includes(e);return(0,N.jsx)(z.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>pe({tags:t?(q.tags??[]).filter(t=>t!==e):[...q.tags??[],e].sort()})},e)})})]}),(0,N.jsxs)(Y,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,N.jsx)(G,{label:"Dogs",value:q.dogs??0,max:6,onChange:e=>pe({dogs:e}),testID:"edit-dogs"}),(0,N.jsx)(G,{label:"High chairs",value:q.highChairs??0,max:10,onChange:e=>pe({highChairs:e}),testID:"edit-high-chairs"}),(0,N.jsx)(G,{label:"Wheelchair users",value:q.wheelchair??0,max:10,onChange:e=>pe({wheelchair:e}),testID:"edit-wheelchair"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"Occasion"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:(q.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>pe({occasion:e.id})},e.id||'none'))})]}),(0,N.jsxs)(Y,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No allergies",selected:!!q.allergyNone&&!Pe.length,testID:"edit-allergy-none",onPress:()=>pe({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,N.jsx)(z.Chip,{label:e.short,selected:Pe.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>Oe(e.id)},e.id))]}),Pe.map(e=>(0,N.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,N.jsxs)(z.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,N.jsx)(z.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>pe({allergies:Pe.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,N.jsx)(z.Field,{label:"Anything else about allergies",value:q.allergyNote,onChangeText:e=>pe({allergyNote:e}),testID:"edit-allergy-note"}),Ie.includes('allergies')&&Pe.length?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,N.jsx)(G,{label:"Vegan",value:q.vegan??0,max:q.partySize,onChange:e=>pe({vegan:e}),testID:"edit-vegan"}),(0,N.jsx)(G,{label:"Vegetarian",value:q.vegetarian??0,max:q.partySize,onChange:e=>pe({vegetarian:e}),testID:"edit-vegetarian"})]}),(q.holds??[]).length||(L.holds??[]).some(e=>e.qty>0&&!e.served)?(0,N.jsxs)(Y,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,N.jsx)(z.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(q.holds??[]).map(e=>{const t=(0,h.reservablesOf)(V),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),l=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,N.jsxs)(n.default,{testID:l,style:{gap:6,width:'100%'},children:[(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,N.jsx)(z.Stepper,{testID:l,value:e.qty,min:0,max:20,onChange:t=>pe({holds:(0,c.setEditableHoldQty)(q.holds??[],e.kind,e.id,t)}),label:i})]}),(0,N.jsx)(z.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${l}-remove`,onPress:()=>pe({holds:(0,c.removeEditableHold)(q.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(q.holds??[]).length?null:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==L.status?(0,N.jsxs)(Y,{title:"Status",testID:"edit-section-status",children:[(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>pe({status:e.id})},e.id))}),(0,N.jsx)(z.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,N.jsx)(Y,{title:"Notes",testID:"edit-section-notes",children:(0,N.jsx)(z.Field,{label:"Notes",value:q.notes,onChangeText:e=>pe({notes:e}),placeholder:Te.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),te?(0,N.jsxs)(n.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[te.map(e=>(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,ie?(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:ie}):null,Z?(0,N.jsxs)(n.default,{testID:"edit-discard-warn",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:j.colours.gold,backgroundColor:j.colours.surface2},children:[(0,N.jsx)(z.T,{size:20,weight:"bold",center:!0,children:"Discard unsaved changes?"}),(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.muted,children:"Your changes have not been saved."}),(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:"secondary",label:"Keep editing",testID:"edit-discard-keep",onPress:()=>ee(!1),style:{minHeight:52,flex:1}}),(0,N.jsx)(z.Button,{kind:"danger",label:"Discard changes",testID:"edit-discard-discard",onPress:()=>{ee(!1),m()},style:{minHeight:52,flex:1}})]})]}):null,We.length?(0,N.jsx)(Y,{title:"Changes",testID:"edit-history",children:We.slice(0,12).map((e,t)=>(0,N.jsx)(z.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,N.jsx)(W.CancelBookingButton,{rid:e,b:L,name:L.name,big:!0,onDone:()=>m()}),(0,N.jsx)(W.ReinstateBookingButton,{b:L,name:L.name,today:(0,D.ymd)(new Date),onDone:()=>m()})]})}},1120,[17,1031,85,858,996,993,860,856,1112,1053,1077,845,920,876,994,1090,804,863,1103,1121,815,1122,1104,1087,1099,1100,1101,1123,841,1116,777,840,8]); __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.hmToMins=n,e.minsToHm=o,e.snapTime=u,e.hourValues=function(){return Array.from({length:24},(t,n)=>n)},e.minuteValues=function(t){const n=t>0&&t<=60&&60%t==0?t:15,o=[];for(let t=0;t<60;t+=n)o.push(t);return o},e.splitHm=function(o){const i=n(t.test(o)?o:u(o,15));return Number.isFinite(i)?{hour:Math.floor(i/60),minute:i%60}:{hour:12,minute:0}},e.joinHm=function(t,n){const o=(n%60+60)%60;return`${String((t%24+24)%24).padStart(2,'0')}:${String(o).padStart(2,'0')}`},e.timeRollerHint=function(t){return`24-hour. Times are every ${t>0?t:15} minutes. Roll or swipe each wheel. No typing.`};const t=/^([01]\d|2[0-3]):[0-5]\d$/;function n(t){const n=t.trim().match(/^(\d{1,2}):(\d{2})$/);if(!n)return NaN;const o=Number(n[1]),u=Number(n[2]);return o>23||u>59?NaN:60*o+u}function o(t){const n=(Math.round(t)%1440+1440)%1440,o=Math.floor(n/60),u=n%60;return`${String(o).padStart(2,'0')}:${String(u).padStart(2,'0')}`}function u(t,u){const i=u>0&&u<=60&&60%u==0?u:15,s=n(t),c=Number.isFinite(s)?s:720;return o(Math.round(c/i)*i)}},1121,[]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TimeRoller=function({value:e,onChange:t,step:n=15,testID:u="time-roller"}){const{hour:h,minute:m}=(0,s.splitHm)(e),f=(0,s.hourValues)(),x=(0,s.minuteValues)(n),p=f.indexOf(h),y=x.reduce((e,t)=>Math.abs(t-m)t((0,s.joinHm)(f[e],y)),label:"Hours",format:e=>String(e).padStart(2,'0'),testID:`${u}-hours`}),(0,c.jsx)(b,{values:x,index:j<0?0:j,onChange:e=>t((0,s.joinHm)(h,x[e])),label:"Minutes",format:e=>String(e).padStart(2,'0'),testID:`${u}-minutes`})]})]}),(0,c.jsx)(l.T,{size:13,center:!0,colour:o.colours.muted,children:(0,s.timeRollerHint)(n)})]})};var t=r(_d[0]),n=e(r(_d[1])),i=e(r(_d[2])),o=r(_d[3]),s=r(_d[4]),l=r(_d[5]),c=r(_d[6]);const d=48,u=5,h=2;function m(e,t){return(e%t+t)%t}function b({values:e,index:s,onChange:b,label:f,format:x,testID:p}){const y=(0,t.useRef)(null),j=(0,t.useRef)(0),v=e.length,w=e[m(s,v)],R=`${x(w)} ${f.toLowerCase()}`,S=e=>b(m(s+e,v)),T=()=>{y.current=null,j.current=0};return(0,c.jsx)(i.default,{testID:p,accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:f,accessibilityValue:{min:e[0],max:e[v-1],now:w,text:R},accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{'increment'===e.nativeEvent.actionName&&S(1),'decrement'===e.nativeEvent.actionName&&S(-1)},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{y.current=e.nativeEvent.pageY,j.current=0},onResponderMove:e=>{if(null==y.current)return;const t=e.nativeEvent.pageY-y.current;for(y.current=e.nativeEvent.pageY,j.current+=t;j.current<=-24;)S(1),j.current+=d;for(;j.current>=24;)S(-1),j.current-=d},onResponderRelease:T,onResponderTerminate:T,style:{width:120,height:240,alignItems:'center'},children:Array.from({length:u},(t,i)=>{const u=i-h,b=e[m(s+u,v)],f=0===u,p=2===Math.abs(u);return(0,c.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",onPress:()=>{u&&S(u)},style:{height:d,width:'100%',alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:f?28:p?18:22,weight:f?'bold':'medium',colour:f?o.colours.goldLight:o.colours.muted,center:!0,style:{opacity:f?1:p?.35:.7},children:x(b)})},`${i}-${b}`)})})}},1122,[17,385,85,804,1121,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1123,[17,85,858,856,1120,841,1095,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1123,[17,85,858,856,1112,841,1095,804,777,8]); __d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingHistory=function({rid:e,today:t}){const[b,k]=(0,s.useState)((0,n.addDaysIso)(t,-1)),[w,v]=(0,s.useState)('day'),[p,f]=(0,s.useState)((0,n.ddmmyyyy)((0,n.addDaysIso)(t,-1))),[D,$]=(0,s.useState)(!1),[_,I]=(0,s.useState)(0),T=(0,n.historyRange)(w,b,t),C=(0,c.useKitchenHistory)(e,T.from,T.to,t,_),P=(0,d.parseHistoryInput)(p),B=!!P&&(0,d.validPastDate)(P,t),L=e=>{(0,d.validPastDate)(e,t)&&(k(e),f((0,n.ddmmyyyy)(e)))};if(!C.allowed)return(0,h.jsx)(l.Card,{children:(0,h.jsx)(l.T,{size:20,center:!0,children:"Booking history is for the Head Chef and managers. Sign in to the Head Chef app to see it."})});const z='day'===w?1:7,S=(0,n.addDaysIso)('day'===w?b:(0,n.mondayOf)(b),-z),R='day'===w?(0,n.addDaysIso)(b,1):(0,n.addDaysIso)((0,n.mondayOf)(b),7),W='day'===w?'day':'week';return(0,h.jsxs)(o.default,{style:{gap:14},testID:"booking-history",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:12,alignItems:'stretch'},children:[(0,h.jsx)(l.T,{size:18,center:!0,children:"Bookings, covers and walk-ins on past days. Read-only; nothing is changed."}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:'day'===w?'primary':'secondary',testID:"bh-mode-day",label:"One day",accessibilityLabel:"Show one day"+('day'===w?', selected':''),onPress:()=>v('day')}),(0,h.jsx)(l.Button,{kind:'week'===w?'primary':'secondary',testID:"bh-mode-week",label:"Whole week",accessibilityLabel:"Show the whole week, Monday to Sunday"+('week'===w?', selected':''),onPress:()=>v('week')})]}),(0,h.jsx)(l.Field,{label:"Past date (DD/MM/YYYY)",value:p,onChangeText:e=>f((0,i.slashDate)(e,p)),placeholder:"09/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Past date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"bh-date",style:{textAlign:'center'}}),B?null:(0,h.jsx)(l.T,{size:16,center:!0,testID:"bh-date-hint",children:"Enter a past date as DD/MM/YYYY, for example 09/11/2026."}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:"secondary",label:"Pick a date",testID:"bh-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${u(b)}`,onPress:()=>$(!0)}),(0,h.jsx)(l.Button,{label:"Show",testID:"bh-show",accessibilityLabel:`Show booking history for ${B&&P?u(P):'a valid past date'}`,disabled:!B,onPress:()=>{P&&L(P),I(_+1)}})]}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:"secondary",testID:"bh-prev",label:`Previous ${W}`,accessibilityLabel:`Previous ${W}, ${u(S)}`,onPress:()=>L(S)}),(0,h.jsx)(l.Button,{kind:"secondary",testID:"bh-next",label:`Next ${W}`,accessibilityLabel:(0,d.validPastDate)(R,t)?`Next ${W}, ${u(R)}`:`Next ${W}, not available. Booking history is for past days only`,disabled:!(0,d.validPastDate)(R,t),onPress:()=>L(R)})]}),'day'===w?(0,h.jsx)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:(0,h.jsx)(l.Button,{small:!0,kind:"secondary",testID:"bh-prev-week",label:"Same day last week",accessibilityLabel:`Same day last week, ${u((0,n.addDaysIso)(b,-7))}`,onPress:()=>L((0,n.addDaysIso)(b,-7))})}):null]})}),(0,h.jsx)(y.LookBackCalendar,{visible:D,today:t,selected:b,purpose:"Booking history",idPrefix:"bh",onClose:()=>$(!1),onPick:e=>{L(e),$(!1)}}),C.data?'day'===w?C.data.days[0]?(0,h.jsx)(x,{d:C.data.days[0]}):null:(0,h.jsx)(j,{days:C.data.days,onDay:e=>{L(e),v('day')}}):(0,h.jsx)(l.Card,{children:(0,h.jsx)(o.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(l.T,{size:20,center:!0,testID:"bh-status",children:C.error||'Loading booking history\u2026'})})})]})};var e,s=r(_d[0]),t=r(_d[1]),o=(e=t)&&e.__esModule?e:{default:e},l=r(_d[2]),i=r(_d[3]),d=r(_d[4]),n=r(_d[5]),c=r(_d[6]),y=r(_d[7]),b=r(_d[8]),h=r(_d[9]);const u=e=>`${(0,n.dayName)(e)} ${(0,n.ddmmyyyy)(e)}`,k=({label:e,value:s,id:t})=>(0,h.jsxs)(o.default,{testID:`bh-stat-${t}`,accessible:!0,accessibilityLabel:`${e}: ${s}`,style:{alignItems:'center',minWidth:96,padding:8,borderRadius:12,borderWidth:1,borderColor:b.colours.border},children:[(0,h.jsx)(l.T,{size:28,weight:"bold",colour:b.colours.gold,center:!0,children:String(s)}),(0,h.jsx)(l.T,{size:16,center:!0,children:e})]});function x({d:e}){return(0,h.jsxs)(o.default,{style:{gap:12},testID:"bh-day",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:10,alignItems:'center'},accessible:!0,accessibilityLabel:(0,n.dayText)(e)+`. Done: ${e.done_covers+e.walk_in_covers} covers.`,children:[(0,h.jsx)(l.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:u(e.date)}),(0,h.jsx)(o.default,{testID:"bh-stats",style:{alignSelf:'stretch'},children:(0,h.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(k,{id:"bookings",label:"Bookings",value:e.bookings}),(0,h.jsx)(k,{id:"booked",label:"Booked covers",value:e.booked_covers}),(0,h.jsx)(k,{id:"walkins",label:"Walk-ins",value:e.walk_ins}),(0,h.jsx)(k,{id:"walkin-covers",label:"Walk-in covers",value:e.walk_in_covers}),(0,h.jsx)(k,{id:"done",label:"Done",value:e.done_covers+e.walk_in_covers}),(0,h.jsx)(k,{id:"total",label:"Total",value:e.total_covers})]})}),e.not_counted?(0,h.jsxs)(l.T,{size:16,center:!0,children:[e.not_counted," cancelled or no-show ",1===e.not_counted?'booking is':'bookings are'," listed but not counted."]}):null,e.old_records?(0,h.jsx)(l.T,{size:16,center:!0,colour:b.colours.muted,children:"Includes records from the previous booking system, which may be incomplete."}):null]})}),(e.lines??[]).length||e.walk_ins?null:(0,h.jsx)(l.Card,{children:(0,h.jsx)(l.T,{size:18,center:!0,children:"No bookings or walk-ins recorded for this day."})}),(e.lines??[]).map((e,s)=>(0,h.jsx)(o.default,{testID:"bh-line",accessible:!0,accessibilityLabel:(0,n.lineText)(e),style:{padding:10,borderRadius:12,borderWidth:1,borderColor:b.colours.border,alignItems:'center',opacity:e.counted?1:.7},children:(0,h.jsxs)(l.Row,{wrap:!0,gap:14,style:{justifyContent:'center'},children:[(0,h.jsx)(l.T,{size:20,weight:"bold",colour:b.colours.gold,children:e.time??'No time'}),(0,h.jsx)(l.T,{size:18,children:null==e.covers?'Covers not recorded':`${e.covers} ${1===e.covers?'cover':'covers'}`}),(0,h.jsx)(l.T,{size:18,children:e.table?`Table ${e.table}`:'No table'}),(0,h.jsx)(l.T,{size:18,children:(0,n.statusWord)(e.status)})]})},s))]})}function j({days:e,onDay:s}){const t=(0,n.sumDays)(e);return(0,h.jsxs)(o.default,{style:{gap:12},testID:"bh-week",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:10,alignItems:'center'},accessible:!0,accessibilityLabel:`Week ${(0,n.ddmmyyyy)(e[0].date)} to ${(0,n.ddmmyyyy)(e[e.length-1].date)}: ${t.bookings} bookings, ${t.booked_covers} booked covers, ${t.walk_ins} walk-ins with ${t.walk_in_covers} covers, ${t.total_covers} covers in total`,children:[(0,h.jsxs)(l.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:["Week ",(0,n.ddmmyyyy)(e[0].date)," to ",(0,n.ddmmyyyy)(e[e.length-1].date)]}),(0,h.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(k,{id:"week-bookings",label:"Bookings",value:t.bookings}),(0,h.jsx)(k,{id:"week-walkins",label:"Walk-ins",value:t.walk_ins}),(0,h.jsx)(k,{id:"week-total",label:"Total",value:t.total_covers})]})]})}),e.map(e=>(0,h.jsx)(l.Button,{kind:"secondary",testID:`bh-week-day-${e.date}`,label:`${(0,n.day3)(e.date)} ${(0,n.ddmmyyyy)(e.date)} \xb7 ${e.bookings} booked (${e.booked_covers}) \xb7 ${e.walk_ins} walk-in (${e.walk_in_covers}) \xb7 Total ${e.total_covers}`,accessibilityLabel:`${(0,n.dayText)(e)}. Double tap to see this day's bookings.`,onPress:()=>s(e.date)},e.date))]})}},1124,[17,85,777,1031,1062,1125,1061,1048,804,8]); __d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"addDaysIso",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ddmmyyyy",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"day3",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"dayName",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"mondayOf",{enumerable:!0,get:function(){return l}}),e.historyRange=function(o,t,s){if('day'===o)return{from:t,to:t};const a=l(t),c=n(a,6),d=n(s,-1);return{from:a,to:c({bookings:o.bookings+t.bookings,booked_covers:o.booked_covers+t.booked_covers,walk_ins:o.walk_ins+t.walk_ins,walk_in_covers:o.walk_in_covers+t.walk_in_covers,total_covers:o.total_covers+t.total_covers}),{bookings:0,booked_covers:0,walk_ins:0,walk_in_covers:0,total_covers:0})};const o=o=>o.toISOString().slice(0,10),t=o=>new Date(o+'T12:00:00Z'),n=(n,s)=>{const a=t(n);return a.setUTCDate(a.getUTCDate()+s),o(a)},s=o=>`${o.slice(8,10)}/${o.slice(5,7)}/${o.slice(0,4)}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],c=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=o=>a[t(o).getUTCDay()],u=o=>c[t(o).getUTCDay()],l=o=>n(o,-(t(o).getUTCDay()+6)%7);function b(o){switch((o??'').toLowerCase()){case'finished':case'seated':return'Done';case'confirmed':case'booked':case'amended':return'Booked';case'cancelled':return'Cancelled';case'noshow':return'No-show';default:return o||'Not recorded'}}const y=(o,t,n)=>`${o} ${1===o?t:n}`},1125,[]); __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TempUnitsSetup=function(){const e=(0,f.useSync)(e=>e.mode),s='live'===e||'offline'===e||'connecting'===e,o=(0,c.useSafety)(e=>e.points),b=(0,d.useOwner)(e=>e.site),[k,j]=(0,t.useState)(()=>(0,u.draftsFrom)(c.useSafety.getState().points)),[$,S]=(0,t.useState)(null),[I,w]=(0,t.useState)(!1),[T,D]=(0,t.useState)(''),[C,L]=(0,t.useState)(1),B=(0,t.useMemo)(()=>(0,u.changesOf)(k,o),[k,o]),z=e=>(0,h.chefCanSee)(b,e),A=Object.fromEntries(k.map(e=>[e.key,(0,u.problemOf)(e,k,z)])),P=Object.values(A).some(Boolean),R=e=>{j(t=>t.map(t=>t.key===e.key?e:t)),D(''),w(!1)},_=k.filter(e=>!e.archived),O=k.filter(e=>e.archived&&e.id),F=_.filter(e=>'fridge'===e.kind).length,H=_.length-F,M=e=>{const t=`new${C}`;L(C+1),D(''),w(!1),j(s=>[...s,{key:t,name:'',kind:e,location:'',max:String(u.DEFAULT_MAX[e]),due:'09:00, 16:00',archived:!1}])},W=P?'Fix the unit marked in red first.':B.length?`${B.length} change${1===B.length?'':'s'} not saved yet.`:'No changes yet.';return(0,x.jsxs)(n.default,{testID:"tu-setup",style:{gap:12,alignSelf:'center',width:'100%',maxWidth:560,alignItems:'stretch'},children:[(0,x.jsx)(l.T,{weight:"semibold",size:18,center:!0,accessibilityRole:"header",children:"Temperature units"}),(0,x.jsx)(l.T,{testID:"tu-count",size:15,center:!0,children:`${F} fridge${1===F?'':'s'} and ${H} freezer${1===H?'':'s'} checked`}),(0,x.jsx)(p.TempSaveBanner,{testID:"tu-save-banner"}),(0,x.jsx)(l.Banner,{kind:"info",title:s?'Shared with every device':'Not connected yet',children:s?'These units and their readings are on the shared food safety log, so every phone, tablet and screen at the venue shows the same units.':'These units are saved on this device until it connects. Then they are shared with every device at the venue.'}),_.map(e=>(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsx)(v,{d:e,problem:A[e.key],onChange:R,onArchive:()=>e.id?S(e.key):j(t=>t.filter(t=>t.key!==e.key))}),$===e.key?(0,x.jsxs)(n.default,{testID:"tu-archive-ask",style:{gap:8,padding:12,borderRadius:12,backgroundColor:y.colours.amberBg,alignItems:'center'},children:[(0,x.jsx)(l.T,{size:15,center:!0,children:`Archive ${e.name.trim()||'this unit'}? It will no longer be checked. Its past readings stay in History and the EHO report. Nothing is deleted.`}),(0,x.jsxs)(l.Row,{gap:8,children:[(0,x.jsx)(l.Button,{small:!0,testID:"tu-archive-confirm",label:"Archive",accessibilityLabel:`Yes, archive ${e.name}`,onPress:()=>{R({...e,archived:!0}),S(null)}}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-archive-cancel",label:"Keep it",accessibilityLabel:`No, keep ${e.name}`,onPress:()=>S(null)})]})]}):null]},e.key)),(0,x.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-add-fridge",label:"Add a fridge",onPress:()=>M('fridge')}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-add-freezer",label:"Add a freezer",onPress:()=>M('freezer')})]}),O.length?(0,x.jsxs)(n.default,{testID:"tu-archived",style:{gap:6,alignItems:'center'},children:[(0,x.jsx)(l.T,{weight:"medium",center:!0,children:"Archived (not checked, history kept)"}),O.map(e=>(0,x.jsxs)(l.Row,{gap:8,style:{justifyContent:'center'},children:[(0,x.jsx)(l.T,{size:14,center:!0,children:e.name}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:`tu-restore-${e.key}`,label:"Bring back",accessibilityLabel:`Bring back ${e.name}`,onPress:()=>R({...e,archived:!1,due:e.due||'09:00, 16:00'})})]},e.key))]}):null,I?(0,x.jsxs)(n.default,{testID:"tu-save-ask",style:{gap:8,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold,alignItems:'center'},children:[(0,x.jsx)(l.T,{weight:"medium",center:!0,children:`Save ${B.length} change${1===B.length?'':'s'}?`}),B.map(e=>(0,x.jsx)(l.T,{size:14,center:!0,children:e.text},e.key)),(0,x.jsxs)(l.Row,{gap:8,children:[(0,x.jsx)(l.Button,{small:!0,testID:"tu-save-confirm",label:"Save",accessibilityLabel:"Yes, save the changes",onPress:()=>{const e=c.useSafety.getState(),t=new Set(e.points.map(e=>e.id));for(const t of B)t.add?e.addPoint(t.add):t.id&&t.patch&&e.setPoint(t.id,t.patch);j((0,u.draftsFrom)(c.useSafety.getState().points)),w(!1);const n=[...B.filter(e=>e.id).map(e=>e.id),...c.useSafety.getState().points.filter(e=>!t.has(e.id)).map(e=>e.id)],l=`Saved ${B.length} change${1===B.length?'':'s'}.`;D(s?`${l} Sending to every device\u2026`:`${l} (on this device until it connects).`),s&&(0,p.reportTempSave)('temp_units',n,l,D)}}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-save-cancel",label:"Back",accessibilityLabel:"Go back without saving",onPress:()=>w(!1)})]})]}):null,(0,x.jsx)(l.Button,{testID:"tu-save",label:"Save changes",disabled:!B.length||P,accessibilityHint:W,onPress:()=>w(!0),style:{alignSelf:'center',minWidth:200}}),T?(0,x.jsx)(l.T,{testID:"tu-saved",size:15,colour:y.colours.ok,center:!0,accessibilityRole:"text",children:T}):(0,x.jsx)(l.Muted,{style:{textAlign:'center'},children:W})]})};var e,t=r(_d[0]),s=r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),h=r(_d[6]),u=r(_d[7]),y=r(_d[8]),p=r(_d[9]),f=r(_d[10]),x=r(_d[11]);const b=['Downstairs','Upstairs'],k={fridge:'Fridge',freezer:'Freezer'};function v({d:e,problem:t,onChange:s,onArchive:c}){const d=e.name.trim()||'new unit';return(0,x.jsxs)(n.default,{testID:`tu-unit-${e.key}`,style:{gap:8,padding:12,borderRadius:12,borderWidth:1,borderColor:t?y.colours.red:y.colours.border,alignSelf:'stretch'},children:[(0,x.jsx)(o.TextInput,{testID:`tu-name-${e.key}`,accessibilityLabel:`Name of ${d}`,value:e.name,onChangeText:t=>s({...e,name:t}),placeholder:"e.g. Upstairs fridge 5",placeholderTextColor:"#7D776C",style:[l.styles.input,{alignSelf:'stretch',width:'100%'}]}),(0,x.jsxs)(l.Row,{wrap:!0,gap:6,children:[['fridge','freezer'].map(t=>(0,x.jsx)(l.Chip,{testID:`tu-kind-${e.key}-${t}`,label:k[t],selected:e.kind===t,accessibilityLabel:`${d}: ${k[t]}${e.kind===t?', selected':''}`,onPress:()=>s((0,u.withKind)(e,t))},t)),b.map(t=>(0,x.jsx)(l.Chip,{testID:`tu-loc-${e.key}-${t.toLowerCase()}`,label:t,selected:e.location.trim().toLowerCase()===t.toLowerCase(),accessibilityLabel:`${d}: location ${t}`,onPress:()=>s({...e,location:t})},t))]}),(0,x.jsxs)(l.Row,{wrap:!0,gap:8,children:[(0,x.jsx)(o.TextInput,{testID:`tu-loc-${e.key}`,accessibilityLabel:`Location of ${d}`,value:e.location,onChangeText:t=>s({...e,location:t}),placeholder:"Location",placeholderTextColor:"#7D776C",style:[l.styles.input,{flexGrow:1,flexBasis:120,minWidth:0,width:40}]}),(0,x.jsxs)(l.Row,{gap:6,style:{flexWrap:'nowrap'},children:[(0,x.jsx)(o.TextInput,{testID:`tu-max-${e.key}`,accessibilityLabel:`Safe limit for ${d}, degrees or colder`,value:e.max,onChangeText:t=>s({...e,max:t}),placeholder:String(u.DEFAULT_MAX[e.kind]),placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[l.styles.input,{width:72,textAlign:'center'}]}),(0,x.jsx)(l.T,{size:14,children:"\xb0C or colder"})]})]}),(0,x.jsx)(o.TextInput,{testID:`tu-due-${e.key}`,accessibilityLabel:`Check times for ${d}, 24 hour, comma separated`,value:e.due,onChangeText:t=>s({...e,due:t}),placeholder:"Check times, e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[l.styles.input,{alignSelf:'stretch',width:'100%'}]}),t?(0,x.jsx)(l.T,{testID:`tu-problem-${e.key}`,size:14,colour:y.colours.red,center:!0,accessibilityRole:"text",children:t}):null,(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:`tu-archive-${e.key}`,label:"Archive",accessibilityLabel:`Archive ${d}`,accessibilityHint:"Stops the checks. Its past readings stay in History and the EHO report",onPress:c,style:{alignSelf:'center'}})]})}},1126,[17,85,777,812,1001,876,820,1127,804,1128,899,8]); @@ -1306,7 +1306,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e __d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenPanel=function({item:e,map:l,declared:s}){return(0,c.jsxs)(a.default,{style:{gap:6},accessibilityLabel:"Allergen panel",children:[(0,c.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(d.T,{weight:"semibold",children:"Allergen panel (14 UK allergens)"}),(0,n.isLiveVenue)()?null:(0,c.jsx)(d.Badge,{label:"NOT CONNECTED",kind:"amber"})]}),(0,c.jsx)(a.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:t.ALLERGENS.map(e=>{const n=l[e.id],u=s.find(l=>l.allergen===e.id),f='contains'===n?o.colours.redBg:'may'===n?o.colours.amberBg:o.colours.surface2,h='contains'===n?'#FFD9D4':'may'===n?'#FFE2A8':o.colours.muted;return(0,c.jsxs)(a.default,{style:{width:'48%',flexGrow:1,backgroundColor:f,borderRadius:8,padding:8,borderWidth:u?2:1,borderColor:u?o.colours.red:o.colours.border},children:[(0,c.jsx)(d.T,{size:14,weight:"medium",colour:n?h:o.colours.text,children:e.label}),(0,c.jsxs)(d.T,{size:13,colour:h,children:['contains'===n?'Contains':'may'===n?'May contain':'Not listed',u?` \xb7 YOUR ALLERGY (${(0,t.severityLabel)(u.severity)})`:'']})]},e.id)})}),e.allergenNotes?(0,c.jsxs)(d.Muted,{children:["Notes: ",e.allergenNotes]}):null,(0,c.jsx)(a.default,{testID:"allergen-signoff",children:(0,c.jsx)(d.Muted,{children:e.signOff?`From the dish's recipe card. Signed off by ${e.signOff.by} on ${u(e.signOff.at)}.`:"Awaiting the head chef's allergen sign-off: not available to order online."})}),(0,c.jsx)(d.Muted,{children:"Always tell staff about allergies when you order or arrive."})]})},_e.AllergenChips=function({map:l,declared:n,signedOff:s}){const a=Object.entries(l);return a.length?(0,c.jsx)(d.Row,{wrap:!0,gap:5,children:a.sort((e,l)=>e[1]===l[1]?0:'contains'===e[1]?-1:1).map(([e,l])=>{const s=n.some(l=>l.allergen===e);return(0,c.jsx)(d.Badge,{label:`${s?'\u26a0 ':''}${(0,t.allergenLabel)(e)}${'may'===l?' (may)':''}`,kind:s?'contains'===l?'red':'amber':'neutral'},e)})}):(0,c.jsx)(d.Muted,{children:(0,e.noAllergenWords)(s)})};var e=r(_d[0]);r(_d[1]);var l,n=r(_d[2]),s=r(_d[3]),a=(l=s)&&l.__esModule?l:{default:l},t=r(_d[4]),o=r(_d[5]),d=r(_d[6]),c=r(_d[7]);const u=e=>{const l=new Date(`${e.slice(0,10)}T12:00:00`);return isNaN(+l)?e:l.toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric'})}},1223,[901,17,1224,85,845,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1224,[880,899]); __d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/owner-desktop/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg",width:900,height:1200,toString(){return this.uri}}},1225,[]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},1226,[843,1026,17,219,385,85,780,858,804,777,1227,1102,1228,8]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by email",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},1226,[843,1026,17,219,385,85,780,858,804,777,1227,1102,1228,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,"BANNER_MS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return I}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:b}){const g=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!h||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=p,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,I),x=e.length-y.length,R=(0,f.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:h?'fixed':'absolute',left:10,right:n?10:76,top:8+g.top,zIndex:2147483001,gap:8,alignItems:'center',...h?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,f.jsx)(C,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>b(e)},e.id+':'+e.at)),x>0?(0,f.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:u.SLIDER.bg,borderWidth:1,borderColor:u.SLIDER.border},children:(0,f.jsxs)(c.T,{size:13,colour:u.SLIDER.quiet,children:[x," more new ",1===x?'booking':'bookings']})}):null]});if(h)try{const e=r(_d[13],"react-dom");if(e?.createPortal)return e.createPortal(R,document.body)}catch{}return R};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]),f=r(_d[12]);const h='undefined'!=typeof document,p="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",y=e=>h?{dataSet:{ccbn:e}}:{},x=7e3,I=3;function C({a:e,big:a,managers:p,me:I,onOpen:C,onClose:R}){const j='pending'===e.kind,[k,D]=(0,o.useState)(null),L=j&&p&&!k;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(R,k?1800:x);return()=>clearTimeout(e)},[L,k]);const S=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&R()}})).current,E=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',z=[e.when,E,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),v=j?'Booking request':'New booking',w=[e.when,E,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),T=`${v}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${C?' Tap to open bookings.':''}`,$=n=>{e.refId&&!e.test&&g.repo.bookings.decide(e.refId,n,I??'Manager'),D('confirmed'===n?'Confirmed.':'Declined.')};return(0,f.jsxs)(s.default,{...S.panHandlers,...y('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:u.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':u.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:j?d.colours.amber:d.colours.gold,...h?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,f.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:T,disabled:!C,onPress:()=>{R(),C?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,f.jsx)(c.T,{size:a?14:12,weight:"bold",colour:j?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:k??v.toUpperCase()}),(0,f.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:u.SLIDER.text,numberOfLines:1,children:e.name}),z?(0,f.jsx)(c.T,{size:a?18:15,colour:u.SLIDER.quiet,numberOfLines:1,children:z}):null,e.allergy?(0,f.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,f.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,f.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>$('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:u.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(c.T,{size:15,weight:"bold",colour:u.SLIDER.ink,children:"Confirm"})}),(0,f.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>$('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,f.jsx)(b.ToastClose,{testID:"booking-banner-close",label:`Close ${v.toLowerCase()} for ${e.name}`,onPress:R,size:a?'lg':'md',colour:u.SLIDER.quiet,style:{minWidth:56,minHeight:56,marginRight:4}})]})}},1227,[843,17,363,219,385,85,19,804,777,779,1102,858,8,260]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},1228,[1229,1230,1232,1231,1233,1016,1234]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1229,[]); @@ -1416,7 +1416,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1333,[812,843,17,85,777,845,851,1151,1334,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})},1334,[928,899,1151]); __d(function(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]})}},1335,[13,17,856,1336,1408,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 Je}}),_e2.DisplayBoard=function(e={}){const t=(0,ie.useOwner)(e=>e.site);return(0,te.useRestaurant)(t)?(0,qe.jsx)(at,{...e}):(0,qe.jsx)(U.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Y.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]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=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=_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]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]);const Ye='#221C12',Qe='#2E2618',Je=12e4,Xe={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},Ze={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},et={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},tt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),lt=e=>e.slotTime?(0,ee.hm)(new Date(e.slotTime)):'ASAP';function it({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,qe.jsxs)(U.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)(U.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)(U.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)(Y.T,{size:s?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,qe.jsx)(Y.T,{size:s?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,qe.jsx)(F.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)(U.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)(Y.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,qe.jsxs)(U.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,qe.jsx)(U.default,{style:{width:`${l.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,qe.jsx)(U.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,qe.jsxs)(F.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)(U.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,qe.jsx)(Y.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Y.T,{size:12,colour:se.colours.muted,children:s}):null]})}function ot({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ve.statusBlock)(e,t,(0,Ve.linkedBooking)(e,l));return e.length?(0,qe.jsx)(U.default,{style:{gap:8},children:e.map(e=>(0,qe.jsxs)(U.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:s?16:18,weight:"bold",children:[lt(e)," \xb7 ",tt(e.customerName)]}),(0,qe.jsx)(Y.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)(Y.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)(Y.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,Z.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Fe.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Y.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Y.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>te.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Y.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Y.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Ce.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Y.Muted,{children:"No takeaway orders right now."})}function at({embedded:e=!1,boardW:b,headerExtra:Z,subHeader:Fe,noVoice:Ve=!1}={}){const lt=(0,K.default)(),at=b??lt.width,dt=lt.height,ct=at<700,ut=at>=dt,ht=!ct&&ut&&at>=600,gt=ht,bt=Math.round(Math.min(520,Math.max(at>=1e3?448:280,.3*at))),yt=P.default.useRef(null),pt=P.default.useRef(0),[ft,xt]=(0,H.useState)({w:0,h:0}),mt=(0,ie.useOwner)(e=>e.site),jt=(0,te.useRestaurant)(mt);(0,Re.useAlertWatcher)(mt,{enabled:!e});const wt=(0,te.useOrders)(mt),kt=(0,te.useBookings)(mt),It=(0,te.useEvents)(mt),Dt=(0,te.useStore)(e=>e.skipMinutes),vt=(0,te.useStore)(e=>e.clock.mode),St=(0,te.useNow)(5e3),Ct=(0,ie.useOwner)(e=>e.staff),Tt=(0,ie.useOwner)(e=>e.attendance),Rt=(0,ie.useOwner)(e=>e.shifts),$t=(0,ie.useOwner)(e=>e.leave),Bt=P.default.useMemo(()=>(0,Oe.workingShifts)(Rt,$t),[Rt,$t]);P.default.useEffect(()=>{(0,oe.ensureAttendance)((0,ee.ymd)(St),St)},[(0,ee.ymd)(St)]);const Wt=(0,R.useSession)(e=>e.meId),Lt=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:tt(Ct.find(e=>e.id===Wt)?.name)}),zt=I.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Ht=(0,ee.ymd)(St),Pt=(0,A.useTravelDay)('display',Ht),Mt=(0,ne.useFrontDoor)(Ht,ut),At=(0,ae.useDisplaySettings)(mt),Et=At.privacy,Ot=(0,pe.useSaverSync)(),Nt=(0,ae.usePlan)(mt),_t=(0,ae.useFloor)(e=>e.live[mt]),Gt=(0,$e.useBlocks)(e=>e.blocks),[Ft,Vt]=(0,H.useState)('plan'),[Ut,Kt]=(0,H.useState)(!1),[qt,Yt]=(0,H.useState)('all'),[Qt,Jt]=(0,H.useState)(null),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(!1),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(null),[rs,ds]=(0,H.useState)(!1),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(null),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[ks,Is]=(0,H.useState)(!1),Ds=P.default.useRef(0),vs=e=>{Ds.current=Date.now(),ws(e)};P.default.useEffect(()=>{if(!js)return;const e=setInterval(()=>{Date.now()-Ds.current>=ze.DAY_IDLE_MS&&ws(null)},5e3);return()=>clearInterval(e)},[js]);const Ss=(0,te.useWaitlist)(mt),Cs=(0,te.useStore)(e=>e.walkIns[mt]??0),[Ts,Rs]=(0,H.useState)(!1),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1);(0,J.useReviewAlerts)(mt);const[Ps,Ms]=(0,H.useState)({view:0,content:0}),[As,Es]=(0,H.useState)(null);P.default.useEffect(()=>{As&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:As,timeoutMs:4500,big:!0,testID:'floor-toast'}),Es(null))},[As]),P.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Os,Ns]=(0,H.useState)(null),_s=P.default.useRef(0),[Gs,Fs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Os)return;_s.current=Date.now();const e=setInterval(()=>{const e=Date.now()-_s.current;if(e>=Je)return Ns(null),void Es('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Fs(e>=105e3?Math.ceil((Je-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Os]);const Vs=e=>e.date!==Ht?ts({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Ht)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Ht?(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Ht)}, ${e.time}`,disabled:!wi.ok,accessibilityHint:wi.hint,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}):null,(0,ve.bookingDetails)(e)]})}):ts({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(rt,{rid:mt,id:e.id,turnBase:jt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(we.CancelWalkInButton,{rid:mt,b:e,big:!0,onDone:e=>{ts(null),Es(e)}}):null,e.walkIn?(0,qe.jsx)(we.ReinstateWalkInButton,{rid:mt,b:e,today:Ht,onDone:e=>{ts(null),Es(e)}}):null,(0,ve.bookingDetails)(e)]})}),Us=kt.filter(e=>e.date===Ht).sort((e,t)=>e.time.localeCompare(t.time)),Ks=Us.filter(e=>!['cancelled','noshow'].includes(e.status)),qs=wt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,H.useMemo)(()=>(0,c.forecastToday)(jt,kt,wt,It,St),[jt,kt,wt,It,St.getTime()/6e4|0]),Qs=(0,$e.closedAreasAt)(Gt,mt,Ht,(0,ee.hm)(St)),Js=[...Qs].join(','),Xs=(0,H.useMemo)(()=>(0,re.floorView)(Nt,kt,wt,_t??{},St,jt.settings.turnMins,Qs),[Nt,kt,wt,_t,St.getTime(),Js]),Zs=(0,De.hoursFor)(jt,St),el=Zs?.open??new Date(`${Ht}T12:00:00`),tl=Zs?.close??new Date(`${Ht}T21:00:00`),sl=(0,ee.addMins)(el,-el.getMinutes()),ll=(0,ee.addMins)(tl,30),il=e=>new Date(`${Ht}T${e}:00`),nl=(0,$e.blocksOn)(Gt,mt,Ht).map(e=>({from:il(e.from),to:il(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(jt,St,Ht)),ol=Object.keys(Xs).filter(e=>'blocked'===Xs[e]?.status),al=js&&js!==Ht?js:Ht,rl=al!==Ht,dl=(0,ze.dayWord)(al,Ht),cl=/^(Today|Yesterday|Tomorrow)$/.test(dl),ul=rl?(0,ze.bookingsForDay)(kt,al,Ht).sort((e,t)=>e.time.localeCompare(t.time)):Us,hl=(0,ee.parseYmd)(al);hl.setHours(12);const gl=rl?(0,De.hoursFor)(jt,hl):Zs,bl=gl?.open??new Date(`${al}T12:00:00`),yl=gl?.close??new Date(`${al}T21:00:00`),pl=e=>new Date(`${al}T${e}:00`),fl=[...rl?(0,$e.blocksOn)(Gt,mt,al).map(e=>({from:pl(e.from),to:pl(e.to),label:e.reason??'Paused'})):nl,...rl?(0,n.queuedServicePauses)(jt,hl,al):[]],xl=(0,n.queuedServiceSessions)(jt,hl),ml=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),jl=(0,qe.jsxs)(U.default,{testID:"queued-hours-gate",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Y.Muted,{children:i.queuedVenues[mt]?.hours.note})]}),wl=rl?gl||ul.length?alrl?(0,re.dayFloorView)(Nt,ul,al):Xs,[rl,Nt,ul,al,Xs]),[Il,Dl]=(0,H.useState)(null),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(!1),[Rl,$l]=(0,H.useState)(null),Bl=rl?ul.filter(e=>!['cancelled','noshow'].includes(e.status)):Ks,Wl=Bl.reduce((e,t)=>e+t.partySize,0),Ll=(0,u.coversSplit)(Bl,al),zl=(0,Pe.cancelledDayTally)(kt,al),Hl=(0,Me.cancellationsFor)(kt,al,e=>e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)','')),Pl=(0,Pe.cancelledTallyWords)(zl,cl?dl.toLowerCase():rl?`on ${dl}`:'today'),Ml=Gt.filter(e=>e.rid===mt&&e.date===al&&!e.removedAt),Al=60*bl.getHours()+bl.getMinutes(),El=60*yl.getHours()+yl.getMinutes(),Ol=(0,Le.chartBands)(Ml,Al,El),Nl=(0,Le.seasonClosedAreaIds)(Ml,Al,El),_l=Nl.size?{...Nt,areas:Nt.areas.filter(e=>!Nl.has(e.id)),tables:Nt.tables.filter(e=>!Nl.has(e.areaId))}:Nt,Gl=rl?[]:ol.filter(e=>!Nl.has(Nt.tables.find(t=>t.name===e)?.areaId??'')),Fl=new Set((0,Le.blockedHours)(Ol)),Vl=St.getHours()+(St.getMinutes()>=30?1:0),Ul=Ys.hours.filter(e=>e.hour>=Vl&&!Fl.has(e.hour)),Kl=Ul.reduce((e,t)=>e+t.coversHigh,0),ql=Ul.reduce((e,t)=>e+t.coversLow,0),Yl=Math.round((ql+Kl)/2),Ql=!Ys.example&&Ys.open&&Ys.enough&&Kl>0?`Usually ${(0,c.coversRange)(Yl,Yl)} more`:void 0,Jl=async(e,t)=>{const s=Xs[e]?.booking;if(!s||e===t)return;const l=Xs[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 ${re.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,ke.guardBookingChange)(Es,{b:s,tables:[t]}))return;await te.repo.bookings.update(s.id,{table:t});const i=_t?.[e]?.stage;ae.useFloor.getState().setLive(mt,t,{stage:i??'seated',dirty:!1}),ae.useFloor.getState().setLive(mt,e,{stage:void 0,dirty:!0}),Es(`Saving: ${(0,fe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,ke.reportBookingSave)(s.id,`${(0,fe.privName)(s,Et)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}`,Es)},Xl=e=>{if(xs)return Sl(null),void ms(t=>t?{...t,tables:(0,Ie.toggleTable)(t.tables,e)}:t);rl?Dl(e):Xt?(e!==Xt&&Jl(Xt,e),Zt(null)):Jt(e)},Zl=xs?kt.find(e=>e.id===xs.id):void 0,ei=xs&&Zl?(()=>{const e=Zl.walkIn?(0,fe.privName)(Zl,Et):tt(Zl.name),t=(0,Ie.seatsOf)(Nt,xs.tables).total,s=(0,Ie.seatLine)(t,Zl.partySize),l=(0,Ie.pickClashes)(Zl,xs.tables,kt.filter(e=>e.date===Zl.date),jt.settings.turnMins),i=(0,Ie.tableKey)(xs.tables)!==(0,Ie.tableKey)((0,ae.tablesOf)(Zl.table));return(0,qe.jsxs)(U.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,qe.jsxs)(U.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Zl.date,Ht)} ${Zl.time}. Tap tables on the plan to add or take them off. ${(0,Ie.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Zl.date,Ht)," ",Zl.time]}),(0,qe.jsxs)(Y.T,{size:16,colour:se.colours.text,children:[(0,Ie.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),vl?(0,qe.jsx)(U.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:vl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,qe.jsx)(Y.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:vl})}):null,Cl&&Zl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Tl(!1),(async()=>{if(!(0,ke.guardBookingChange)(Es,{b:Zl,tables:xs.tables}))return Sl(null),void ms(null);const s=xs.tables;ms(null),await(0,ke.saveTablesReported)(mt,Zl,s,e,t,Es)})()},onNo:()=>Tl(!1)}):null,(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:vl?'plan-pick-overcap-yes':'plan-pick-save',label:vl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${vl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,Ie.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Zl)return void ms(null);if(!(0,ke.guardBookingChange)(Es,{b:Zl,tables:xs.tables}))return Sl(null),void ms(null);const s=(0,Ie.overCapacityAsk)(xs.tables,t,Zl.partySize);if(s&&!vl)return void Sl(s);if('finished'===Zl.status&&xs.tables.length&&!Cl)return void Tl(!0);Sl(null),Tl(!1);const l=xs.tables;ms(null),await(0,ke.saveTablesReported)(mt,Zl,l,e,t,Es)}}),(0,qe.jsx)(Y.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Sl(null),ms(null)}})]})]})})():null,ti=_l.areas.filter(e=>_l.tables.some(t=>t.areaId===e.id)),si=e=>{const t=Nt.tables.filter(t=>t.areaId===e);return rl?`${t.filter(e=>!kl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Xs[e.name]?.status??'free')).length}/${t.length} free`},li='all'===qt||ti.some(e=>e.id===qt)?qt:'all',ii=e=>(0,qe.jsx)(de.FloorCanvas,{plan:_l,areaId:e,mode:"live",fit:"contain",crop:!0,fill:ht,big:!0,view:kl,privacy:Et,turnBase:jt.settings.turnMins,highlight:xs?xs.tables:Xt?[Xt]:void 0,onTap:e=>Xl(e.name),onDrop:(e,t)=>xs||rl?void 0:Jl(e.name,t.name)}),ni=ct?1:ut||ti.length>2?2:1,oi=e=>{const t=Nt.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},ai=[];for(let e=0;e{const t=(0,de.areaBounds)(Nt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,de.minReadableScale)(Nt,e.id)}}),ft.w,ft.h):null,di=e=>(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',height:ce.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:si(e.id)})]}),ci=(0,qe.jsx)(U.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-ft.w)>1||Math.abs(s-ft.h)>1)&&xt({w:t,h:s})},children:ri?(0,qe.jsx)(V.default,{style:{flex:1},scrollEnabled:ri.scroll,showsVerticalScrollIndicator:ri.scroll,contentContainerStyle:{gap:ce.GRID_GAP},children:ri.rows.map((e,t)=>(0,qe.jsx)(U.default,{style:{height:ri.rowHeights[t],flexDirection:'row',gap:ce.GRID_GAP},children:e.map(e=>{const t=ti.find(t=>t.id===e);return(0,qe.jsxs)(U.default,{testID:`area-cell-${e}`,style:{width:ri.cellW,gap:2},children:[di(t),(0,qe.jsx)(U.default,{style:{flex:1},children:ii(e)})]},e)})},t))}):null}),ui=(0,qe.jsxs)(U.default,{testID:"venue-plan",style:{flex:ct?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:Nt}),Nt.tables.length?null:(0,qe.jsxs)(U.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,qe.jsx)(Y.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Y.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)(Y.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,qe.jsx)(nt,{chipId:"all",compact:!ct,label:"Whole venue",selected:'all'===li,onPress:()=>Yt('all')},"__all"),...ti.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ct,label:`${e.name}${(0,ue.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ct?Qs.has(e.id)?'closed':li===e.id?si(e.id):void 0:void 0,selected:li===e.id,onPress:()=>Yt(e.id)},e.id))];return ct?(0,qe.jsx)(U.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,qe.jsx)(V.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:Ps.view>0&&Ps.content>0&&Ps.content<=Ps.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ps.view>0&&Ps.content<=Ps.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),ei,Xt?(0,qe.jsxs)(Y.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Y.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Xt),": tap the new table."]}),(0,qe.jsx)(Y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Zt(null)})]}):null,'all'===li&&ht?ci:'all'===li?(0,qe.jsx)(U.default,{style:{flex:ct?void 0:1,gap:12,minHeight:gt?void 0:360},children:ai.map((e,t)=>(0,qe.jsxs)(U.default,{style:{flex:ct?void 0:Math.max(.3,...e.map(e=>oi(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(U.default,{style:{flex:1,gap:2},children:[ct?(0,qe.jsxs)(U.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Y.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{center:!0,children:si(e.id)})]}):(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{children:si(e.id)})]}),(0,qe.jsx)(U.default,{style:ct?{height:Math.max(280,Math.round((at-40)*oi(e.id)))}:{flex:1},children:ii(e.id)})]},e.id)),e.length{if(rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},al)}),gi='timeline'===Ft,bi=Ut?(0,qe.jsx)(_.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Kt(!1),supportedOrientations:['landscape','portrait'],children:(0,qe.jsxs)(U.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,qe.jsx)(F.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Kt(!1),style:{minHeight:64,minWidth:at<600?120:180,paddingHorizontal:at<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,qe.jsx)(U.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,qe.jsx)(Y.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${rl?(0,ze.dayLong)(al):'Today'}`})}),at<600?null:(0,qe.jsx)(U.default,{style:{minWidth:180}})]}),ml?jl:(0,qe.jsx)(U.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(be.Timeline,{hideNow:!0,fit:!0,plan:_l,bookings:rl?ul:Us,now:rl?bl:St,privacy:Et,turnBase:jt.settings.turnMins,t0:rl?(0,ee.addMins)(bl,-bl.getMinutes()):sl,t1:rl?(0,ee.addMins)(yl,30):ll,pauses:rl?fl:nl,blockedTables:Gl,onOpen:e=>{if(Kt(!1),rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},`full-${al}`)})]})}):null,yi=rl?(0,qe.jsxs)(U.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:cl?`Showing ${dl} \xb7 ${(0,ee.niceDate)((0,ee.parseYmd)(al))}`:`Showing ${(0,ze.dayWord)(al,Ht)}`}),(0,qe.jsx)(U.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Pl}. Showing ${(0,ze.dayLong)(al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Y.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ms(null),vs(null)},style:{minHeight:44}})]}):null,pi=(0,qe.jsx)(U.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:ct?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(gi||Ut);return(0,qe.jsx)(F.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?(Vt('plan'),Kt(!0)):(Kt(!1),Vt('plan'))},style:{flex:ct?1:void 0,minHeight:ct?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',...Ne.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)(Y.T,{size:ct?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),fi='display'===I.APP_VARIANT&&!e,xi='display'===I.APP_VARIANT&&!e,mi=!e&&!I.IS_CAR&&!ct,ji=fi?(0,qe.jsxs)(U.default,{testID:"display-view-row",style:{flexDirection:ct?'column':'row',flexWrap:ct||mi?'nowrap':'wrap',gap:6,alignItems:ct||mi?'stretch':'center'},children:[pi,(0,qe.jsx)(k.DisplayRotaKitchenButtons,{phone:ct,fill:mi,shifts:Rt,staff:Ct,today:Ht,leave:$t})]}):pi,wi=(0,h.useBookingWrite)(),ki=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Walk-in",onPress:Mt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"New booking",onPress:Mt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint})]});(0,Ke.useDisplayNotices)(mt,!e);const Ii=!e&&!I.IS_CAR&&!ct,Di=ct?180:202,[vi,Si]=(0,H.useState)(ct?180:168),Ci=P.default.useRef(ct?180:168),Ti=P.default.useRef(null),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(!1),[Wi,Li]=(0,H.useState)(!1),zi=!ct&&dt<=800,Hi=We.DAY_GRAPH_CHROME+(zi?24:8),Pi=P.default.useRef(0),[Mi,Ai]=(0,H.useState)(Hi),[Ei,Oi]=(0,H.useState)(!0),[Ni,Gi]=(0,H.useState)(!1);P.default.useEffect(()=>{Gi(!1)},[at,dt]);const Fi=P.default.useRef(()=>{}),Vi=P.default.useCallback(e=>{Math.abs(e-Pi.current)>=2&&(Pi.current=e,setTimeout(()=>Fi.current(),0))},[]),Ui=()=>{const e=Ti.current,t=Ri.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=t>Ci.current?Math.ceil(t-Ci.current):0,o=Ii?Math.max(Hi,Pi.current):Math.max(Hi,n);Ii&&o!==Mi&&Ai(o);const a=!ct&&dt>=700?140:70,r=Math.floor(s-4-e)-o-l,d=i>0&&r-i>=a;Ii&&d!==Ei&&Oi(d),Ii&&!Ni&&r<48&&Gi(!0);const c=r-(d?i:0),u=Math.min(Di,c>=a?Math.max(a,c):Math.max(0,c));Math.abs(Ci.current-u)>=2&&(Ci.current=u,Si(u))},l=44+(dt<820?4:8),i=46+(dt<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=$i.current;Ii&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=dt<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Bi.current?44+d:0)}):s(n,a,t,Ii?i:l)})})};Fi.current=Ui,P.default.useEffect(()=>{const e=setTimeout(()=>Fi.current(),60),t=setTimeout(()=>Fi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[at,dt,al]);const Ki=(0,qe.jsxs)(U.default,{ref:Ri,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ui()},style:{flexDirection:'row',flexWrap:at>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ct?12:zi?2:6,justifyContent:ct?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ue.DisplayClockButton,{}),(0,qe.jsx)(ge.HoldToEdit,{quiet:!0,onUnlock:()=>{Fs(null),Ns({at:Date.now()})},onHint:()=>Es('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(Be.BlockBookingsButton,{rid:mt,r:jt,now:St,by:Lt,quiet:!0,display:!0,day:al}),Nt.areas.some(e=>e.outdoor)?(0,qe.jsx)(Be.CloseGardenButton,{rid:mt,r:jt,now:St,by:Lt,quiet:!0,short:!0}):null,(0,qe.jsx)(F.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Hs(!0),style:({pressed:e})=>({...Ne.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,qe.jsx)(f.GiftQrButton,{rid:mt,venue:jt.name})]}),qi=qs.length?(0,qe.jsxs)(U.default,{testID:"takeaway-panel",style:[Ne.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Y.T,{size:12,colour:se.colours.muted,children:[qs.length," live"]})]}),(0,qe.jsx)(U.default,{style:{padding:10},children:(0,qe.jsx)(ot,{list:qs,me:Lt,compact:!0,bookings:kt})})]}):null,Yi=(Ee.DueToday,jt.settings.turnMins||90),Qi=rl?ul:(0,v.todaysGuestList)(Us,St,Yi),Ji=rl?[]:(0,v.todaysFinishedList)(Us,St,Yi),Xi=rl?cl?`${dl}\u2019s guests`:`Guests ${dl}`:'Today\u2019s guests',Zi=(0,qe.jsxs)(qe.Fragment,{children:[0===Qi.length?(0,qe.jsx)(Y.Muted,{children:rl?al{const t=(0,v.isLeftEarly)(e,St,Yi),s=(0,le.isSeatedHighlight)(e.status,{otherDay:rl})&&!t,l=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=se.colours.text,n=s?se.colours.goldLight:se.colours.muted,o=se.colours.gold,a=l.depositWarn?se.colours.amber:se.colours.goldLight;return(0,qe.jsxs)(F.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:rl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,le.seatedHighlightStyle)({backgroundColor:e?Qe:Ye,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,qe.jsx)(Y.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)(U.default,{style:{paddingTop:2},children:(0,qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,qe.jsxs)(Y.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Y.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}),(0,qe.jsx)(Y.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,qe.jsx)(Y.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(U.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(me.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,qe.jsx)(Y.T,{size:15,colour:se.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),Ji.length?(0,qe.jsxs)(U.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(F.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ji.length}${bs?', expanded':', collapsed'}`,accessibilityState:{expanded:bs},onPress:()=>ys(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Y.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ji.length,")"]}),(0,qe.jsx)(Y.T,{size:16,colour:se.colours.muted,children:bs?'\u25be':'\u25b8'})]}),bs?Ji.map(e=>{const t=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,qe.jsxs)(F.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Y.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Y.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,qe.jsx)(U.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,qe.jsx)(S.BookingUndo,{b:e,rid:mt,today:Ht,who:t.name,allowed:wi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ae.CancellationsSection,{items:Hl,dayWord:rl?cl?dl.toLowerCase():`on ${dl}`:'today'})]}),en=(0,qe.jsx)(V.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Zi}),tn=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&gs(!1)}}),sn=(0,qe.jsxs)(F.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Xi}, ${Qi.length}`,accessibilityState:{expanded:hs},'aria-expanded':hs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>gs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:hs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:hs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Y.T,{size:16,weight:"bold",colour:se.colours.gold,children:Qi.length}),(0,qe.jsx)(U.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(U.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,qe.jsxs)(Y.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Xi," ",hs?'\u2039':'\u203a']})})})]}),ln=hs?(0,qe.jsxs)(U.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,qe.jsxs)(U.default,{testID:"guests-drawer",...tn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*at)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,...Ne.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,qe.jsxs)(U.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Xi.toUpperCase()," (",Qi.length,")"]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Xi}`,onPress:()=>gs(!1),style:{marginRight:-6}})]}),zl.count?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Pl}):null,(0,qe.jsx)(U.default,{testID:"guests-tools",style:{flexDirection:'row',gap:8,marginTop:6,justifyContent:'center'},children:(0,qe.jsx)(F.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:cs},'aria-expanded':cs,onPress:()=>us(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:14,borderRadius:12,borderWidth:1,borderColor:cs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',backgroundColor:e?se.colours.tilePressed:cs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:se.colours.goldLight,children:["Guest key ",cs?'\u25b4':'\u25be']})})}),cs?(0,qe.jsx)(U.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: warning sign allergy, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:6},children:[['\u26a0','allergy'],['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(Y.T,{size:16,children:e}),(0,qe.jsx)(Y.T,{size:14,children:t})]},t))}):null]}),en]}),(0,qe.jsx)(F.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Xi}`,accessibilityRole:"button",onPress:()=>gs(!1),style:{flex:1}})]}):null,nn=ml?jl:l.IS_KIRKTON&&!Object.values(jt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(U.default,{testID:"kirkton-hours-to-confirm",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Y.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(jt,kt,St).busy,todays:ul,open:bl,close:yl,now:St,turnBase:jt.settings.turnMins,blocks:Ml,pauses:fl,compact:ct,dense:!ct,fit:ht,tight:ht&&dt<=600,height:ht?vi:Di,forecastNote:rl?void 0:Ql,emptyText:wl,past:al{Ds.current=Date.now(),Is(!0)},shortDay:!ct&&at<1100}),rn=(0,qe.jsx)(He.DisplayCalendar,{visible:ks,today:Ht,day:al,bookings:kt,restaurant:jt,now:St,onDay:vs,onClose:()=>Is(!1)}),dn=()=>{rl?gs(!0):Kt(!0)},cn=(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',padding:zi?4:dt<820?8:12,paddingTop:zi?Ii?2:4:dt<820?Ii?4:6:Ii?8:10,gap:zi?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:yi,Pt?(0,qe.jsx)(V.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"})}):gi?hi:ui,bi,ln]}),(0,qe.jsxs)(U.default,{testID:"display-side",style:{width:bt,gap:dt<820?4:8,minHeight:0},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ki(!1)}),(0,qe.jsx)(U.default,{style:{flexShrink:0},children:ji}),Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",onLayout:Ui,style:Ii&&!Ni?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:dt<820,snug:dt<820,tight:dt<800,fill:Ii&&!Ni,sound:(0,E.flapSoundOn)(),onPress:dn})}),Pt?null:(0,qe.jsx)(U.default,{ref:Ti,testID:"day-graph-slot",onLayout:Ui,style:{flexGrow:0,flexShrink:Ii?0:1,flexBasis:(ct?Di:vi)+(Ii?Mi:Hi),height:(ct?Di:vi)+(Ii?Mi:Hi),minHeight:dt<=600?90:Math.min((ct?Di:vi)+We.DAY_GRAPH_CHROME,!ct&&dt>=768?140+We.DAY_GRAPH_CHROME:120),overflow:'visible'},children:on}),Ii&&!Pt?(0,qe.jsx)(U.default,{ref:$i,testID:"display-side-split",onLayout:Ui,style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})}):null,(0,qe.jsxs)(V.default,{testID:"display-side-scroll",style:Ii?{flexGrow:0,flexShrink:1,minHeight:Wi&&Ei?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Bi.current&&(Bi.current=s,Li(s),setTimeout(Ui,0))},children:[Ii||xi?null:(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),qi,(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt})]})]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Ds.current=Date.now()},onMouseDown:()=>{Ds.current=Date.now()},children:[ct?(0,qe.jsx)(U.default,{style:{flex:1},children:(0,qe.jsxs)(V.default,{ref:yt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,qe.jsxs)(U.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,qe.jsx)(U.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,qe.jsx)(j.ExitButton,{})}),(0,qe.jsx)(X.RestaurantLogo,{rid:mt,size:64}),(0,qe.jsx)(Y.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:jt.name}),(0,qe.jsx)(X.PoweredBy,{}),(0,qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(U.default,{accessible:!0,accessibilityLabel:`Current time ${(0,ee.hm)(St)}`,children:(0,qe.jsx)(Y.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,ee.hm)(St)})}),(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:"m"}),(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",size:"m"}),Z]}),Fe,I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(ke.BookingSaveBanner,{rid:mt}),an,(0,qe.jsx)(U.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(it,{phone:!0,split:Ll,items:[{label:`Tables \xb7 ${dl}`,value:Bl.length,testID:'badge-tables'},{label:`Covers \xb7 ${dl}`,value:Wl,testID:'badge-covers'},{label:'Takeaway',value:qs.length,alert:qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ls(!0)}]})}),(0,qe.jsx)(U.default,{testID:"primary-actions",style:{gap:8},children:ki(!0)}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt}),ji,(0,qe.jsxs)(U.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[gi?hi:ui,bi]}),(0,qe.jsxs)(U.default,{onLayout:e=>{pt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ne.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Y.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Xi," (",Qi.length,")"]}),(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{gap:4},children:Zi})]}),qi,on,(0,qe.jsx)(U.default,{testID:"covers-dock",children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>yt.current?.scrollTo({y:pt.current,animated:!0})})}),(0,qe.jsxs)(U.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,qe.jsx)(Y.T,{center:!0,size:14,colour:Et?se.colours.muted:se.colours.amber,children:Et?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Y.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Rs(!0),style:{minHeight:48,alignSelf:'stretch'}}),xi?null:(0,qe.jsx)(Y.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ki]})}):(0,qe.jsxs)(qe.Fragment,{children:[Ii?(0,qe.jsx)(U.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:se.colours.hairline},children:(0,qe.jsx)(U.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)(U.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,paddingVertical:zi?2:dt<820?4:8,gap:8,minHeight:zi&&Ii?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ne.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(U.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:Ii?16:8,minWidth:0,overflow:'hidden',...Ii?{justifyContent:'flex-start'}:null},children:[(0,qe.jsx)(U.default,{testID:"display-header-brand",style:Ii?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(X.RestaurantBrand,{rid:jt.id,size:at<900?32:40,beside:!0,noLogo:Ii})}),(0,qe.jsxs)(U.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Y.T,{size:at<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,ee.hm)(St)}),at>=900?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:(0,ee.niceDate)(St)}):null]})]}),Pt?(0,qe.jsx)(U.default,{style:{width:220}}):(0,qe.jsx)(U.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:an}),(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,qe.jsxs)(U.default,{testID:"display-header-chips",style:{flexDirection:at>=1400||Ii?'row':'column',alignItems:at>=1400||Ii?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:at<1240?'xs':at<1280||dt<700?'s':'m'}),Pt?null:(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",slot:Ii,size:at<1340?'xs':at<1400||dt<700?'s':'m'})]}),'simulated'===vt?(0,qe.jsx)(F.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>Dt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,Z,e?null:(0,qe.jsx)(U.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(j.ExitButton,{size:44})})]})]}),Fe,I.IS_CAR||!Pt||Ii?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(ke.BookingSaveBanner,{rid:mt,margin:{marginHorizontal:12,marginTop:6}}),Pt||Ii?null:(0,qe.jsx)(U.default,{testID:"display-day-stats",style:Xe,children:(0,qe.jsxs)(U.default,{style:Ze,children:[I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(U.default,{style:et,children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})})]})}),ht?cn:(un=(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{testID:"front-door-bar",style:{gap:10},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ki(!1)}),ji]}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt}),Pt?(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"}):(0,qe.jsx)(qe.Fragment,{children:(0,qe.jsxs)(U.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[yi,gi?hi:ui,bi,ln]})]})}),qi,Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,sound:(0,E.flapSoundOn)(),onPress:dn})}),Pt?null:(0,qe.jsx)(U.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Di+We.DAY_GRAPH_CHROME},children:on})]}),(0,qe.jsx)(V.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:un})),Ki]}),(0,qe.jsx)($.SoldOutStrip,{rid:mt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:zs,onClose:()=>Hs(!1),rid:mt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:mt}),Mt.elements,is?(0,qe.jsx)(y.EditBookingPicker,{rid:mt,today:Ht,who:Lt,onClose:()=>ns(!1)}):null,os?(0,qe.jsx)(y.EditBookingSheet,{rid:mt,id:os,who:Lt,onClose:()=>as(null)}):null,Qt?(0,qe.jsx)(ve.TableSheet,{rid:mt,name:Qt,view:Xs,plan:Nt,todays:Us,now:St,privacy:Et,turnBase:jt.settings.turnMins,onClose:()=>Jt(null),onWalkIn:e=>Mt.openWalkInAt(e),onMove:e=>Zt(e),onDetails:Vs}):null,Il?(()=>{const e=kl[Il],t=e?.dayBookings??[];return(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>{$l(null),Dl(null)},title:`${(0,d.tableNumbersA11y)(Il)} \xb7 ${cl?dl:(0,ze.dayLong)(al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Y.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${cl?dl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${cl?dl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Et):tt(e.name);return(0,qe.jsx)(Y.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,Ie.tablesWords)((0,ae.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Dl(null),fs(e.id)},style:{minHeight:56}},e.id)}),al>=Ht?(()=>{const t=e?.table.maxSeats??0,s=kt.filter(e=>e.date===al&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,ae.tablesOf)(e.table).includes(Il)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,qe.jsxs)(U.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(Il)]}),Rl?(0,qe.jsxs)(U.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Rl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Rl.ask}),(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!wi.ok,accessibilityHint:wi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=kt.find(e=>e.id===Rl.id);if($l(null),!e)return;const s=tt(e.name);Dl(null),await(0,ke.saveTablesReported)(mt,e,[Il],s,t,Es)}}),(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>$l(null)})]})]}):null,Rl?null:s.slice(0,12).map(e=>{const s=tt(e.name),l=e.partySize>t;return(0,qe.jsx)(Y.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:!wi.ok,accessibilityHint:wi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(Il)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,ke.guardBookingChange)(Es,{b:e,tables:[Il]}))return;const l=(0,Ie.overCapacityAsk)([Il],t,e.partySize);l?$l({id:e.id,ask:l}):(Dl(null),await(0,ke.saveTablesReported)(mt,e,[Il],s,t,Es))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Y.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{$l(null),Dl(null)},style:{minHeight:56}})]})})():null,ps?(()=>{const e=kt.find(e=>e.id===ps);return e?(0,qe.jsx)(je.GuestActionsSheet,{rid:mt,b:e,name:e.walkIn?(0,fe.privName)(e,Et):tt(e.name),view:Xs,now:St,otherDay:e.date!==Ht,turnBase:jt.settings.turnMins,onClose:()=>fs(null),onDetails:Vs,onDone:Es,onEdit:e=>{fs(null),as(e.id)},onPickOnPlan:(e,t)=>{gs(!1),Vt('plan'),Yt('all'),ms({id:e.id,tables:t})}}):null})():null,es?(0,qe.jsx)(ve.DetailsPanel,{title:es.title,onClose:()=>ts(null),children:es.body}):null,rn,rs?(0,qe.jsx)(ve.ServiceSummary,{r:jt,todays:Us,orders:wt,waitlistAll:Ss,walkInCount:Cs,onClose:()=>ds(!1)}):null,Ts?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Rs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsx)(Y.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Rs(!1)})]}):null,Ws?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ls(!1),Bs(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,$s?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(Q.ReviewsSection,{rid:mt,mode:"read",venueName:jt.name}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,ss?(0,qe.jsxs)(ve.DetailsPanel,{title:"Takeaway",onClose:()=>ls(!1),children:[(0,qe.jsx)(Y.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(ot,{list:qs,me:Lt,bookings:kt})]}):null,Os?(0,qe.jsx)(U.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,qe.jsx)(he.PlanDesigner,{initial:Nt,venue:jt.name,mode:"display",startStep:"arrange",onActivity:()=>{_s.current=Date.now(),null!==Gs&&Fs(null)},notice:null!==Gs?`Locking again in ${Gs} s \xb7 touch to keep editing`:null,onSave:e=>{ae.useFloor.getState().setPlan(mt,e),Ns(null),Es('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{ae.useFloor.getState().setPlan(mt,e),Es('Live seating plan updated on every screen.')},onCancel:()=>{Ns(null),Es('No changes kept. Editing is locked again.')}},Os.at)}):null,e?null:(0,qe.jsx)(ye.Screensaver,{rid:mt,idleMins:At.idleMins,pinOn:At.pinOn,wake:At,tonightCards:At.tonightCards,cfg:Ot}),e?null:(0,qe.jsx)(Ce.PrintHost,{rid:mt}),e?null:(0,qe.jsx)(Se.AlertHost,{variant:"display",rid:mt,skipTakeaway:!0}),e?null:(0,qe.jsx)(O.SeatAllergenReminder,{rid:mt}),e?null:(0,qe.jsx)(Te.TakeawayTakeover,{rid:mt,me:Lt})]});var un}function rt({rid:e,id:t,turnBase:s}){const l=(0,te.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1336,[1051,779,805,806,1337,813,1338,1092,843,1138,1339,1340,1341,1089,1119,1342,1343,1348,1349,1206,1350,856,1355,1356,1357,1112,1111,920,1358,1150,891,1102,1359,17,1070,1182,1016,1085,1360,378,363,385,278,85,409,19,777,1237,1241,857,845,863,858,804,1088,876,1096,1055,996,1074,1107,1361,1106,1362,1369,1371,1374,1379,1373,1380,1383,1384,1114,1093,1094,862,1389,1226,1390,1236,1228,993,1395,1400,1401,1052,1050,1116,1403,1404,1405,1069,1169,1406,1168,1159,853,1351,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 Je}}),_e2.DisplayBoard=function(e={}){const t=(0,ie.useOwner)(e=>e.site);return(0,te.useRestaurant)(t)?(0,qe.jsx)(at,{...e}):(0,qe.jsx)(U.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Y.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]),S=_r(_d[23]),v=_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=_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]),Se=_r(_d[76]),ve=_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]);const Ye='#221C12',Qe='#2E2618',Je=12e4,Xe={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},Ze={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},et={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},tt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),lt=e=>e.slotTime?(0,ee.hm)(new Date(e.slotTime)):'ASAP';function it({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,qe.jsxs)(U.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)(U.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)(U.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)(Y.T,{size:s?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,qe.jsx)(Y.T,{size:s?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,qe.jsx)(F.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)(U.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)(Y.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,qe.jsxs)(U.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,qe.jsx)(U.default,{style:{width:`${l.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,qe.jsx)(U.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,qe.jsxs)(F.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)(U.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,qe.jsx)(Y.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Y.T,{size:12,colour:se.colours.muted,children:s}):null]})}function ot({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ve.statusBlock)(e,t,(0,Ve.linkedBooking)(e,l));return e.length?(0,qe.jsx)(U.default,{style:{gap:8},children:e.map(e=>(0,qe.jsxs)(U.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:s?16:18,weight:"bold",children:[lt(e)," \xb7 ",tt(e.customerName)]}),(0,qe.jsx)(Y.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)(Y.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)(Y.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,Z.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Fe.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Y.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Y.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>te.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Y.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Y.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Ce.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Y.Muted,{children:"No takeaway orders right now."})}function at({embedded:e=!1,boardW:b,headerExtra:Z,subHeader:Fe,noVoice:Ve=!1}={}){const lt=(0,K.default)(),at=b??lt.width,dt=lt.height,ct=at<700,ut=at>=dt,ht=!ct&&ut&&at>=600,gt=ht,bt=Math.round(Math.min(520,Math.max(at>=1e3?448:280,.3*at))),yt=P.default.useRef(null),pt=P.default.useRef(0),[ft,xt]=(0,H.useState)({w:0,h:0}),mt=(0,ie.useOwner)(e=>e.site),jt=(0,te.useRestaurant)(mt);(0,Re.useAlertWatcher)(mt,{enabled:!e});const wt=(0,te.useOrders)(mt),It=(0,te.useBookings)(mt),kt=(0,te.useEvents)(mt),Dt=(0,te.useStore)(e=>e.skipMinutes),St=(0,te.useStore)(e=>e.clock.mode),vt=(0,te.useNow)(5e3),Ct=(0,ie.useOwner)(e=>e.staff),Tt=(0,ie.useOwner)(e=>e.attendance),Rt=(0,ie.useOwner)(e=>e.shifts),$t=(0,ie.useOwner)(e=>e.leave),Bt=P.default.useMemo(()=>(0,Ee.workingShifts)(Rt,$t),[Rt,$t]);P.default.useEffect(()=>{(0,oe.ensureAttendance)((0,ee.ymd)(vt),vt)},[(0,ee.ymd)(vt)]);const Wt=(0,R.useSession)(e=>e.meId),Lt=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:tt(Ct.find(e=>e.id===Wt)?.name)}),zt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Ht=(0,ee.ymd)(vt),Pt=(0,A.useTravelDay)('display',Ht),Mt=(0,ne.useFrontDoor)(Ht,ut),At=(0,ae.useDisplaySettings)(mt),Ot=At.privacy,Et=(0,pe.useSaverSync)(),Nt=(0,ae.usePlan)(mt),_t=(0,ae.useFloor)(e=>e.live[mt]),Gt=(0,$e.useBlocks)(e=>e.blocks),[Ft,Vt]=(0,H.useState)('plan'),[Ut,Kt]=(0,H.useState)(!1),[qt,Yt]=(0,H.useState)('all'),[Qt,Jt]=(0,H.useState)(null),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(!1),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(null),[rs,ds]=(0,H.useState)(!1),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(null),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(!1),Ds=P.default.useRef(0),Ss=e=>{Ds.current=Date.now(),ws(e)};P.default.useEffect(()=>{if(!js)return;const e=setInterval(()=>{Date.now()-Ds.current>=ze.DAY_IDLE_MS&&ws(null)},5e3);return()=>clearInterval(e)},[js]);const vs=(0,te.useWaitlist)(mt),Cs=(0,te.useStore)(e=>e.walkIns[mt]??0),[Ts,Rs]=(0,H.useState)(!1),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1);(0,J.useReviewAlerts)(mt);const[Ps,Ms]=(0,H.useState)({view:0,content:0}),[As,Os]=(0,H.useState)(null);P.default.useEffect(()=>{As&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:As,timeoutMs:4500,big:!0,testID:'floor-toast'}),Os(null))},[As]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[Es,Ns]=(0,H.useState)(null),_s=P.default.useRef(0),[Gs,Fs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Es)return;_s.current=Date.now();const e=setInterval(()=>{const e=Date.now()-_s.current;if(e>=Je)return Ns(null),void Os('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Fs(e>=105e3?Math.ceil((Je-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Es]);const Vs=e=>e.date!==Ht?ts({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Ht)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Ht?(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Ht)}, ${e.time}`,disabled:!wi.ok,accessibilityHint:wi.hint,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ts({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(rt,{rid:mt,id:e.id,turnBase:jt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(we.CancelWalkInButton,{rid:mt,b:e,big:!0,onDone:e=>{ts(null),Os(e)}}):null,e.walkIn?(0,qe.jsx)(we.ReinstateWalkInButton,{rid:mt,b:e,today:Ht,onDone:e=>{ts(null),Os(e)}}):null,(0,Se.bookingDetails)(e)]})}),Us=It.filter(e=>e.date===Ht).sort((e,t)=>e.time.localeCompare(t.time)),Ks=Us.filter(e=>!['cancelled','noshow'].includes(e.status)),qs=wt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,H.useMemo)(()=>(0,c.forecastToday)(jt,It,wt,kt,vt),[jt,It,wt,kt,vt.getTime()/6e4|0]),Qs=(0,$e.closedAreasAt)(Gt,mt,Ht,(0,ee.hm)(vt)),Js=[...Qs].join(','),Xs=(0,H.useMemo)(()=>(0,re.floorView)(Nt,It,wt,_t??{},vt,jt.settings.turnMins,Qs),[Nt,It,wt,_t,vt.getTime(),Js]),Zs=(0,De.hoursFor)(jt,vt),el=Zs?.open??new Date(`${Ht}T12:00:00`),tl=Zs?.close??new Date(`${Ht}T21:00:00`),sl=(0,ee.addMins)(el,-el.getMinutes()),ll=(0,ee.addMins)(tl,30),il=e=>new Date(`${Ht}T${e}:00`),nl=(0,$e.blocksOn)(Gt,mt,Ht).map(e=>({from:il(e.from),to:il(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(jt,vt,Ht)),ol=Object.keys(Xs).filter(e=>'blocked'===Xs[e]?.status),al=js&&js!==Ht?js:Ht,rl=al!==Ht,dl=(0,ze.dayWord)(al,Ht),cl=/^(Today|Yesterday|Tomorrow)$/.test(dl),ul=rl?(0,ze.bookingsForDay)(It,al,Ht).sort((e,t)=>e.time.localeCompare(t.time)):Us,hl=(0,ee.parseYmd)(al);hl.setHours(12);const gl=rl?(0,De.hoursFor)(jt,hl):Zs,bl=gl?.open??new Date(`${al}T12:00:00`),yl=gl?.close??new Date(`${al}T21:00:00`),pl=e=>new Date(`${al}T${e}:00`),fl=[...rl?(0,$e.blocksOn)(Gt,mt,al).map(e=>({from:pl(e.from),to:pl(e.to),label:e.reason??'Paused'})):nl,...rl?(0,n.queuedServicePauses)(jt,hl,al):[]],xl=(0,n.queuedServiceSessions)(jt,hl),ml=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),jl=(0,qe.jsxs)(U.default,{testID:"queued-hours-gate",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Y.Muted,{children:i.queuedVenues[mt]?.hours.note})]}),wl=rl?gl||ul.length?alrl?(0,re.dayFloorView)(Nt,ul,al):Xs,[rl,Nt,ul,al,Xs]),[kl,Dl]=(0,H.useState)(null),[Sl,vl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(!1),[Rl,$l]=(0,H.useState)(null),Bl=rl?ul.filter(e=>!['cancelled','noshow'].includes(e.status)):Ks,Wl=Bl.reduce((e,t)=>e+t.partySize,0),Ll=(0,u.coversSplit)(Bl,al),zl=(0,Pe.cancelledDayTally)(It,al),Hl=(0,Me.cancellationsFor)(It,al,e=>e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)','')),Pl=(0,Pe.cancelledTallyWords)(zl,cl?dl.toLowerCase():rl?`on ${dl}`:'today'),Ml=Gt.filter(e=>e.rid===mt&&e.date===al&&!e.removedAt),Al=60*bl.getHours()+bl.getMinutes(),Ol=60*yl.getHours()+yl.getMinutes(),El=(0,Le.chartBands)(Ml,Al,Ol),Nl=(0,Le.seasonClosedAreaIds)(Ml,Al,Ol),_l=Nl.size?{...Nt,areas:Nt.areas.filter(e=>!Nl.has(e.id)),tables:Nt.tables.filter(e=>!Nl.has(e.areaId))}:Nt,Gl=rl?[]:ol.filter(e=>!Nl.has(Nt.tables.find(t=>t.name===e)?.areaId??'')),Fl=new Set((0,Le.blockedHours)(El)),Vl=vt.getHours()+(vt.getMinutes()>=30?1:0),Ul=Ys.hours.filter(e=>e.hour>=Vl&&!Fl.has(e.hour)),Kl=Ul.reduce((e,t)=>e+t.coversHigh,0),ql=Ul.reduce((e,t)=>e+t.coversLow,0),Yl=Math.round((ql+Kl)/2),Ql=!Ys.example&&Ys.open&&Ys.enough&&Kl>0?`Usually ${(0,c.coversRange)(Yl,Yl)} more`:void 0,Jl=async(e,t)=>{const s=Xs[e]?.booking;if(!s||e===t)return;const l=Xs[t]?.status;if(l&&!['free','soon'].includes(l))return void Os('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${re.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(Os,{b:s,tables:[t]}))return;await te.repo.bookings.update(s.id,{table:t});const i=_t?.[e]?.stage;ae.useFloor.getState().setLive(mt,t,{stage:i??'seated',dirty:!1}),ae.useFloor.getState().setLive(mt,e,{stage:void 0,dirty:!0}),Os(`Saving: ${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(s.id,`${(0,fe.privName)(s,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}`,Os)},Xl=e=>{if(xs)return vl(null),void ms(t=>t?{...t,tables:(0,ke.toggleTable)(t.tables,e)}:t);rl?Dl(e):Xt?(e!==Xt&&Jl(Xt,e),Zt(null)):Jt(e)},Zl=xs?It.find(e=>e.id===xs.id):void 0,ei=xs&&Zl?(()=>{const e=Zl.walkIn?(0,fe.privName)(Zl,Ot):tt(Zl.name),t=(0,ke.seatsOf)(Nt,xs.tables).total,s=(0,ke.seatLine)(t,Zl.partySize),l=(0,ke.pickClashes)(Zl,xs.tables,It.filter(e=>e.date===Zl.date),jt.settings.turnMins),i=(0,ke.tableKey)(xs.tables)!==(0,ke.tableKey)((0,ae.tablesOf)(Zl.table));return(0,qe.jsxs)(U.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,qe.jsxs)(U.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Zl.date,Ht)} ${Zl.time}. Tap tables on the plan to add or take them off. ${(0,ke.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Zl.date,Ht)," ",Zl.time]}),(0,qe.jsxs)(Y.T,{size:16,colour:se.colours.text,children:[(0,ke.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Sl?(0,qe.jsx)(U.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Sl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,qe.jsx)(Y.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Sl})}):null,Cl&&Zl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Tl(!1),(async()=>{if(!(0,Ie.guardBookingChange)(Os,{b:Zl,tables:xs.tables}))return vl(null),void ms(null);const s=xs.tables;ms(null),await(0,Ie.saveTablesReported)(mt,Zl,s,e,t,Os)})()},onNo:()=>Tl(!1)}):null,(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.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,ke.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Zl)return void ms(null);if(!(0,Ie.guardBookingChange)(Os,{b:Zl,tables:xs.tables}))return vl(null),void ms(null);const s=(0,ke.overCapacityAsk)(xs.tables,t,Zl.partySize);if(s&&!Sl)return void vl(s);if('finished'===Zl.status&&xs.tables.length&&!Cl)return void Tl(!0);vl(null),Tl(!1);const l=xs.tables;ms(null),await(0,Ie.saveTablesReported)(mt,Zl,l,e,t,Os)}}),(0,qe.jsx)(Y.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{vl(null),ms(null)}})]})]})})():null,ti=_l.areas.filter(e=>_l.tables.some(t=>t.areaId===e.id)),si=e=>{const t=Nt.tables.filter(t=>t.areaId===e);return rl?`${t.filter(e=>!Il[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Xs[e.name]?.status??'free')).length}/${t.length} free`},li='all'===qt||ti.some(e=>e.id===qt)?qt:'all',ii=e=>(0,qe.jsx)(de.FloorCanvas,{plan:_l,areaId:e,mode:"live",fit:"contain",crop:!0,fill:ht,big:!0,view:Il,privacy:Ot,turnBase:jt.settings.turnMins,highlight:xs?xs.tables:Xt?[Xt]:void 0,onTap:e=>Xl(e.name),onDrop:(e,t)=>xs||rl?void 0:Jl(e.name,t.name)}),ni=ct?1:ut||ti.length>2?2:1,oi=e=>{const t=Nt.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},ai=[];for(let e=0;e{const t=(0,de.areaBounds)(Nt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,de.minReadableScale)(Nt,e.id)}}),ft.w,ft.h):null,di=e=>(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',height:ce.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:si(e.id)})]}),ci=(0,qe.jsx)(U.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-ft.w)>1||Math.abs(s-ft.h)>1)&&xt({w:t,h:s})},children:ri?(0,qe.jsx)(V.default,{style:{flex:1},scrollEnabled:ri.scroll,showsVerticalScrollIndicator:ri.scroll,contentContainerStyle:{gap:ce.GRID_GAP},children:ri.rows.map((e,t)=>(0,qe.jsx)(U.default,{style:{height:ri.rowHeights[t],flexDirection:'row',gap:ce.GRID_GAP},children:e.map(e=>{const t=ti.find(t=>t.id===e);return(0,qe.jsxs)(U.default,{testID:`area-cell-${e}`,style:{width:ri.cellW,gap:2},children:[di(t),(0,qe.jsx)(U.default,{style:{flex:1},children:ii(e)})]},e)})},t))}):null}),ui=(0,qe.jsxs)(U.default,{testID:"venue-plan",style:{flex:ct?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:Nt}),Nt.tables.length?null:(0,qe.jsxs)(U.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,qe.jsx)(Y.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Y.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)(Y.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,qe.jsx)(nt,{chipId:"all",compact:!ct,label:"Whole venue",selected:'all'===li,onPress:()=>Yt('all')},"__all"),...ti.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ct,label:`${e.name}${(0,ue.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ct?Qs.has(e.id)?'closed':li===e.id?si(e.id):void 0:void 0,selected:li===e.id,onPress:()=>Yt(e.id)},e.id))];return ct?(0,qe.jsx)(U.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,qe.jsx)(V.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:Ps.view>0&&Ps.content>0&&Ps.content<=Ps.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ps.view>0&&Ps.content<=Ps.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),ei,Xt?(0,qe.jsxs)(Y.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Y.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Xt),": tap the new table."]}),(0,qe.jsx)(Y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Zt(null)})]}):null,'all'===li&&ht?ci:'all'===li?(0,qe.jsx)(U.default,{style:{flex:ct?void 0:1,gap:12,minHeight:gt?void 0:360},children:ai.map((e,t)=>(0,qe.jsxs)(U.default,{style:{flex:ct?void 0:Math.max(.3,...e.map(e=>oi(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(U.default,{style:{flex:1,gap:2},children:[ct?(0,qe.jsxs)(U.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Y.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{center:!0,children:si(e.id)})]}):(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{children:si(e.id)})]}),(0,qe.jsx)(U.default,{style:ct?{height:Math.max(280,Math.round((at-40)*oi(e.id)))}:{flex:1},children:ii(e.id)})]},e.id)),e.length{if(rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},al)}),gi='timeline'===Ft,bi=Ut?(0,qe.jsx)(_.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Kt(!1),supportedOrientations:['landscape','portrait'],children:(0,qe.jsxs)(U.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,qe.jsx)(F.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Kt(!1),style:{minHeight:64,minWidth:at<600?120:180,paddingHorizontal:at<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,qe.jsx)(U.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,qe.jsx)(Y.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${rl?(0,ze.dayLong)(al):'Today'}`})}),at<600?null:(0,qe.jsx)(U.default,{style:{minWidth:180}})]}),ml?jl:(0,qe.jsx)(U.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(be.Timeline,{hideNow:!0,fit:!0,plan:_l,bookings:rl?ul:Us,now:rl?bl:vt,privacy:Ot,turnBase:jt.settings.turnMins,t0:rl?(0,ee.addMins)(bl,-bl.getMinutes()):sl,t1:rl?(0,ee.addMins)(yl,30):ll,pauses:rl?fl:nl,blockedTables:Gl,onOpen:e=>{if(Kt(!1),rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},`full-${al}`)})]})}):null,yi=rl?(0,qe.jsxs)(U.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:cl?`Showing ${dl} \xb7 ${(0,ee.niceDate)((0,ee.parseYmd)(al))}`:`Showing ${(0,ze.dayWord)(al,Ht)}`}),(0,qe.jsx)(U.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Pl}. Showing ${(0,ze.dayLong)(al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Y.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ms(null),Ss(null)},style:{minHeight:44}})]}):null,pi=(0,qe.jsx)(U.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:ct?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(gi||Ut);return(0,qe.jsx)(F.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?(Vt('plan'),Kt(!0)):(Kt(!1),Vt('plan'))},style:{flex:ct?1:void 0,minHeight:ct?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',...Ne.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)(Y.T,{size:ct?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),fi='display'===k.APP_VARIANT&&!e,xi='display'===k.APP_VARIANT&&!e,mi=!e&&!k.IS_CAR&&!ct,ji=fi?(0,qe.jsxs)(U.default,{testID:"display-view-row",style:{flexDirection:ct?'column':'row',flexWrap:ct||mi?'nowrap':'wrap',gap:6,alignItems:ct||mi?'stretch':'center'},children:[pi,(0,qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ct,fill:mi,shifts:Rt,staff:Ct,today:Ht,leave:$t})]}):pi,wi=(0,h.useBookingWrite)(),Ii=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Walk-in",onPress:Mt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"New booking",onPress:Mt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint})]});(0,Ke.useDisplayNotices)(mt,!e);const ki=!e&&!k.IS_CAR&&!ct,Di=ct?180:202,[Si,vi]=(0,H.useState)(ct?180:168),Ci=P.default.useRef(ct?180:168),Ti=P.default.useRef(null),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(!1),[Wi,Li]=(0,H.useState)(!1),zi=!ct&&dt<=800,Hi=We.DAY_GRAPH_CHROME+(zi?24:8),Pi=P.default.useRef(0),[Mi,Ai]=(0,H.useState)(Hi),[Oi,Ei]=(0,H.useState)(!0),[Ni,Gi]=(0,H.useState)(!1);P.default.useEffect(()=>{Gi(!1)},[at,dt]);const Fi=P.default.useRef(()=>{}),Vi=P.default.useCallback(e=>{Math.abs(e-Pi.current)>=2&&(Pi.current=e,setTimeout(()=>Fi.current(),0))},[]),Ui=()=>{const e=Ti.current,t=Ri.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=t>Ci.current?Math.ceil(t-Ci.current):0,o=ki?Math.max(Hi,Pi.current):Math.max(Hi,n);ki&&o!==Mi&&Ai(o);const a=!ct&&dt>=700?140:70,r=Math.floor(s-4-e)-o-l,d=i>0&&r-i>=a;ki&&d!==Oi&&Ei(d),ki&&!Ni&&r<48&&Gi(!0);const c=r-(d?i:0),u=Math.min(Di,c>=a?Math.max(a,c):Math.max(0,c));Math.abs(Ci.current-u)>=2&&(Ci.current=u,vi(u))},l=44+(dt<820?4:8),i=46+(dt<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=$i.current;ki&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=dt<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Bi.current?44+d:0)}):s(n,a,t,ki?i:l)})})};Fi.current=Ui,P.default.useEffect(()=>{const e=setTimeout(()=>Fi.current(),60),t=setTimeout(()=>Fi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[at,dt,al]);const Ki=(0,qe.jsxs)(U.default,{ref:Ri,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ui()},style:{flexDirection:'row',flexWrap:at>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ct?12:zi?2:6,justifyContent:ct?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ue.DisplayClockButton,{}),(0,qe.jsx)(ge.HoldToEdit,{quiet:!0,onUnlock:()=>{Fs(null),Ns({at:Date.now()})},onHint:()=>Os('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(Be.BlockBookingsButton,{rid:mt,r:jt,now:vt,by:Lt,quiet:!0,display:!0,day:al}),Nt.areas.some(e=>e.outdoor)?(0,qe.jsx)(Be.CloseGardenButton,{rid:mt,r:jt,now:vt,by:Lt,quiet:!0,short:!0}):null,(0,qe.jsx)(F.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Hs(!0),style:({pressed:e})=>({...Ne.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,qe.jsx)(f.GiftQrButton,{rid:mt,venue:jt.name})]}),qi=qs.length?(0,qe.jsxs)(U.default,{testID:"takeaway-panel",style:[Ne.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Y.T,{size:12,colour:se.colours.muted,children:[qs.length," live"]})]}),(0,qe.jsx)(U.default,{style:{padding:10},children:(0,qe.jsx)(ot,{list:qs,me:Lt,compact:!0,bookings:It})})]}):null,Yi=(Oe.DueToday,jt.settings.turnMins||90),Qi=rl?ul:(0,S.todaysGuestList)(Us,vt,Yi),Ji=rl?[]:(0,S.todaysFinishedList)(Us,vt,Yi),Xi=rl?cl?`${dl}\u2019s guests`:`Guests ${dl}`:'Today\u2019s guests',Zi=(0,qe.jsxs)(qe.Fragment,{children:[0===Qi.length?(0,qe.jsx)(Y.Muted,{children:rl?al{const t=(0,S.isLeftEarly)(e,vt,Yi),s=(0,le.isSeatedHighlight)(e.status,{otherDay:rl})&&!t,l=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=se.colours.text,n=s?se.colours.goldLight:se.colours.muted,o=se.colours.gold,a=l.depositWarn?se.colours.amber:se.colours.goldLight;return(0,qe.jsxs)(F.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:rl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,le.seatedHighlightStyle)({backgroundColor:e?Qe:Ye,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,qe.jsx)(Y.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)(U.default,{style:{paddingTop:2},children:(0,qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,qe.jsx)(Y.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,qe.jsx)(Y.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&re.OCCASION_ICON[l.occasion]?(0,qe.jsx)(Y.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:re.OCCASION_ICON[l.occasion]}):null]}),(0,qe.jsxs)(Y.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Y.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}),(0,qe.jsx)(Y.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,qe.jsx)(Y.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(U.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(me.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,qe.jsx)(Y.T,{size:15,colour:se.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),Ji.length?(0,qe.jsxs)(U.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(F.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ji.length}${bs?', expanded':', collapsed'}`,accessibilityState:{expanded:bs},onPress:()=>ys(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Y.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ji.length,")"]}),(0,qe.jsx)(Y.T,{size:16,colour:se.colours.muted,children:bs?'\u25be':'\u25b8'})]}),bs?Ji.map(e=>{const t=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,qe.jsxs)(F.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Y.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Y.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,qe.jsx)(U.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,qe.jsx)(v.BookingUndo,{b:e,rid:mt,today:Ht,who:t.name,allowed:wi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ae.CancellationsSection,{items:Hl,dayWord:rl?cl?dl.toLowerCase():`on ${dl}`:'today'})]}),en=(0,qe.jsx)(V.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Zi}),tn=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&gs(!1)}}),sn=(0,qe.jsxs)(F.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Xi}, ${Qi.length}`,accessibilityState:{expanded:hs},'aria-expanded':hs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>gs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:hs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:hs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Y.T,{size:16,weight:"bold",colour:se.colours.gold,children:Qi.length}),(0,qe.jsx)(U.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(U.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,qe.jsxs)(Y.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Xi," ",hs?'\u2039':'\u203a']})})})]}),ln=Math.min(560,Math.max(320,.44*at))<400,nn=hs?(0,qe.jsxs)(U.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,qe.jsxs)(U.default,{testID:"guests-drawer",...tn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*at)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,...Ne.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,qe.jsxs)(U.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,qe.jsxs)(U.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsxs)(U.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,qe.jsxs)(Y.T,{testID:"guests-heading",size:ln?14:17,weight:"semibold",colour:se.colours.gold,style:{flexShrink:1,minWidth:0},children:[Xi.toUpperCase()," (",Qi.length,")"]}),(0,qe.jsx)(F.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:cs},'aria-expanded':cs,onPress:()=>us(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:ln?8:12,borderRadius:12,borderWidth:1,borderColor:cs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?se.colours.tilePressed:cs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:se.colours.goldLight,children:[ln?'Key':'Guest key'," ",cs?'\u25b4':'\u25be']})})]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Xi}`,onPress:()=>gs(!1),style:{marginRight:-6,flexShrink:0}})]}),zl.count?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Pl}):null,cs?(0,qe.jsxs)(U.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:se.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,qe.jsxs)(U.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:se.colours.amber,ink:se.colours.bg}),(0,qe.jsx)(Y.T,{size:14,children:"allergy"})]}),(0,qe.jsxs)(U.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(me.DogIcon,{size:18}),(0,qe.jsx)(Y.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,qe.jsxs)(U.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(Y.T,{size:16,children:e}),(0,qe.jsx)(Y.T,{size:14,children:t})]},t))]}):null]}),en]}),(0,qe.jsx)(F.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Xi}`,accessibilityRole:"button",onPress:()=>gs(!1),style:{flex:1}})]}):null,on=ml?jl:l.IS_KIRKTON&&!Object.values(jt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(U.default,{testID:"kirkton-hours-to-confirm",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Y.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(jt,It,vt).busy,todays:ul,open:bl,close:yl,now:vt,turnBase:jt.settings.turnMins,blocks:Ml,pauses:fl,compact:ct,dense:!ct,fit:ht,tight:ht&&dt<=600,height:ht?Si:Di,forecastNote:rl?void 0:Ql,emptyText:wl,past:al{Ds.current=Date.now(),ks(!0)},shortDay:!ct&&at<1100}),dn=(0,qe.jsx)(He.DisplayCalendar,{visible:Is,today:Ht,day:al,bookings:It,restaurant:jt,now:vt,onDay:Ss,onClose:()=>ks(!1)}),cn=()=>{rl?gs(!0):Kt(!0)},un=(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',padding:zi?4:dt<820?8:12,paddingTop:zi?ki?2:4:dt<820?ki?4:6:ki?8:10,gap:zi?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:yi,Pt?(0,qe.jsx)(V.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"})}):gi?hi:ui,bi,nn]}),(0,qe.jsxs)(U.default,{testID:"display-side",style:{width:bt,gap:dt<820?4:8,minHeight:0},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Ii(!1)}),(0,qe.jsx)(U.default,{style:{flexShrink:0},children:ji}),Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",onLayout:Ui,style:ki&&!Ni?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:dt<820,snug:dt<820,tight:dt<800,fill:ki&&!Ni,sound:(0,O.flapSoundOn)(),onPress:cn})}),Pt?null:(0,qe.jsx)(U.default,{ref:Ti,testID:"day-graph-slot",onLayout:Ui,style:{flexGrow:0,flexShrink:ki?0:1,flexBasis:(ct?Di:Si)+(ki?Mi:Hi),height:(ct?Di:Si)+(ki?Mi:Hi),minHeight:dt<=600?90:Math.min((ct?Di:Si)+We.DAY_GRAPH_CHROME,!ct&&dt>=768?140+We.DAY_GRAPH_CHROME:120),overflow:'visible'},children:an}),ki&&!Pt?(0,qe.jsx)(U.default,{ref:$i,testID:"display-side-split",onLayout:Ui,style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})}):null,(0,qe.jsxs)(V.default,{testID:"display-side-scroll",style:ki?{flexGrow:0,flexShrink:1,minHeight:Wi&&Oi?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Bi.current&&(Bi.current=s,Li(s),setTimeout(Ui,0))},children:[ki||xi?null:(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),qi,(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt})]})]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Ds.current=Date.now()},onMouseDown:()=>{Ds.current=Date.now()},children:[ct?(0,qe.jsx)(U.default,{style:{flex:1},children:(0,qe.jsxs)(V.default,{ref:yt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,qe.jsxs)(U.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,qe.jsx)(U.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,qe.jsx)(j.ExitButton,{})}),(0,qe.jsx)(X.RestaurantLogo,{rid:mt,size:64}),(0,qe.jsx)(Y.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:jt.name}),(0,qe.jsx)(X.PoweredBy,{}),(0,qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(U.default,{accessible:!0,accessibilityLabel:`Current time ${(0,ee.hm)(vt)}`,children:(0,qe.jsx)(Y.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,ee.hm)(vt)})}),(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:"m"}),(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",size:"m"}),Z]}),Fe,k.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:mt}),rn,(0,qe.jsx)(U.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(it,{phone:!0,split:Ll,items:[{label:`Tables \xb7 ${dl}`,value:Bl.length,testID:'badge-tables'},{label:`Covers \xb7 ${dl}`,value:Wl,testID:'badge-covers'},{label:'Takeaway',value:qs.length,alert:qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ls(!0)}]})}),(0,qe.jsx)(U.default,{testID:"primary-actions",style:{gap:8},children:Ii(!0)}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt}),ji,(0,qe.jsxs)(U.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[gi?hi:ui,bi]}),(0,qe.jsxs)(U.default,{onLayout:e=>{pt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ne.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Y.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Xi," (",Qi.length,")"]}),(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{gap:4},children:Zi})]}),qi,an,(0,qe.jsx)(U.default,{testID:"covers-dock",children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>yt.current?.scrollTo({y:pt.current,animated:!0})})}),(0,qe.jsxs)(U.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,qe.jsx)(Y.T,{center:!0,size:14,colour:Ot?se.colours.muted:se.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Y.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Rs(!0),style:{minHeight:48,alignSelf:'stretch'}}),xi?null:(0,qe.jsx)(Y.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ki]})}):(0,qe.jsxs)(qe.Fragment,{children:[ki?(0,qe.jsx)(U.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:se.colours.hairline},children:(0,qe.jsx)(U.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)(U.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,paddingVertical:zi?2:dt<820?4:8,gap:8,minHeight:zi&&ki?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ne.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(U.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:ki?16:8,minWidth:0,overflow:'hidden',...ki?{justifyContent:'flex-start'}:null},children:[(0,qe.jsx)(U.default,{testID:"display-header-brand",style:ki?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(X.RestaurantBrand,{rid:jt.id,size:at<900?32:40,beside:!0,noLogo:ki})}),(0,qe.jsxs)(U.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Y.T,{size:at<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,ee.hm)(vt)}),at>=900?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:(0,ee.niceDate)(vt)}):null]})]}),Pt?(0,qe.jsx)(U.default,{style:{width:220}}):(0,qe.jsx)(U.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:rn}),(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,qe.jsxs)(U.default,{testID:"display-header-chips",style:{flexDirection:at>=1400||ki?'row':'column',alignItems:at>=1400||ki?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:at<1240?'xs':at<1280||dt<700?'s':'m'}),Pt?null:(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",slot:ki,size:at<1340?'xs':at<1400||dt<700?'s':'m'})]}),'simulated'===St?(0,qe.jsx)(F.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>Dt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,Z,e?null:(0,qe.jsx)(U.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(j.ExitButton,{size:44})})]})]}),Fe,k.IS_CAR||!Pt||ki?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:mt,margin:{marginHorizontal:12,marginTop:6}}),Pt||ki?null:(0,qe.jsx)(U.default,{testID:"display-day-stats",style:Xe,children:(0,qe.jsxs)(U.default,{style:Ze,children:[k.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(U.default,{style:et,children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})})]})}),ht?un:(hn=(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{testID:"front-door-bar",style:{gap:10},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Ii(!1)}),ji]}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt}),Pt?(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"}):(0,qe.jsx)(qe.Fragment,{children:(0,qe.jsxs)(U.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[yi,gi?hi:ui,bi,nn]})]})}),qi,Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,sound:(0,O.flapSoundOn)(),onPress:cn})}),Pt?null:(0,qe.jsx)(U.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Di+We.DAY_GRAPH_CHROME},children:an})]}),(0,qe.jsx)(V.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:hn})),Ki]}),(0,qe.jsx)($.SoldOutStrip,{rid:mt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:zs,onClose:()=>Hs(!1),rid:mt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:mt}),Mt.elements,is?(0,qe.jsx)(y.EditBookingPicker,{rid:mt,today:Ht,who:Lt,onClose:()=>ns(!1)}):null,os?(0,qe.jsx)(y.EditBookingSheet,{rid:mt,id:os,who:Lt,onClose:()=>as(null)}):null,Qt?(0,qe.jsx)(Se.TableSheet,{rid:mt,name:Qt,view:Xs,plan:Nt,todays:Us,now:vt,privacy:Ot,turnBase:jt.settings.turnMins,onClose:()=>Jt(null),onWalkIn:e=>Mt.openWalkInAt(e),onMove:e=>Zt(e),onDetails:Vs}):null,kl?(()=>{const e=Il[kl],t=e?.dayBookings??[];return(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>{$l(null),Dl(null)},title:`${(0,d.tableNumbersA11y)(kl)} \xb7 ${cl?dl:(0,ze.dayLong)(al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Y.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${cl?dl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${cl?dl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Ot):tt(e.name);return(0,qe.jsx)(Y.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,ke.tablesWords)((0,ae.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Dl(null),fs(e.id)},style:{minHeight:56}},e.id)}),al>=Ht?(()=>{const t=e?.table.maxSeats??0,s=It.filter(e=>e.date===al&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,ae.tablesOf)(e.table).includes(kl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,qe.jsxs)(U.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(kl)]}),Rl?(0,qe.jsxs)(U.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Rl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Rl.ask}),(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!wi.ok,accessibilityHint:wi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Rl.id);if($l(null),!e)return;const s=tt(e.name);Dl(null),await(0,Ie.saveTablesReported)(mt,e,[kl],s,t,Os)}}),(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>$l(null)})]})]}):null,Rl?null:s.slice(0,12).map(e=>{const s=tt(e.name),l=e.partySize>t;return(0,qe.jsx)(Y.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:!wi.ok,accessibilityHint:wi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(kl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(Os,{b:e,tables:[kl]}))return;const l=(0,ke.overCapacityAsk)([kl],t,e.partySize);l?$l({id:e.id,ask:l}):(Dl(null),await(0,Ie.saveTablesReported)(mt,e,[kl],s,t,Os))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Y.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{$l(null),Dl(null)},style:{minHeight:56}})]})})():null,ps?(()=>{const e=It.find(e=>e.id===ps);return e?(0,qe.jsx)(je.GuestActionsSheet,{rid:mt,b:e,name:e.walkIn?(0,fe.privName)(e,Ot):tt(e.name),view:Xs,now:vt,otherDay:e.date!==Ht,turnBase:jt.settings.turnMins,onClose:()=>fs(null),onDetails:Vs,onDone:Os,onEdit:e=>{fs(null),as(e.id)},onPickOnPlan:(e,t)=>{gs(!1),Vt('plan'),Yt('all'),ms({id:e.id,tables:t})}}):null})():null,es?(0,qe.jsx)(Se.DetailsPanel,{title:es.title,onClose:()=>ts(null),children:es.body}):null,dn,rs?(0,qe.jsx)(Se.ServiceSummary,{r:jt,todays:Us,orders:wt,waitlistAll:vs,walkInCount:Cs,onClose:()=>ds(!1)}):null,Ts?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Rs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsxs)(U.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:se.colours.amber,ink:se.colours.bg}),(0,qe.jsx)(Y.T,{size:14,children:"allergy"})]}),(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(me.DogIcon,{size:18}),(0,qe.jsx)(Y.T,{size:14,children:"dog"})]}),(0,qe.jsx)(Y.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Rs(!1)})]}):null,Ws?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ls(!1),Bs(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,$s?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(Q.ReviewsSection,{rid:mt,mode:"read",venueName:jt.name}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,ss?(0,qe.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>ls(!1),children:[(0,qe.jsx)(Y.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(ot,{list:qs,me:Lt,bookings:It})]}):null,Es?(0,qe.jsx)(U.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,qe.jsx)(he.PlanDesigner,{initial:Nt,venue:jt.name,mode:"display",startStep:"arrange",onActivity:()=>{_s.current=Date.now(),null!==Gs&&Fs(null)},notice:null!==Gs?`Locking again in ${Gs} s \xb7 touch to keep editing`:null,onSave:e=>{ae.useFloor.getState().setPlan(mt,e),Ns(null),Os('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{ae.useFloor.getState().setPlan(mt,e),Os('Live seating plan updated on every screen.')},onCancel:()=>{Ns(null),Os('No changes kept. Editing is locked again.')}},Es.at)}):null,e?null:(0,qe.jsx)(ye.Screensaver,{rid:mt,idleMins:At.idleMins,pinOn:At.pinOn,wake:At,tonightCards:At.tonightCards,cfg:Et}),e?null:(0,qe.jsx)(Ce.PrintHost,{rid:mt}),e?null:(0,qe.jsx)(ve.AlertHost,{variant:"display",rid:mt,skipTakeaway:!0}),e?null:(0,qe.jsx)(E.SeatAllergenReminder,{rid:mt}),e?null:(0,qe.jsx)(Te.TakeawayTakeover,{rid:mt,me:Lt})]});var hn}function rt({rid:e,id:t,turnBase:s}){const l=(0,te.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1336,[1051,779,805,806,1337,813,1338,1092,843,1138,1339,1340,1341,1089,1120,1342,1343,1348,1349,1206,1350,856,1355,1356,1357,1113,1111,920,1358,1150,891,1102,1359,17,1070,1182,1016,1085,1360,378,363,385,278,85,409,19,777,1237,1241,857,845,863,858,804,1088,876,1096,1055,996,1074,1107,1361,1106,1362,1369,1371,1374,1379,1373,1380,1383,1384,1115,1093,1094,862,1389,1226,1390,1236,1228,993,1395,1400,1401,1052,1050,1117,1403,1404,1405,1069,1169,1406,1168,1159,853,1351,1407,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},1339,[]); @@ -1437,7 +1437,7 @@ __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(t,c){return}},1354,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.displayActionBy=function(t){if(t.isCar)return'Car';if(t.isDisplayApp)return'Display';return(t.personName??'').trim()||'Duty Manager'}},1355,[]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"finishClearPatch",{enumerable:!0,get:function(){return s.finishClearPatch}}),Object.defineProperty(e,"DEFAULT_TURN_MINS",{enumerable:!0,get:function(){return a}}),e.bookingEndAt=u,e.isLeftEarly=o,e.todaysGuestList=function(t,n,s=a){return t.filter(t=>'confirmed'===t.status||'seated'===t.status||o(t,n,s)).sort((t,n)=>t.time.localeCompare(n.time))},e.todaysFinishedList=function(t,n,s=a){return t.filter(t=>'finished'===t.status&&!o(t,n,s)).sort((t,n)=>t.time.localeCompare(n.time))};var t=r(d[0]),n=r(d[1]),s=r(d[2]);const a=90;function u(s,u=a){if(!s.date||!s.time)return null;const o=(0,n.atTime)((0,n.parseYmd)(s.date),s.time),f=u>0?u:a,c=s.durationMins&&s.durationMins>=15?s.durationMins:(0,t.turnFor)(s.partySize??2,f);return new Date(o.getTime()+6e4*c)}function o(t,s,o=a){if('finished'!==t.status||!t.date||!t.time||!t.finishedAt)return!1;const f=(0,n.atTime)((0,n.parseYmd)(t.date),t.time);if(new Date(t.finishedAt).getTime()>=f.getTime())return!1;const c=u(t,o);return!!c&&(s??new Date).getTime()1?'are':'is'} free again`:'',"."]}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${$}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>I(t,e,{stage:void 0,dirty:!1})),j(!1)}}),(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${$} seated`,onPress:()=>j(!1)})]})]}):(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${$}: ${e.walkIn?'removes the walk-in':'back to booked'}${v?`, frees ${v}`:''}`,onPress:()=>j(!0)});const L='undo-finished'===x?'seated':'confirmed';return(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===x?`Undo finished: ${$} back to seated${v?` at ${v}`:''}`:`Undo no-show: ${$} back to booked`,onPress:async()=>{'undo-finished'!==x?await n.repo.bookings.setStatus(e.id,L):await(0,b.undoFinishedNow)(t,e)}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),h=r(d[7]),f=r(d[8]);function k(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1357,[17,85,858,996,777,804,1112,1111,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=k,_e.BookingUndo=function({b:e,rid:t,today:w,who:$,allowed:y=!0}){const[p,j]=(0,s.useState)(!1),x=k(e,w);if(!x||!y)return null;const U=(0,h.tableForUndo)(e),v=(0,l.tableCardLabel)(U),I=l.useFloor.getState().setLive;if('unseat'===x)return p?(0,f.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,f.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",$,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',v?` and ${v} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${$}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>I(t,e,{stage:void 0,dirty:!1})),j(!1)}}),(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${$} seated`,onPress:()=>j(!1)})]})]}):(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${$}: ${e.walkIn?'removes the walk-in':'back to booked'}${v?`, frees ${v}`:''}`,onPress:()=>j(!0)});const L='undo-finished'===x?'seated':'confirmed';return(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===x?`Undo finished: ${$} back to seated${v?` at ${v}`:''}`:`Undo no-show: ${$} back to booked`,onPress:async()=>{'undo-finished'!==x?await n.repo.bookings.setStatus(e.id,L):await(0,b.undoFinishedNow)(t,e)}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),h=r(d[7]),f=r(d[8]);function k(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1357,[17,85,858,996,777,804,1113,1111,8]); __d(function(g,r,i,a,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},1358,[813,812,17,219,385,278,85,777,1150,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])},1359,[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])},1360,[17,85,780,804,8]); @@ -1460,16 +1460,16 @@ __d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?global __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||'')}},1377,[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},1379,[17,831,928,899,1378]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=$,e.guestRowText=function(n,p){const l=n.partySize,b=Math.max(0,Math.min(l-1,Math.round(Number(n.children)||0))),f=`${l} ${1===l?'person':'people'}${b?` (${b} ${1===b?'child':'children'})`:''}`,h=(0,o.tablesOf)(n.table??void 0),c=h.length?`${p.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',w=p.leftEarly?"Left early"+(c?` \xb7 ${c}`:''):p.finished?"Finished"+(c?` \xb7 ${c}`:''):p.seated?"Seated"+(c?` \xb7 ${c}`:''):c||'No table yet',x=$(n),y=h.length?`table${h.length>1?'s':''} ${u(h.map(t.plainTableNumber))}`:p.finished?'finished':'no table yet',D=!!n.dog,m=(0,s.allergyLine)(n),k=(0,d.guestChangeLine)(n),v=[n.time,p.name,m?`allergy noted: ${m}`:'',f,p.leftEarly?'left early':p.finished?'finished':p.seated?'seated':'',x?.spoken??'',y,D?'dog':''].filter(Boolean).join(', ')+'.'+(k?` ${k}`:'');return{time:n.time,name:p.name,people:f,deposit:x?.text??null,depositWarn:!!x?.warn,table:w,dog:D,allergy:m,guestChange:k,a11y:v}};var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),s=r(_d[3]),d=r(_d[4]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,l=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 o=(0,n.depositBadge)(t,p);if(!o)return null;const s=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||d>0&&u>d&&!o.label.startsWith('Deposit paid')){const t=d||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${l(t).replace(' pounds','')} of ${l(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(o.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const $=o.label.match(/\xa3[\d.,]+/);if(o.label.startsWith('Deposit paid')){const t=/about/.test(o.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(o.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(o.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}}},1380,[843,841,996,1381,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}}},1380,[843,841,996,1381,1382]); __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])},1381,[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}},1382,[]); __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])},1383,[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'},1384,[1385,843,1093,996,17,85,777,1096,858,1113,1380,1094,863,1091,1114,1115,1116,804,1340,1387,1388,1112,1357,1111,8]); +__d(function(_g,r,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'},1384,[1385,843,1093,996,17,85,777,1096,858,1114,1380,1094,863,1091,1115,1116,1117,804,1340,1387,1388,1113,1357,1111,8]); __d(function(g,r,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])},1385,[17,362,385,85,858,920,876,994,1386,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')}`}},1386,[]); __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},1389,[1169,1385,813,1093,812,843,1138,1089,1114,863,17,1076,219,385,278,85,777,1096,1373,858,996,845,1087,1074,1318,804,1340,1387,1388,1112,1111,8]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"Card",{enumerable:!0,get:function(){return M}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const l=e.filter(e=>'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},1389,[1169,1385,813,1093,812,843,1138,1089,1115,863,17,1076,219,385,278,85,777,1096,1373,858,996,845,1087,1074,1318,804,1340,1387,1388,1113,1111,8]); __d(function(g,_r,_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.']}]},1390,[812,17,219,385,85,777,858,996,1391,804,1392,1394,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))},1391,[]); __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)}},1392,[831,858,996,1391,1393,1394]); @@ -1495,7 +1495,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1412,[13,17,1413,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])},1413,[17,856,1414,1555,8]); __d(function(g,_r,i,_a,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,{})]})}},1414,[805,813,899,1190,1224,1206,1026,1023,891,1024,880,1030,1085,17,356,378,385,278,409,85,19,777,857,858,876,804,1415,1181,1055,884,1423,920,219,1428,1468,839,856,1470,1477,1478,1479,1187,1242,1480,1454,1481,1483,1452,1158,1226,1390,1228,1241,1485,1082,1084,1551,1552,1571,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])},1415,[805,1416,1093,1266,1417,812,822,1114,1115,1089,1119,1418,1120,1116,1403,1404,1055,1340,994,1117,1087,841,1382,1123,1420,1237,1421,1395,1076,1053,1088,17,85,777,1360,858,845,851,863,1318,804,1181,1096,1112,996,1357,1060,1159,1422,1228,899,1183,1400,862,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1415,[805,1416,1093,1266,1417,812,822,1115,1116,1089,1120,1418,1112,1117,1403,1404,1055,1340,994,1118,1087,841,1382,1123,1420,1237,1421,1395,1076,1053,1088,17,85,777,1360,858,845,851,863,1318,804,1181,1096,1113,996,1357,1060,1159,1422,1228,899,1183,1400,862,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.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])},1417,[806,17,85,777,899,1270,8]); __d(function(g,r,_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])},1418,[17,385,85,1419,899,928,804,777,8]); @@ -1508,7 +1508,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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])},1425,[17,278,85,777,857,804,1426,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(' ')},1426,[]); __d(function(g,_r,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]})}},1427,[888,813,17,1067,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,{}),'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%'}}),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,(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}})]})]})]})})}},1428,[843,1138,1429,17,780,1182,1072,1073,1421,1340,861,1076,264,385,85,777,858,876,1207,1190,845,1157,863,1053,866,804,1181,1055,1137,1142,1143,1006,839,1147,886,899,915,1439,1440,1146,1441,1159,853,1444,1185,1205,856,1204,1029,1030,1064,1096,1395,1150,1339,1462,8]); +__d(function(g,_r,_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}})]})]})]})})}},1428,[843,1138,1429,17,780,1182,1072,1073,1421,1340,861,1076,264,385,85,777,858,876,1207,1190,845,1157,863,1053,866,804,1181,1055,1137,1142,1143,1006,839,1147,886,899,915,1439,1440,1146,1441,1159,853,1444,1185,1205,856,1204,1029,1030,1064,1096,1395,1150,1339,1462,8]); __d(function(_g,_r,_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."})]})}},1429,[1051,1031,805,1416,812,1430,1431,1433,1434,1435,1200,1029,1030,1006,1012,17,385,85,777,841,1436,816,862,1053,861,804,1055,858,1184,926,927,876,1437,1390,996,1438,1003,1140,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)},1430,[812,17,85,777,1138,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)},1431,[843,17,219,85,777,858,996,1151,1259,899,1334,1432,8]); @@ -1558,12 +1558,12 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ThingsToHaveReady=function({onOpenTablePlan:e}){return(0,h.jsxs)(s.default,{testID:"onboard-ready",style:{width:'100%',alignItems:'center',gap:14},children:[b('Things to have ready'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Gather these before you check the questionnaire. Nothing here is sent."}),d.READY_ITEMS.map((t,a)=>(0,h.jsxs)(s.default,{testID:`ready-item-${a+1}`,accessible:!0,accessibilityLabel:t,style:{width:'100%',alignItems:'center',gap:6,minHeight:48},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:"\u2713"}),(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:t}),0===a&&e?(0,h.jsx)(n.Button,{kind:"ghost",label:"Open the table plan",accessibilityLabel:"Open the table plan to add a drawing or picture",onPress:e}):null]},t))]})},_e.QuestionnaireAnswers=function({q:e,rid:t,onEdit:y}){const E=(0,i.usePlan)(t),j=(0,a.useMenu)(t),f=(0,l.useAccounts)(e=>e.byVenue[t])??p,x=(E.areas??[]).map(e=>{const t=(0,o.planCounts)(E,e.id);return t.tables?`${e.name}: ${t.tables} ${1===t.tables?'table':'tables'}, ${t.seats} Covers`:e.name}),$=x.length?x:(e.tables.areas??[]).map(e=>e);(e.tables.tables||e.tables.covers)&&$.unshift([e.tables.tables?`${e.tables.tables} tables`:'',e.tables.covers?`${e.tables.covers} Covers`:''].filter(Boolean).join(', '));const w=c.WEEK_ORDER.map(t=>`${c.DAY_NAMES[t]}: ${e.hours.days[t]?`${e.hours.days[t][0]} to ${e.hours.days[t][1]}`:'Closed'}`),D=e.team.map(e=>{const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff',s=e.job&&e.job.trim().toLowerCase()!==t.toLowerCase()?e.job.trim():'';return[e.name,s,t].filter(Boolean).join(', ')}),v=e.suppliers.map(e=>[e.name,e.category,e.phone,e.email].filter(Boolean).join(', ')),I=f.filter(e=>e.accountNo).map(e=>`${e.customName||e.provider}: ${e.accountNo}`),L=e.pay?["Tips "+('fortnightly'===e.pay.tipsFrequency?'every two weeks':'weekly'===e.pay.tipsFrequency?'every week':'monthly'),e.pay.tipsAnchorPayday?`Next tips payday anchor ${e.pay.tipsAnchorPayday}`:'',e.pay.wagePayDay?`Wages on day ${e.pay.wagePayDay}`:''].filter(Boolean):[],T=j.filter(e=>Object.keys(e.allergens??{}).length).length,q=j.length?[`${j.length} ${1===j.length?'dish':'dishes'} on the menu`]:[],N=j.length?[T?`Recorded on ${T} ${1===T?'dish':'dishes'}`:d.NOT_ANSWERED]:[],_=[e.venue.name,e.venue.tagline,e.venue.address,e.venue.phone,e.venue.email,e.venue.website].filter(e=>!!e&&''!==e.trim());return(0,h.jsxs)(s.default,{testID:"onboard-questionnaire",style:{width:'100%',alignItems:'center',gap:4},children:[b('Your questionnaire'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Tap a section to edit it. Blank answers stay blank."}),(0,h.jsx)(m,{testID:"q-venue",title:"Venue",lines:_,onEdit:()=>y('venue'),editLabel:"Edit venue"}),(0,h.jsx)(m,{testID:"q-hours",title:"Opening hours",lines:w,onEdit:()=>y('hours'),editLabel:"Edit opening hours"}),(0,h.jsx)(m,{testID:"q-tables",title:"Table plan",lines:$,onEdit:()=>y('tables'),editLabel:"Edit table plan"}),(0,h.jsx)(m,{testID:"q-team",title:"Staff and roles",lines:D,onEdit:()=>y('team'),editLabel:"Edit staff and roles"}),(0,h.jsx)(m,{testID:"q-pay",title:"Pay and tips dates",lines:L,onEdit:()=>y('pay'),editLabel:"Edit pay and tips"}),(0,h.jsx)(m,{testID:"q-suppliers",title:"Suppliers",lines:v,onEdit:()=>y('suppliers'),editLabel:"Edit suppliers"}),(0,h.jsx)(m,{testID:"q-accounts",title:"Supplier account numbers",lines:I,onEdit:()=>y('accounts'),editLabel:"Edit account numbers"}),(0,h.jsx)(m,{testID:"q-logo",title:"Logo",lines:e.venue.hasLogo?['Logo added']:[],onEdit:()=>y('branding'),editLabel:"Edit logo"}),(0,h.jsx)(m,{testID:"q-menu",title:"Menu",lines:q,onEdit:()=>y('menu'),editLabel:"Edit menu"}),(0,h.jsx)(m,{testID:"q-allergens",title:"Allergens",lines:N,onEdit:()=>y('menu'),editLabel:"Edit allergens"}),(0,h.jsx)(m,{testID:"q-cashup",title:"What to record at nightly cash up",lines:e.cashUp??[],onEdit:()=>y('cashup'),editLabel:"Edit cash up"})]})},r(_d[0]);var t=e(r(_d[1])),s=e(r(_d[2])),n=r(_d[3]),a=r(_d[4]),l=r(_d[5]),i=r(_d[6]),o=r(_d[7]),d=r(_d[8]),c=r(_d[9]),u=r(_d[10]),h=r(_d[11]);const p=[],b=e=>(0,h.jsx)(n.T,{accessibilityRole:"header",center:!0,size:22,weight:"bold",colour:u.colours.gold,style:{width:'100%'},children:e});const y=e=>e.replace(/([@.])/g,'$1\u200b');function m({testID:e,title:s,lines:a,onEdit:l,editLabel:i}){const o=a.length?a.join('. '):d.NOT_ANSWERED;return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"button",accessibilityLabel:`${s}. ${o}. ${i}.`,onPress:l,style:{width:'100%',minHeight:48,alignItems:'center',gap:4,paddingVertical:10,paddingHorizontal:8,borderTopWidth:1,borderColor:u.colours.border},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:s}),(a.length?a:[d.NOT_ANSWERED]).map((e,t)=>(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:y(e)},`${s}-${t}`)),(0,h.jsx)(n.T,{center:!0,size:14,colour:u.colours.gold,children:i})]})}},1475,[17,385,85,777,860,1474,996,842,1476,1471,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'},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}),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}},1477,[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])},1478,[1182,1070,1114,1087,17,385,85,777,876,863,804,1088,1168,1165,1055,1117,1179,1441,1159,860,1183,853,1181,884,1357,996,843,1112,1196,1203,1069,8]); +__d(function(g,_r,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])},1478,[1182,1070,1115,1087,17,385,85,777,876,863,804,1088,1168,1165,1055,1118,1179,1441,1159,860,1183,853,1181,884,1357,996,843,1113,1196,1203,1069,8]); __d(function(g,_r,_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']}},1479,[17,1053,85,409,777,858,1139,1138,861,863,804,876,1181,1055,1146,1142,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}))},1480,[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]})]})}},1481,[805,1416,843,1390,17,85,777,858,860,866,845,851,1157,1103,863,804,1181,1055,1158,1159,853,1422,848,900,1482,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])},1482,[17,85,777,858,851,1156,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},{id:'support',title:'Customer support',sub:'Send a message or a picture to CoverCharge',group:'Start here',can:e=>'owner'===e&&!r.IS_CAR,C:fe.SupportChatPage}]),(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}])},1483,[822,1048,856,1484,876,920,909,816,866,1486,1493,1495,1454,1496,1497,1499,1500,1158,1479,1501,1502,1503,1462,1199,1190,1481,1504,1452,1505,1506,17,1196,1179,1453,1441,1455,1511,1210,1517,1518,1468,1519,1444,1429,1520,1459,1521,886,1522,1523,1525,1185,1470,1526,1390,1472,1538,1079,1055,1200,1150,1542,1545,1548,1550]); +__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}])},1483,[822,1048,856,1484,876,920,909,816,866,1486,1493,1495,1454,1496,1497,1499,1500,1158,1479,1501,1502,1503,1462,1199,1190,1481,1504,1452,1505,1506,17,1196,1179,1453,1441,1455,1511,1210,1517,1518,1468,1519,1444,1429,1520,1459,1521,886,1522,1523,1525,1185,1470,1526,1390,1472,1538,1079,1055,1200,1150,1542,1545,1548,1550]); __d(function(g,r,i,a,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)}},1484,[17,378,219,385,85,19,777,1024,1336,876,804,1485,1187,1480,1055,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}))},1485,[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}},1486,[812,1450,17,851,85,777,876,804,1055,884,885,1487,899,916,1029,1448,1488,1489,1491,994,1492,8]); @@ -1606,12 +1606,12 @@ __d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule? __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})},1523,[820,896,1452,17,219,85,777,816,876,895,998,897,899,1524,804,880,1160,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'}},1524,[]); __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])},1525,[17,85,777,804,1431,1507,1055,8]); -__d(function(g,_r,_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,c]=(0,a.useState)(null),[p,m]=(0,a.useState)(null),w=(0,a.useMemo)(()=>[...u.HELP,...f],[]),b=(0,a.useMemo)(()=>s.trim()?(0,h.searchHelp)(w,s,10).map(e=>e.a):w.filter(e=>!r||e.topic===r),[s,r,w]);return(0,y.jsxs)(l.default,{style:{gap:10},testID:"help-page",children:[(0,y.jsxs)(l.default,{style:[i.styles.input,{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:4}],children:[(0,y.jsx)(i.T,{colour:x.colours.muted,children:"\ud83d\udd0d"}),(0,y.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:x.colours.text,paddingVertical:8,fontSize:16,outlineStyle:'none'}}),s?(0,y.jsx)(n.GoldClose,{testID:"help-search-clear",size:"sm",label:"Clear search",onPress:()=>o('')}):null]}),s?(0,y.jsx)(i.Muted,{children:b.length?`${b.length} result${1===b.length?'':'s'} for \u201c${s.trim()}\u201d`:`Nothing for \u201c${s.trim()}\u201d. Try other words, or ask the Assistant above.`}):(0,y.jsx)(i.Row,{wrap:!0,gap:6,children:[null,...u.HELP_TOPICS].map(e=>(0,y.jsx)(i.Chip,{label:e??'All',selected:r===e,onPress:()=>c(e)},e??'all'))}),b.map((t,n)=>(0,y.jsx)(j,{a:t,go:e,open:p===t.id||!!s&&0===n&&null===p,onToggle:()=>m(p===t.id?'':t.id)},t.id)),(0,y.jsxs)(i.Card,{style:{alignItems:'center'},children:[(0,y.jsx)(i.T,{center:!0,weight:"semibold",colour:x.colours.gold,children:"Chat with CoverCharge support"}),(0,y.jsx)(i.Muted,{center:!0,children:"Send a message to the CoverCharge team. Nobody replies automatically."}),(0,y.jsx)(i.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,m.useCtx)(6e4),n={rid:t,today:s,go:(t,s)=>e(t,s??null)},[o,r]=(0,a.useState)(''),[c,h]=(0,a.useState)(null),[f,j]=(0,a.useState)(null),C=async()=>{const e=o.trim();if(!e)return;j(null),h(null);const t=(0,p.matchIntent)(e,s);if('action'!==t.kind)'help'!==t.kind?j({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'}):j({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 j({text:'done'===e.status?e.message:e.message??'',kind:'done'})}h({action:t.action,params:{...b(t.action,s),...t.params},asked:e})}};return(0,y.jsx)(l.default,{testID:"ask-assistant",children:(0,y.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(l.default,{style:{width:28,height:28,borderRadius:14,backgroundColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(i.T,{weight:"bold",colour:"#1A1408",children:"\u2726"})}),(0,y.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Ask the Assistant"})]}),(0,y.jsxs)(l.default,{testID:"help-assistant-stack",style:{gap:8,width:'100%',minWidth:0},children:[(0,y.jsx)(i.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,y.jsx)(i.Button,{label:"Ask",testID:"assistant-ask",disabled:!o.trim(),onPress:C,style:{width:'100%',minWidth:0,minHeight:52}})]}),(0,y.jsx)(i.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,y.jsx)(i.Chip,{label:e,onPress:()=>r(e)},e))}),c?(0,y.jsx)(k,{p:c,today:s,onChange:e=>h({...c,params:e}),onConfirm:async()=>{if(!c)return;const e=await(0,p.runAction)(c.action.id,c.params,n,!0);h(null),r(''),j('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:()=>{h(null),j({text:'Cancelled. Nothing was changed.',kind:'note'})}}):null,f?(0,y.jsxs)(l.default,{style:{gap:6},testID:"assistant-reply",children:[(0,y.jsx)(i.Banner,{kind:'done'===f.kind?'success':'error'===f.kind?'warn':'demo'===f.kind?'demo':'info',title:f.text}),f.help?.map(t=>{const s=(0,u.helpById)(t);return(0,y.jsxs)(i.Row,{gap:6,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.T,{style:{flex:1},children:s.title}),s.showMe?(0,y.jsx)(i.Button,{small:!0,kind:"success",label:"Show me",onPress:()=>w(s,e)}):null]},t)})]}):null,(0,y.jsx)(i.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])),l=e(_r(d[5])),i=_r(d[6]),r=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),p=_r(d[11]),x=_r(d[12]),m=_r(d[13]),y=_r(d[14]);const f=[{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 on Home and under 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.'}}];function w(e,t){e.showMe&&(t(e.showMe.tab,e.showMe.page??null),setTimeout(()=>c.useCoach.getState().show(e.showMe.target,e.showMe.hint),300))}function j({a:e,go:t,open:s,onToggle:n}){return(0,y.jsx)(l.default,{testID:`help-${e.id}`,children:(0,y.jsxs)(i.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:n,children:(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(i.T,{weight:"semibold",children:e.title}),(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(i.Badge,{kind:'guide'===e.kind?'gold':'neutral',label:'guide'===e.kind?'Step by step':'FAQ'}),(0,y.jsx)(i.Muted,{size:12,children:e.topic})]})]}),(0,y.jsx)(i.T,{colour:x.colours.muted,children:s?'\u25be':'\u203a'})]})}),s?(0,y.jsxs)(l.default,{style:{gap:6},children:[(0,y.jsx)(i.Muted,{children:e.body}),e.steps?.map((e,t)=>(0,y.jsxs)(i.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,y.jsx)(l.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(i.T,{size:12,weight:"bold",colour:"#1A1408",children:t+1})}),(0,y.jsx)(i.T,{style:{flex:1},children:e})]},t))]}):null,e.showMe?(0,y.jsx)(i.Row,{wrap:!0,gap:6,children:(0,y.jsx)(i.Button,{small:!0,kind:"success",label:"Show me",testID:`showme-${e.id}`,onPress:()=>w(e,t)})}):null]})})}function b(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 c=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),u=(0,p.demoOnly)(e.action.risk),h=(t,s)=>n({...e.params,[t]:s}),m=e.action,f=e.params,w=m.params.every(e=>!e.required||void 0!==f[e.name]&&''!==f[e.name]);return(0,y.jsxs)(l.default,{testID:"assistant-confirm",style:{borderWidth:2,borderColor:u?x.colours.red:x.colours.ok,borderRadius:14,padding:12,gap:8,backgroundColor:u?'#2a1010':x.colours.okBg},children:[(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(i.Badge,{kind:u?'red':'ok',label:p.RISK_LABEL[m.risk]}),(0,y.jsx)(i.T,{weight:"semibold",style:{flex:1},children:m.title})]}),m.form&&'add_walkin'===m.id?(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Covers",value:void 0===f.covers?'':String(f.covers),onChangeText:e=>h('covers',e.replace(/\D/g,'')?Number(e.replace(/\D/g,'')):void 0),keyboardType:"number-pad"})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Table (optional)",value:void 0===f.table?'':String(f.table),onChangeText:e=>h('table',e.trim()?e.trim().toUpperCase():void 0)})})]}):null,m.form&&'add_rota_shift'===m.id?(0,y.jsxs)(l.default,{style:{gap:6},children:[(0,y.jsx)(i.Muted,{size:12,children:"Who"}),(0,y.jsx)(i.Row,{wrap:!0,gap:6,children:c.slice(0,14).map(e=>(0,y.jsx)(i.Chip,{label:e.name.replace(' (example)','').split(' ')[0],selected:f.staffId===e.id,onPress:()=>h('staffId',e.id)},e.id))}),(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(l.default,{style:{flex:1.3},children:(0,y.jsx)(i.Field,{label:"Date (DD/MM/YYYY)",...(0,s.slashBox)(String(f.date??t),e=>h('date',e)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Start (24h)",value:String(f.start??''),onChangeText:e=>h('start',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"End (24h)",value:String(f.end??''),onChangeText:e=>h('end',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})})]})]}):null,(0,y.jsx)(i.T,{children:w?m.preview(f,{rid:'',today:t,go:()=>{}}):'Fill in the missing details above.'}),u?(0,y.jsx)(i.Muted,{children:"This Assistant does not send, pay or delete. Confirm only shows what would happen."}):(0,y.jsx)(i.Muted,{children:"Nothing happens until you tap Confirm."}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.Button,{kind:u?'danger':'success',label:u?'Confirm (nothing is sent)':'Confirm',testID:"assistant-confirm-yes",disabled:!w,onPress:a,style:{flex:1}}),(0,y.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:o,style:{flex:1}})]})]})}},1526,[812,1031,779,17,385,85,777,876,1477,1527,1528,1529,804,1055,8]); +__d(function(g,_r,_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,n.useState)(''),[r,c]=(0,n.useState)(null),[p,m]=(0,n.useState)(null),w=(0,n.useMemo)(()=>[...u.HELP,...f],[]),j=(0,n.useMemo)(()=>s.trim()?(0,h.searchHelp)(w,s,10).map(e=>e.a):w.filter(e=>!r||e.topic===r),[s,r,w]);return(0,y.jsxs)(l.default,{style:{gap:10},testID:"help-page",children:[(0,y.jsxs)(l.default,{style:[i.styles.input,{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:4}],children:[(0,y.jsx)(i.T,{colour:x.colours.muted,children:"\ud83d\udd0d"}),(0,y.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:x.colours.text,paddingVertical:8,fontSize:16,outlineStyle:'none'}}),s?(0,y.jsx)(a.GoldClose,{testID:"help-search-clear",size:"sm",label:"Clear search",onPress:()=>o('')}):null]}),s?(0,y.jsx)(i.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,y.jsx)(i.Row,{wrap:!0,gap:6,children:[null,...u.HELP_TOPICS].map(e=>(0,y.jsx)(i.Chip,{label:e??'All',selected:r===e,onPress:()=>c(e)},e??'all'))}),j.map((t,a)=>(0,y.jsx)(b,{a:t,go:e,open:p===t.id||!!s&&0===a&&null===p,onToggle:()=>m(p===t.id?'':t.id)},t.id)),(0,y.jsxs)(i.Card,{style:{alignItems:'center'},children:[(0,y.jsx)(i.T,{center:!0,weight:"semibold",colour:x.colours.gold,children:"Chat with CoverCharge support"}),(0,y.jsx)(i.Muted,{center:!0,children:"Send a message to the CoverCharge team. Nobody replies automatically."}),(0,y.jsx)(i.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,m.useCtx)(6e4),a={rid:t,today:s,go:(t,s)=>e(t,s??null)},[o,r]=(0,n.useState)(''),[c,h]=(0,n.useState)(null),[f,b]=(0,n.useState)(null),C=async()=>{const e=o.trim();if(!e)return;b(null),h(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,a);return void b({text:'done'===e.status?e.message:e.message??'',kind:'done'})}h({action:t.action,params:{...j(t.action,s),...t.params},asked:e})}};return(0,y.jsx)(l.default,{testID:"ask-assistant",children:(0,y.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(l.default,{style:{width:28,height:28,borderRadius:14,backgroundColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(i.T,{weight:"bold",colour:"#1A1408",children:"\u2726"})}),(0,y.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Ask the Assistant"})]}),(0,y.jsxs)(l.default,{testID:"help-assistant-stack",style:{gap:8,width:'100%',minWidth:0},children:[(0,y.jsx)(i.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,y.jsx)(i.Button,{label:"Ask",testID:"assistant-ask",disabled:!o.trim(),onPress:C,style:{width:'100%',minWidth:0,minHeight:52}})]}),(0,y.jsx)(i.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,y.jsx)(i.Chip,{label:e,onPress:()=>r(e)},e))}),c?(0,y.jsx)(k,{p:c,today:s,onChange:e=>h({...c,params:e}),onConfirm:async()=>{if(!c)return;const e=await(0,p.runAction)(c.action.id,c.params,a,!0);h(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:()=>{h(null),b({text:'Cancelled. Nothing was changed.',kind:'note'})}}):null,f?(0,y.jsxs)(l.default,{style:{gap:6},testID:"assistant-reply",children:[(0,y.jsx)(i.Banner,{kind:'done'===f.kind?'success':'error'===f.kind?'warn':'demo'===f.kind?'demo':'info',title:f.text}),f.help?.map(t=>{const s=(0,u.helpById)(t);return(0,y.jsxs)(i.Row,{gap:6,style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.T,{style:{flex:1},children:s.title}),s.showMe?(0,y.jsx)(i.Button,{small:!0,kind:"success",label:"Show me",onPress:()=>w(s,e)}):null]},t)})]}):null,(0,y.jsx)(i.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]),a=_r(d[2]),n=_r(d[3]),o=e(_r(d[4])),l=e(_r(d[5])),i=_r(d[6]),r=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),p=_r(d[11]),x=_r(d[12]),m=_r(d[13]),y=_r(d[14]);const f=[{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.'}}];function w(e,t){e.showMe&&(t(e.showMe.tab,e.showMe.page??null),setTimeout(()=>c.useCoach.getState().show(e.showMe.target,e.showMe.hint),300))}function b({a:e,go:t,open:s,onToggle:a}){return(0,y.jsx)(l.default,{testID:`help-${e.id}`,children:(0,y.jsxs)(i.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:a,children:(0,y.jsxs)(i.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,y.jsxs)(l.default,{style:{flex:1},children:[(0,y.jsx)(i.T,{weight:"semibold",children:e.title}),(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(i.Badge,{kind:'guide'===e.kind?'gold':'neutral',label:'guide'===e.kind?'Step by step':'FAQ'}),(0,y.jsx)(i.Muted,{size:12,children:e.topic})]})]}),(0,y.jsx)(i.T,{colour:x.colours.muted,children:s?'\u25be':'\u203a'})]})}),s?(0,y.jsxs)(l.default,{style:{gap:6},children:[(0,y.jsx)(i.Muted,{children:e.body}),e.steps?.map((e,t)=>(0,y.jsxs)(i.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,y.jsx)(l.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(i.T,{size:12,weight:"bold",colour:"#1A1408",children:t+1})}),(0,y.jsx)(i.T,{style:{flex:1},children:e})]},t))]}):null,e.showMe?(0,y.jsx)(i.Row,{wrap:!0,gap:6,children:(0,y.jsx)(i.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:a,onConfirm:n,onCancel:o}){const c=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),u=(0,p.demoOnly)(e.action.risk),h=(t,s)=>a({...e.params,[t]:s}),m=e.action,f=e.params,w=m.params.every(e=>!e.required||void 0!==f[e.name]&&''!==f[e.name]);return(0,y.jsxs)(l.default,{testID:"assistant-confirm",style:{borderWidth:2,borderColor:u?x.colours.red:x.colours.ok,borderRadius:14,padding:12,gap:8,backgroundColor:u?'#2a1010':x.colours.okBg},children:[(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(i.Badge,{kind:u?'red':'ok',label:p.RISK_LABEL[m.risk]}),(0,y.jsx)(i.T,{weight:"semibold",style:{flex:1},children:m.title})]}),m.form&&'add_walkin'===m.id?(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Covers",value:void 0===f.covers?'':String(f.covers),onChangeText:e=>h('covers',e.replace(/\D/g,'')?Number(e.replace(/\D/g,'')):void 0),keyboardType:"number-pad"})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Table (optional)",value:void 0===f.table?'':String(f.table),onChangeText:e=>h('table',e.trim()?e.trim().toUpperCase():void 0)})})]}):null,m.form&&'add_rota_shift'===m.id?(0,y.jsxs)(l.default,{style:{gap:6},children:[(0,y.jsx)(i.Muted,{size:12,children:"Who"}),(0,y.jsx)(i.Row,{wrap:!0,gap:6,children:c.slice(0,14).map(e=>(0,y.jsx)(i.Chip,{label:e.name.replace(' (example)','').split(' ')[0],selected:f.staffId===e.id,onPress:()=>h('staffId',e.id)},e.id))}),(0,y.jsxs)(i.Row,{gap:6,children:[(0,y.jsx)(l.default,{style:{flex:1.3},children:(0,y.jsx)(i.Field,{label:"Date (DD/MM/YYYY)",...(0,s.slashBox)(String(f.date??t),e=>h('date',e)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"Start (24h)",value:String(f.start??''),onChangeText:e=>h('start',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})}),(0,y.jsx)(l.default,{style:{flex:1},children:(0,y.jsx)(i.Field,{label:"End (24h)",value:String(f.end??''),onChangeText:e=>h('end',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})})]})]}):null,(0,y.jsx)(i.T,{children:w?m.preview(f,{rid:'',today:t,go:()=>{}}):'Fill in the missing details above.'}),u?(0,y.jsx)(i.Muted,{children:"This Assistant does not send, pay or delete. Confirm only shows what would happen."}):(0,y.jsx)(i.Muted,{children:"Nothing happens until you tap Confirm."}),(0,y.jsxs)(i.Row,{gap:8,children:[(0,y.jsx)(i.Button,{kind:u?'danger':'success',label:u?'Confirm (nothing is sent)':'Confirm',testID:"assistant-confirm-yes",disabled:!w,onPress:n,style:{flex:1}}),(0,y.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:o,style:{flex:1}})]})]})}},1526,[812,1031,779,17,385,85,777,876,1477,1527,1528,1529,804,1055,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.'},{id:'wipe-device',kind:'faq',topic:'Settings',title:'Sign out and wipe a shared tablet or phone',keywords:['wipe','sign out','shared','tablet','leaver','lost','reset device'],body:'Tap the sync badge (bottom left), or go to Settings \u203a Display, and choose Sign out and wipe this device. It signs out and removes everything CoverCharge keeps on that device: sign-ins, pairing, saved screens and changes not sent yet. The venue\u2019s shared data is not touched. On the Display you type the wake PIN first.'}],o=t=>a.find(a=>a.id===t)},1527,[]); __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}},1528,[]); __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}},1529,[1530,1098,843,1531,1532,876,858,996,1477,1527,1528,1534,1533,1536,1537,994,995]); __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))}}]},1530,[1062,1061,1021]); -__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.`)}}]},1531,[896,1098,820,843,1118,1096,1112,922,858,816,996,895,897,1008,876,1065,867,847,845]); +__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.`)}}]},1531,[896,1098,820,843,1119,1096,1113,922,858,816,996,895,897,1008,876,1065,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.'}}]},1532,[820,858,816,996,876,1001,1012,1013,927,926,1006,839,1032,1033,1034,1002,1065,867,1074,993,854,1533,1531]); __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.'}}]},1533,[820,891,1098,843,1138,1259,858,816,996,1001,910,846,845,1074,1075,993,1002,851,1534,1535]); __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)}))},1534,[824,831,834]); @@ -1643,7 +1643,7 @@ __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.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},1560,[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}`},1561,[1556]); __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)},1562,[]); -__d(function(_g,_r,_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]}},1563,[17,385,85,409,812,777,1070,1030,1177,1119,1089,858,1006,876,1053,839,889,899,804,1415,1055,1454,1564,1553,1562,1565,8]); +__d(function(_g,_r,_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]}},1563,[17,385,85,409,812,777,1070,1030,1177,1120,1089,858,1006,876,1053,839,889,899,804,1415,1055,1454,1564,1553,1562,1565,8]); __d(function(g,_r,_i,_a,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},1564,[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)}.`}},1565,[17,85,780,777,804,1564,1562,8]); __d(function(_g,_r,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}]},1566,[17,264,385,85,780,777,858,876,1567,915,1211,1461,804,1557,1055,1564,1568,1562,1565,1563,8]); diff --git a/owner-desktop/index.html b/owner-desktop/index.html index e5e56a39297f67433143b6be5e2b58e3203c3f4e..b6ffa52cbc5f1e290a0a6c25cbfa82a2a4acaa99 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 5fc1d2d7b2c7be740bddbf04b8b44d0d6a09438f..2e63485181c1db0aa92647e6f241aa5e189e9fa5 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 562196eaf2bcfea34d4a76eafb922389b06c6fce..1e33aa489c9bbc1e6f2ffc8318e307271dade500 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-f8c07ee932"; +const V = "cc-desk-88fb95cdd1"; 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=f8c07ee932874bd947410a80ed345ba2ad3048379ba51db7d15fa1a0ccebcde4"]; +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=88fb95cdd1e735eadf96a296c48968ab8f56b4e8528f8bb2f12d63ed81644805"]; // 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 c8d11cde1f616a53667aab274b871122b3b23cd2..400e87dedb3fb657cfdbb710f1981334b1e99668 100644 --- a/staff-app/_expo/static/js/web/bundle.js +++ b/staff-app/_expo/static/js/web/bundle.js @@ -1058,7 +1058,7 @@ __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule' __d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setClockServer=function(t){s=t,c()},e.markClockUnsent=function(t){o.set(t,Date.now()),c()},e.markClockSent=function(t){o.delete(t)&&c()},e.clockNotSent=l,e.useClockNotSent=function(o){const[,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.205'},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.206'},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 c}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await u().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=u().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(r&&'stock_events'===t.table&&'23503'===r.code&&/undoes/i.test(String(r.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const r=await n.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r.error&&s(r.error,r.status),'ok'}return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:o,error:c,status:l}=await r.select();c&&s(c,l);return'update'!==t.kind||o&&0!==o.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]);const u=()=>(0,n.getSupabase)();class c{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(t){return s.cache.rows(this.table,t)}get(t,n){return s.cache.get(this.table,t,n)}subscribe(t,n){return s.cache.subscribe(this.table,t,n)}hydrate(t){return s.cache.hydrate(this.table,t)}async refresh(n,r={}){const c=()=>{let t=u().from(this.table).select('*').eq(this.venueCol,n);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),r.filter&&(t=r.filter(t)),t},l='bookings'===this.table?await(0,t.readPages)(async(t,s)=>{const{data:n,error:r}=await c().order('id').range(t,s);if(r)throw r;return n??[]}):await(async()=>{const{data:t,error:s}=await c().limit(this.opts.limit??1e3);if(s)throw s;return t??[]})();return s.cache.replace(this.table,n,l.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),l}async create(t,n){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,r.uuid)()}:{},...n,[this.venueCol]:t},c=this.keyOf(u);return s.cache.put(this.table,t,c,u),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(t,n,r,u={}){const c=s.cache.get(this.table,t,n),l={...this.matchFor(n,c),...u,[this.venueCol]:t};s.cache.patch(this.table,t,n,{...r,updated_at:(new Date).toISOString()}),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:n,values:r,match:l})}async remove(t,n){const r=s.cache.get(this.table,t,n),u={...this.matchFor(n,r),[this.venueCol]:t};s.cache.remove(this.table,t,n),await o.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},979,[980,981,928,972,976]); __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]); @@ -1166,17 +1166,17 @@ __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,"useChatOpen",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)()(t=>({request:n=>t({ch:n})}))},1083,[831]); __d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},1084,[912,17,1010,876,816,913,927,1066,916,1065]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:u}){const h=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const f=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==u||'seated'!==s.status||s.date!==(0,c.venueYmd)(new Date)||!(0,l.hasAllergens)(s)||h.current.has(s.id))continue;const n=f.get(s.id);n&&'seated'!==n&&(h.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} Covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[u]),null},e.useKitchenTodoChime=function(t,c,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=c&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,u.soundAllowed)()&&(0,u.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} Covers \xb7 ${t.date===c?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6])},1085,[843,17,916,858,1053,863,1016]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:s,today:o,by:S,app:j}){const $=(0,n.useBookings)(s).filter(e=>e.date===o&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),w=$.reduce((e,t)=>e+(t.diet?.vegan??0),0),T=$.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,x.jsxs)(a.default,{style:{gap:12},testID:"todays-bookings",children:[(0,x.jsx)(p.CoversToday,{rid:s}),(0,x.jsx)(b.PlattersBooked,{rid:s,date:o,label:"Platters booked today"}),w||T?(0,x.jsxs)(l.T,{colour:h.colours.ok,children:["\u24cb ",w?`${w} vegan`:'',w&&T?' \xb7 ':'',T?`${T} vegetarian`:''," today"]}):null,(0,x.jsx)(b.KitchenSignoffs,{rid:s,today:o,by:S,app:j,showAll:!0}),$.length?$.map(o=>(0,x.jsxs)(a.default,{testID:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?`kitchen-seated-${o.id}`:`kitchen-booking-${o.id}`,style:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?{gap:6,padding:14,borderRadius:16,...(0,c.seatedHighlightStyle)()}:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface,opacity:'finished'===o.status?.55:1},children:[(0,x.jsxs)(l.T,{weight:"semibold",colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,accessibilityLabel:`${o.time}, ${o.walkIn?`Walk-in ${o.ref}`:o.name}, ${o.partySize} Covers${o.table?`, ${(0,e.tableNumbersA11y)(o.table)}`:''}`,children:[o.time," \xb7 ",o.walkIn?`Walk-in ${o.ref}`:o.name," \xb7 ",o.partySize," Covers",o.table?` \xb7 ${(0,e.tableNumbers)(o.table)}`:'']}),(0,x.jsx)(t.DepositChip,{b:o,money:!0,testID:`kitchen-deposit-${o.id}`}),(0,x.jsx)(k.BookingTableButton,{rid:s,booking:o,readOnly:'chef'===j}),'chef'!==j&&o.walkIn?(0,x.jsx)(y.CancelWalkInButton,{rid:s,b:o,small:!0}):null,o.notes?(0,x.jsxs)(l.T,{size:16,colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,testID:`kitchen-notes-${o.id}`,children:["Notes: ",o.notes]}):null,(0,x.jsx)(f.BookingEditButton,{rid:s,booking:o,who:S,inStaffApp:'staff'===j}),(0,x.jsx)(b.BookingNeeds,{b:o}),'seated'===(0,u.shownStatus)(o)?(0,x.jsx)(l.T,{weight:"semibold",colour:c.SEATED_FG,children:"Seated"}):'finished'===o.status?(0,x.jsx)(l.Muted,{children:"Finished"}):null]},o.id)):(0,x.jsx)(l.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var s,o=r(d[3]),a=(s=o)&&s.__esModule?s:{default:s},l=r(d[4]),n=r(d[5]),u=r(d[6]),h=r(d[7]),c=r(d[8]),b=r(d[9]),k=r(d[10]),y=r(d[11]),f=r(d[12]),p=r(d[13]),x=r(d[14])},1086,[843,1087,17,85,777,858,1053,804,1088,1076,1089,1114,1119,1070,8]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:s,today:o,by:S,app:j}){const $=(0,n.useBookings)(s).filter(e=>e.date===o&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),w=$.reduce((e,t)=>e+(t.diet?.vegan??0),0),T=$.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,x.jsxs)(a.default,{style:{gap:12},testID:"todays-bookings",children:[(0,x.jsx)(p.CoversToday,{rid:s}),(0,x.jsx)(b.PlattersBooked,{rid:s,date:o,label:"Platters booked today"}),w||T?(0,x.jsxs)(l.T,{colour:h.colours.ok,children:["\u24cb ",w?`${w} vegan`:'',w&&T?' \xb7 ':'',T?`${T} vegetarian`:''," today"]}):null,(0,x.jsx)(b.KitchenSignoffs,{rid:s,today:o,by:S,app:j,showAll:!0}),$.length?$.map(o=>(0,x.jsxs)(a.default,{testID:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?`kitchen-seated-${o.id}`:`kitchen-booking-${o.id}`,style:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?{gap:6,padding:14,borderRadius:16,...(0,c.seatedHighlightStyle)()}:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface,opacity:'finished'===o.status?.55:1},children:[(0,x.jsxs)(l.T,{weight:"semibold",colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,accessibilityLabel:`${o.time}, ${o.walkIn?`Walk-in ${o.ref}`:o.name}, ${o.partySize} Covers${o.table?`, ${(0,e.tableNumbersA11y)(o.table)}`:''}`,children:[o.time," \xb7 ",o.walkIn?`Walk-in ${o.ref}`:o.name," \xb7 ",o.partySize," Covers",o.table?` \xb7 ${(0,e.tableNumbers)(o.table)}`:'']}),(0,x.jsx)(t.DepositChip,{b:o,money:!0,testID:`kitchen-deposit-${o.id}`}),(0,x.jsx)(k.BookingTableButton,{rid:s,booking:o,readOnly:'chef'===j}),'chef'!==j&&o.walkIn?(0,x.jsx)(y.CancelWalkInButton,{rid:s,b:o,small:!0}):null,o.notes?(0,x.jsxs)(l.T,{size:16,colour:(0,c.isSeatedHighlight)((0,u.shownStatus)(o))?c.SEATED_FG:h.colours.text,testID:`kitchen-notes-${o.id}`,children:["Notes: ",o.notes]}):null,(0,x.jsx)(f.BookingEditButton,{rid:s,booking:o,who:S,inStaffApp:'staff'===j}),(0,x.jsx)(b.BookingNeeds,{b:o}),'seated'===(0,u.shownStatus)(o)?(0,x.jsx)(l.T,{weight:"semibold",colour:c.SEATED_FG,children:"Seated"}):'finished'===o.status?(0,x.jsx)(l.Muted,{children:"Finished"}):null]},o.id)):(0,x.jsx)(l.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var s,o=r(d[3]),a=(s=o)&&s.__esModule?s:{default:s},l=r(d[4]),n=r(d[5]),u=r(d[6]),h=r(d[7]),c=r(d[8]),b=r(d[9]),k=r(d[10]),y=r(d[11]),f=r(d[12]),p=r(d[13]),x=r(d[14])},1086,[843,1087,17,85,777,858,1053,804,1088,1076,1089,1115,1120,1070,8]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DepositChip=function({b:e,money:o,big:n,testID:b}){const f=(0,s.depositView)(e,o);if(!f)return null;const h={gold:[t.colours.goldTint,t.colours.goldLight,t.colours.gold],amber:[t.colours.amberBg,'#FFE2A8',t.colours.amber],red:[t.colours.redBg,'#FFD9D4',t.colours.red],neutral:[t.colours.surface2,t.colours.muted,t.colours.border]}[f.kind];return(0,u.jsxs)(l.default,{accessible:!0,accessibilityRole:"text",accessibilityLabel:f.a11y,testID:b??'deposit-chip',style:{alignSelf:'flex-start',maxWidth:'100%'},children:[(0,u.jsx)(l.default,{style:{backgroundColor:h[0],borderColor:h[2],borderWidth:n?2:1,borderRadius:8,paddingHorizontal:n?12:8,paddingVertical:n?6:3},children:(0,u.jsx)(c.T,{size:16,weight:"semibold",colour:h[1],children:f.label})}),f.note?(0,u.jsx)(c.Muted,{size:12,children:f.note}):null]})},r(d[0]);var e,o=r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),c=r(d[4]),u=r(d[5])},1087,[17,85,841,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEATED_BG",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SEATED_FG",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEATED_MUTED",{enumerable:!0,get:function(){return u}}),e.isSeatedHighlight=function(t,o){return'seated'===t&&!o?.otherDay},e.seatedHighlightStyle=function(u){return{backgroundColor:o,borderColor:t.colours.goldLight,borderWidth:1.5,borderLeftWidth:8,borderLeftColor:n,...u}};var t=r(d[0]);const o=t.colours.gold,n=t.colours.onGold,u='#3F3218'},1088,[804]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f,canClear:h=!0}){const[j,k]=(0,t.useState)(!1),x=(0,s.tableButtonLabel)(l.table),_=f??`table-btn-${l.id}`;if(y)return(0,b.jsx)(n.default,{testID:_,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,b.jsx)(u.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:x})});return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u.Button,{kind:"secondary",label:x,testID:_,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>k(!0),style:{minHeight:44}}),j?(0,b.jsx)(c.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>k(!1),canClear:h}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6])},1089,[17,85,1090,804,1091,777,8]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const u={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(u)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(u,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}}),e.splitChoices=function(t){const n=String(t??'').split('+').map(t=>t.trim()).filter(Boolean);return n.length>1?[...new Set(n)]:[]};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1090,[843,1074]); -__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,t,s){const l=(0,p.tableKey)(s);if('finished'===t.status&&l)return void await(0,j.restoreFinishedToTable)(e,t,s);const o=(0,g.tablesOf)(t.table);await h.repo.bookings.update(t.id,(0,y.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(t=>g.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,m.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:m=90,onClose:T,onSaved:S,onPickOnPlan:L,canClear:P=!0}){const W=(0,g.usePlan)(e),z=(0,h.useBookings)(e),[D,I]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),R=(0,l.useMemo)(()=>(0,p.pickGroups)(W),[W]),B=z.filter(e=>e.date===y.date),O=(0,p.seatsOf)(W,D),N=(0,p.seatLine)(O.total,y.partySize),F=(0,p.pickClashes)(y,D,B,m),M=e=>(0,p.pickClashes)(y,[e],B,m)[0]?.with,Y=(0,p.tableKey)(D)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,C.useBlocks)(e=>e.blocks),A=(0,C.blockAt)(_,e,y.date,y.time),[G,K]=(0,l.useState)(null),E=e=>{K(null),I(t=>(0,p.toggleTable)(t,e))},[H]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{H&&(0,c.announce)(`Tables can't be saved: ${H}.`)},[H]);const[U,V]=(0,l.useState)(!1),[q,J]=(0,l.useState)(!1),Q=async t=>{(0,o.guardBookingChange)(S,{b:y,tables:t})?(V(!0),T(),await(0,o.saveTablesReported)(e,y,t,f,(0,p.seatsOf)(W,t).total,e=>S?.(e))):T()},X=(0,w.jsxs)(u.default,{style:{gap:8},children:[(0,w.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(D)} picked. ${N.text}.`,children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(D)}),(0,w.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:N.text})]}),A?(0,w.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,w.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,F.length?(0,w.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(F)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,w.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(F)," You can still save."]})}):null,q?(0,w.jsx)(j.RestoreSeatedConfirm,{prompt:(0,v.restoreSeatedPrompt)(f,(0,p.tableKey)(D)),onYes:()=>{J(!1),Q(D)},onNo:()=>J(!1)}):null,G?(0,w.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:G,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,w.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:G}),(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(D)} for ${f}, ${y.partySize} people`,disabled:U,onPress:()=>{Q(D)},style:[$,{flexGrow:1}]}),(0,w.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>K(null),style:$})]})]}):null,(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[G?null:(0,w.jsx)(x.Button,{testID:"table-pick-save",label:U?'Saving\u2026':F.length?'Save anyway':'Save tables',disabled:!Y||!D.length||U,accessibilityLabel:`${F.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(D)} for ${f}. ${N.text}.${F.length?` ${(0,p.clashWords)(F)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(S,{b:y,tables:D}))return void T();const e=(0,p.overCapacityAsk)(D,O.total,y.partySize);!e||G?'finished'!==y.status||!D.length||q?Q(D):J(!0):K(e)},style:[$,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&P?(0,w.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:U,onPress:()=>Q([]),style:$}):null,(0,w.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:T,style:$})]})]});return(0,w.jsxs)(x.Sheet,{visible:!0,onClose:T,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:X,children:[(0,w.jsx)(t.TableNumberWarning,{plan:W}),H?(0,w.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${H}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,w.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${H}.`})}):null,(0,w.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),L?(0,w.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>L(D),style:$}):null,R.map(e=>(0,w.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,w.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,w.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=D.includes(e.name),l=M(e.name);return(0,w.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,t,l),onPress:()=>E(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",colour:t?k.colours.onGold:k.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,w.jsxs)(x.T,{size:14,colour:t?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),R.length?null:(0,w.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),m=r(d[15]),j=r(d[16]),v=r(d[17]),C=r(d[18]),w=r(d[19]);const $={minHeight:56}},1091,[1092,843,17,1093,899,1095,385,85,858,996,1090,1094,804,863,777,1096,1112,1111,993,8]); +__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=async function(e,t,s){const l=(0,p.tableKey)(s);if('finished'===t.status&&l)return void await(0,j.restoreFinishedToTable)(e,t,s);const o=(0,g.tablesOf)(t.table);await h.repo.bookings.update(t.id,(0,y.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,f.venueYmd)(new Date)&&(o.filter(e=>!(0,g.tablesOf)(l).includes(e)).forEach(t=>g.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,m.resetTableLive)(e,l))},_e.TablePicker=function({rid:e,booking:y,name:f,turnBase:m=90,onClose:T,onSaved:S,onPickOnPlan:L,canClear:P=!0}){const W=(0,g.usePlan)(e),z=(0,h.useBookings)(e),[D,I]=(0,l.useState)(()=>(0,g.tablesOf)((0,p.tableKey)((0,g.tablesOf)(y.table)))),R=(0,l.useMemo)(()=>(0,p.pickGroups)(W),[W]),B=z.filter(e=>e.date===y.date),O=(0,p.seatsOf)(W,D),N=(0,p.seatLine)(O.total,y.partySize),F=(0,p.pickClashes)(y,D,B,m),M=e=>(0,p.pickClashes)(y,[e],B,m)[0]?.with,Y=(0,p.tableKey)(D)!==(0,p.tableKey)((0,g.tablesOf)(y.table)),_=(0,C.useBlocks)(e=>e.blocks),A=(0,C.blockAt)(_,e,y.date,y.time),[G,K]=(0,l.useState)(null),E=e=>{K(null),I(t=>(0,p.toggleTable)(t,e))},[H]=(0,l.useState)(()=>(0,n.bookingSaveBlocker)());(0,l.useEffect)(()=>{H&&(0,c.announce)(`Tables can't be saved: ${H}.`)},[H]);const[U,V]=(0,l.useState)(!1),[q,J]=(0,l.useState)(!1),Q=async t=>{(0,o.guardBookingChange)(S,{b:y,tables:t})?(V(!0),T(),await(0,o.saveTablesReported)(e,y,t,f,(0,p.seatsOf)(W,t).total,e=>S?.(e))):T()},X=(0,w.jsxs)(u.default,{style:{gap:8},children:[(0,w.jsxs)(u.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,p.tablesWords)(D)} picked. ${N.text}.`,children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",center:!0,colour:k.colours.goldLight,children:(0,p.tablesWords)(D)}),(0,w.jsx)(x.T,{size:17,center:!0,colour:k.colours.text,children:N.text})]}),A?(0,w.jsx)(u.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${A.from} to ${A.to}${A.reason?` (${A.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.goldMuted},children:(0,w.jsxs)(x.T,{size:16,center:!0,colour:k.colours.goldLight,children:["New bookings paused ",A.from,"\u2013",A.to,A.reason?` \xb7 ${A.reason}`:'',". You can still save tables for this booking."]})}):null,F.length?(0,w.jsx)(u.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,p.clashWords)(F)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:k.colours.gold},children:(0,w.jsxs)(x.T,{size:16,weight:"semibold",center:!0,colour:k.colours.goldLight,children:[(0,p.clashWords)(F)," You can still save."]})}):null,q?(0,w.jsx)(j.RestoreSeatedConfirm,{prompt:(0,v.restoreSeatedPrompt)(f,(0,p.tableKey)(D)),onYes:()=>{J(!1),Q(D)},onNo:()=>J(!1)}):null,G?(0,w.jsxs)(u.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:G,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:k.colours.gold,backgroundColor:k.colours.amberBg,alignItems:'stretch'},children:[(0,w.jsx)(x.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:G}),(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(x.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,p.tablesWords)(D)} for ${f}, ${y.partySize} people`,disabled:U,onPress:()=>{Q(D)},style:[$,{flexGrow:1}]}),(0,w.jsx)(x.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>K(null),style:$})]})]}):null,(0,w.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[G?null:(0,w.jsx)(x.Button,{testID:"table-pick-save",label:U?'Saving\u2026':F.length?'Save anyway':'Save tables',disabled:!Y||!D.length||U,accessibilityLabel:`${F.length?'Save anyway, ':'Save, '}${(0,p.tablesWords)(D)} for ${f}. ${N.text}.${F.length?` ${(0,p.clashWords)(F)}`:''}`,onPress:()=>{if(!(0,o.guardBookingChange)(S,{b:y,tables:D}))return void T();const e=(0,p.overCapacityAsk)(D,O.total,y.partySize);!e||G?'finished'!==y.status||!D.length||q?Q(D):J(!0):K(e)},style:[$,{flexGrow:1}]}),(0,g.tablesOf)(y.table).length&&P?(0,w.jsx)(x.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,p.tablesWords)((0,g.tablesOf)(y.table)).toLowerCase()} off ${f}`,disabled:U,onPress:()=>Q([]),style:$}):null,(0,w.jsx)(x.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:T,style:$})]})]});return(0,w.jsxs)(x.Sheet,{visible:!0,onClose:T,title:`Tables \xb7 ${y.time} ${f} \xb7 ${y.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:X,children:[(0,w.jsx)(t.TableNumberWarning,{plan:W}),H?(0,w.jsx)(u.default,{testID:"table-pick-blocked",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:`Tables can't be saved: ${H}.`,style:{padding:12,borderRadius:12,borderWidth:2,borderColor:k.colours.red,backgroundColor:'#3a1210'},children:(0,w.jsx)(x.T,{size:16,weight:"semibold",center:!0,colour:"#FFD2CC",children:`Tables can't be saved: ${H}.`})}):null,(0,w.jsx)(x.T,{size:16,center:!0,colour:k.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),L?(0,w.jsx)(x.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${f}`,onPress:()=>L(D),style:$}):null,R.map(e=>(0,w.jsxs)(u.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,w.jsx)(x.T,{size:15,weight:"semibold",center:!0,colour:k.colours.gold,children:e.area}),(0,w.jsx)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=D.includes(e.name),l=M(e.name);return(0,w.jsxs)(b.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,p.pickA11y)(e.name,e.seats,t,l),onPress:()=>E(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:t?2:1,borderColor:t?k.colours.gold:l?k.colours.goldMuted:k.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?k.colours.gold:e?k.colours.tilePressed:k.colours.tile}),children:[(0,w.jsx)(x.T,{size:18,weight:"semibold",colour:t?k.colours.onGold:k.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,w.jsxs)(x.T,{size:14,colour:t?k.colours.onGold:k.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),R.length?null:(0,w.jsx)(x.Muted,{center:!0,children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var t=r(d[0]),s=r(d[1]),l=r(d[2]),o=r(d[3]),n=r(d[4]),c=r(d[5]),b=e(r(d[6])),u=e(r(d[7])),h=r(d[8]),g=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]),m=r(d[15]),j=r(d[16]),v=r(d[17]),C=r(d[18]),w=r(d[19]);const $={minHeight:56}},1091,[1092,843,17,1093,899,1095,385,85,858,996,1090,1094,804,863,777,1096,1113,1111,993,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},1092,[17,842,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.guardBookingChange=w,_e.saveTablesReported=async function(e,t,n,o,s,u){if(!w(u,{b:t,tables:n}))return!1;const v=n.length?(0,h.notSavedWhat)({...t,name:o,table:n.join('+')}):`Taking the table off ${o}`;u(`Saving ${v}\u2026`);try{await(0,b.saveBookingTables)(e,t,n)}catch(e){const t=`${v} did not save: ${String(e?.message??e).slice(0,120)}`;return u(t),(0,l.announce)(t),!1}const y=await(0,c.waitForBookingSave)(t.id);if('saved'===y.state||'local'===y.state){const e=(0,r.savedWords)(o,t.partySize,n,s);return u(e),(0,l.announce)(e),!0}const k='waiting'===y.state?`${v}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${v} did not save. ${f("why"in y?y.why:"the shared system did not take it")}. Tap the red banner to try again.`;return u(k),(0,l.announce)(k),!1},_e.reportBookingSave=async function(e,t,n,o){const s=await(0,c.waitForBookingSave)(e);if('saved'===s.state||'local'===s.state)return o(t),(0,l.announce)(t),!0;const r='waiting'===s.state?`${n}: not saved yet. It saves by itself when the connection is back; a red banner shows if it fails.`:`${n} did not save. ${f('why'in s?s.why:'the shared system did not take it')}. Tap the red banner to try again.`;return o(r),(0,l.announce)(r),!1},_e.BookingSaveBanner=function({rid:e,testID:r="booking-save-banner",margin:c}){const b=(0,h.useBookingSaves)(e=>e.notSaved),w=(0,s.useBookings)(e).filter(e=>b[e.id]).map(e=>void 0!==b[e.id].want?{...e,table:b[e.id].want||void 0}:e),{msg:S,retry:$}=k(),m=(0,t.useRef)(''),p=w.map(e=>(0,h.notSavedLine)(e)),B=w.map(e=>e.id).sort().join(',');if((0,t.useEffect)(()=>{B&&B!==m.current&&(0,l.announce)(1===w.length?p[0]:`${w.length} booking changes did not save. Tap the red banner to try again.`),m.current=B},[B]),!w.length)return null;const j=1===w.length?p[0]:`${w.length} booking changes did not save. Tap to try again.`;return(0,y.jsx)(n.default,{testID:r,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${j}${w.length>1?` ${w.map(e=>(0,h.notSavedWhat)(e)).join('. ')}.`:''} ${f(b[w[0].id].why)}.`,onPress:$,style:{...c??{},alignSelf:'stretch',gap:4,padding:12,borderRadius:12,borderWidth:2,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:(0,y.jsxs)(o.default,{accessibilityRole:"alert",style:{alignItems:'center',gap:4},children:[(0,y.jsx)(v.T,{testID:`${r}-title`,size:17,weight:"semibold",center:!0,colour:"#FFD2CC",children:j}),w.length>1?w.slice(0,6).map(e=>(0,y.jsx)(v.T,{testID:`${r}-line`,size:15,center:!0,colour:"#FFD2CC",children:(0,h.notSavedWhat)(e)},e.id)):null,(0,y.jsx)(v.T,{testID:`${r}-why`,size:14,center:!0,colour:"#FFB3AA",children:w.length>1?`${f(b[w[0].id].why)}${w.length>6?` \xb7 and ${w.length-6} more`:''}`:f(b[w[0].id].why)}),S?(0,y.jsx)(v.T,{testID:`${r}-msg`,size:14,center:!0,colour:u.colours.goldLight,children:S}):null]})})},_e.BookingNotSavedLine=function({b:e}){const t=(0,h.useBookingSaves)(t=>t.notSaved[e.id]),{msg:o,retry:s}=k();if(!t)return null;void 0!==t.want&&(e={...e,table:t.want||void 0});return(0,y.jsxs)(n.default,{testID:`booking-not-saved-${e.id}`,accessibilityRole:"button",accessibilityLiveRegion:"assertive",accessibilityLabel:`${(0,h.notSavedLine)(e)} ${f(t.why)}.`,onPress:s,style:{alignSelf:'stretch',padding:8,borderRadius:10,borderWidth:1.5,borderColor:u.colours.red,backgroundColor:'#3a1210',alignItems:'center'},children:[(0,y.jsx)(v.T,{size:15,weight:"semibold",center:!0,colour:"#FFD2CC",children:(0,h.notSavedLine)(e)}),o?(0,y.jsx)(v.T,{size:13,center:!0,colour:u.colours.goldLight,children:o}):null]})};var t=_r(d[0]),n=e(_r(d[1])),o=e(_r(d[2])),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),b=_r(d[9]),v=_r(d[10]),y=_r(d[11]);const f=e=>e.charAt(0).toUpperCase()+e.slice(1);function w(e,t){const n=(0,c.bookingSaveBlocker)();if(!n)return!0;t&&h.useBookingSaves.getState().mark({id:t.b.id,table:t.b.walkIn?'walk_ins':'bookings',why:n,...t.tables?{want:t.tables.join('+')}:{}});const o=`${t?(0,h.notSavedWhat)({...t.b,...t.tables?{table:t.tables.join('+')||void 0}:{}}):'This change'} did not save: ${n}.`;return e?.(o),(0,l.announce)(o),!1}function k(){const[e,n]=(0,t.useState)('');return{msg:e,retry:async()=>{n('Saving\u2026'),(0,l.announce)('Saving');const e=await(0,c.saveBookingsNow)(!0),t=e?`Not saved: ${e}.`:h.useBookingSaves.getState().count()?'Sent again. The banner clears when the shared system takes it.':'Nothing is left waiting. Check the plan and make the change again if it is not there.';n(t),(0,l.announce)(t)}}}},1093,[17,385,85,858,1094,1095,899,983,804,1091,777,8]); __d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=u,e.requestedFreeTable=function(t,n,a,s,l=90){const o={id:n.id??'new',status:'confirmed',...n};for(const n of t)if(a.includes(n)&&!u(o,[n],s,l).length)return n;return null},e.overCapacityAsk=function(n,s,l){const u=a(o(n));if(!u.length||s>=l)return null;const c=u.map(n=>(0,t.tableNumbers)(n));return`${1===c.length?`Table ${c[0]} seats`:`Tables ${c.slice(0,-1).join(', ')} and ${c[c.length-1]} seat`} ${s} \u2013 this booking is ${l}. Use it anyway?`},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=c,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${c(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${c(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${c(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))}function c(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1094,[843,1074]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.primeAnnouncer=function(){u()},_e.announce=function(t){const e=String(t??'').trim();if(!e)return;{const t=u();if(!t)return;const n=++o;return t.textContent='',void setTimeout(()=>{n===o&&(t.textContent=e)},80)}},Object.defineProperty(_e,"lastAnnounced",{enumerable:!0,get:function(){return c}});var t,e=r(d[0]);(t=e)&&t.__esModule;r(d[1]);let n=null,o=0;function u(){if('undefined'==typeof document||!document.body)return null;if(n&&document.body.contains(n))return n;const t=document.createElement('div');return t.id='cc-announcer',t.setAttribute('aria-live','assertive'),t.setAttribute('aria-atomic','true'),t.setAttribute('role','status'),t.setAttribute('data-testid','cc-announcer'),Object.assign(t.style,{position:'absolute',width:'1px',height:'1px',margin:'-1px',padding:'0',overflow:'hidden',clip:'rect(0 0 0 0)',whiteSpace:'nowrap',border:'0'}),document.body.appendChild(t),n=t,t}const c=()=>n?.textContent??''},1095,[264,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,"TABLES",{enumerable:!0,get:function(){return A}}),_e.useTableNames=R,_e.resetTableLive=W,_e.seatBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'seated'),W(e,t.table)},_e.finishBookingNow=async function(e,t){const s=(new Date).toISOString();await k.repo.bookings.update(t.id,(0,N.finishClearPatch)(s,t.table)),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=E,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return _}}),_e.TablePicker=H,_e.WalkInSheet=q,_e.AssignTableSheet=G,_e.undoNotice=Y,_e.NewBookingSheet=V,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[n,i]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>i({b:e}),combineTables:e=>i({b:e,combine:!0}),elements:(0,L.jsxs)(L.Fragment,{children:[s?(0,L.jsx)(q,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,L.jsx)(V,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,L.jsx)(G,{booking:n.b,combine:n.combine,onClose:()=>i(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),z=_r(_d[29]),B=_r(_d[30]),M=_r(_d[31]),N=_r(_d[32]),L=_r(_d[33]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),A=Array.from({length:12},(e,t)=>String(t+1));function R(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function W(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function E(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=R(e),a=(0,v.useFloor)(t=>t.live[e])??{},n=(0,v.usePlan)(e),i=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(i,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const _=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function H({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=n?6:8,f=n?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(i??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,L.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],i=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!i,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,L.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:i?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,L.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,L.jsx)(C.T,{weight:"bold",size:22,colour:i?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,L.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,L.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,L.jsx)(C.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const U=[1,2,3,4,5,6,7,8];function q({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:r,r:d,now:u}=(0,y.useCtx)(15e3),x=E(r,u),[T,I]=(0,c.useState)(2),[P,$]=(0,c.useState)(!1),[O,z]=(0,c.useState)(i??null),B=(0,v.usePlan)(r),N=(0,k.useBookings)(r),A=(0,D.useBlocks)(e=>e.blocks),R=(0,D.closedAreasAt)(A,r,(0,w.ymd)(u),(0,w.hm)(u)),_=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(x).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(B,N.filter(e=>e.date===(0,w.ymd)(u)),e,T,u,(0,j.turnFor)(T,d.settings.turnMins),90,void 0,{closed:R})?.table??null},[B,N,x,T,R.size,u.getTime()]);(0,c.useEffect)(()=>{O&&(0,v.tablesOf)(O).some(e=>'Closed'===x[e]?.label)&&z(null)},[O,R.size]);const[q,G]=(0,c.useState)(!1),[Y,V]=(0,c.useState)(''),K=(e,t=String(e),s=()=>{$(!1),I(e)})=>{const o='9+'===t?P:!P&&T===e;return(0,L.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,L.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},Q=(0,L.jsx)(s.PartySizeInput,{value:T,onChange:I,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),X=(0,L.jsxs)(m.default,{style:{gap:8,width:n?256:void 0},children:[(0,L.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,L.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[U.map(e=>K(e)),K(9,'9+',()=>{$(!0),I(e=>e>=9?e:9)})]}),P?Q:null]}),[J,Z]=(0,c.useState)(!1),ee=async(t=O)=>{if(!J&&(0,M.guardBookingChange)(F)){Z(!0);try{const s=await k.repo.bookings.seatWalkIn(r,T,t??void 0,Y);W(r,t??void 0),a(s),e()}finally{Z(!1)}}},te=(0,L.jsxs)(m.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,L.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,L.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),O?(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>z(null)}):null]}),(0,L.jsx)(H,{use:x,value:O,onPick:e=>{x[e]&&!x[e].busy?ee(e):z(O===e?null:e)},big:n,dense:n,best:_,bestSet:(0,h.bestTables)(B)}),(0,L.jsxs)(C.Muted,{children:["Tap a free table to seat them there",_&&!O?` (suggested for ${T}: ${(0,l.tableNumbers)(_)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(u)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,L.jsx)(C.Button,{label:`Seat walk-in \xb7 ${T} ${1===T?'person':'people'}${O?` \xb7 ${(0,l.tableNumbers)(O)}`:''}`,disabled:J,onPress:()=>{ee()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,L.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[X,te]}):(0,L.jsxs)(L.Fragment,{children:[X,te]}),(0,L.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[q?(0,L.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:Y,onChangeText:V,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,L.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,L.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,L.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function G({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,y.useCtx)(15e3),i=E(o,n),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(n)),t,e.partySize,n,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,n.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),P=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,$=D.reduce((e,t)=>e+P(t),0),O=D.length>0&&${if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&W(o,l),t()},B=x?(0,L.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,L.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,L.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${$} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,L.jsx)(m.default,{testID:"combine-short",children:(0,L.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-$," more needed. Add another table."]})}):null,(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,L.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,L.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,L.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,L.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,L.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${_(e)}`,testID:"assign-table-sheet",footer:B,children:[f&&!x?(0,L.jsx)(m.default,{testID:"assign-suggested",children:(0,L.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,L.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,L.jsx)(H,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function Y(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${_(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function V({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:N}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const A=(0,w.ymd)(p),[R,W]=(0,c.useState)(ee.blocks),[H,U]=(0,c.useState)(!1),[q,G]=(0,c.useState)(''),[Y,V]=(0,c.useState)(2),[K,Q]=(0,c.useState)(0),X=Math.min(K,Math.max(0,Y-1)),[J,Z]=(0,c.useState)(null),[ee,te]=(0,c.useState)(''),[se,oe]=(0,c.useState)(''),[le,ae]=(0,c.useState)(''),[ne,ie]=(0,c.useState)(!1),[re,de]=(0,c.useState)('phone'),[ue,ce]=(0,c.useState)((0,P.emptyNeeds)()),be=(0,P.needsMissing)(ue),[ge,he]=(0,c.useState)(null),pe=(0,v.usePlan)(b),me=(0,O.dogSetUp)(pe),fe=!0===ue.dog&&me,ye=ue.dog?ue.dogs:0,ke=(0,w.parseYmd)(R),xe=(0,j.turnFor)(Y,h.settings.turnMins),je=E.filter(e=>e.date===R),we=e=>(0,j.dogTablesAt)(pe,je,Y,(0,j.slotStart)(R,e),xe,h.settings.turnMins,(0,D.closedAreasAt)(_,b,R,e)),Se=fe&&J?we(J):[];(0,c.useEffect)(()=>{he(null)},[fe,J,Y]);const Te=(0,x.bookingSlots)(h,ke,e=>E.filter(t=>t.date===R&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Y,R===(0,w.ymd)(p)?p:(0,w.addMins)(ke,0),e=>E.filter(t=>t.date===R&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),Ce=(0,T.guestPhone)(se),[ve,De]=(0,c.useState)(!1),Ie=J?Te.find(e=>e.time===J):void 0,Pe=Ie&&Ie.left=2&&!!J&&(!Oe||ve)&&(0,o.validParty)(Y)&&Ce.ok&&(0,T.emailOk)(le)&&(!ze||Be&&H)&&(!fe||Se.length>0)&&!Me,Le=ue.wheelchair>0||ue.stepFree,Fe=(0,$.bookingRulesOf)(h),Ae=(0,$.largeGroupTables)(Fe,Y),Re=(0,$.dogPartyCheck)(Fe,Y,!0===ue.dog,ue.assistDog),We=(0,$.bookingDepositSplit)((0,n.depositOf)(h.settings),Y,X,(0,P.needsPatch)(ue),(0,O.reservablesOf)(h));return(0,L.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(ke)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,L.jsx)(P.FirstQuestions,{rid:b,value:ue,onChange:ce,party:Y,audience:"staff"}),ue.dog&&!me?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,L.jsx)(I.BookingDatePicker,{r:h,today:p,value:R,onChange:e=>{e!==R&&(W(e),Z(null),U(!1))}}),(0,L.jsxs)(C.Row,{gap:6,children:[(0,L.jsx)(C.Chip,{label:"Phone",selected:'phone'===re,onPress:()=>de('phone')}),(0,L.jsx)(C.Chip,{label:"In person",selected:'in-person'===re,onPress:()=>de('in-person')})]}),(0,L.jsx)(C.Field,{label:"Name",value:q,onChangeText:G,placeholder:"e.g. Reid",testID:"nb-name"}),(0,L.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:se,onChangeText:oe,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!Ce.ok&&se?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:Ce.error}):null,(0,L.jsx)(C.Field,{label:"Email (optional)",value:le,onChangeText:ae,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email",testID:"nb-email"}),(0,T.emailOk)(le)?null:(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),le.trim()&&Fe.marketingOptIn?(0,L.jsx)(C.Toggle,{label:Fe.marketingWords,value:ne,onChange:ie,testID:"nb-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,L.jsx)(i.AdultsChildren,{value:(0,r.peopleOf)(Y,X),onChange:e=>{V(e.partySize),Q(e.children),De(!1)},depositsOn:(0,n.depositOf)(h.settings).on&&(0,n.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:Te.map(e=>{const t=fe&&e.available&&!we(e.time).length||!(0,P.dogTimeOk)(h,E,R,e.time,ye);return(0,L.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(_,b,R,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:J===e.time,onPress:()=>{Z(e.time),U(!1),De(!1)}},e.time)})}),Oe?(0,L.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[Pe?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Y,Pe.left,Pe.time)}):null,$e?(0,L.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)($e.time,$e.cap)}):null,(0,L.jsx)(C.Chip,{label:ve?'Booking over the limit: on':'Book anyway (over the limit)',selected:ve,onPress:()=>De(e=>!e),testID:"nb-over-ok"})]}):null,fe&&J?(0,L.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,L.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,L.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",pe.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),Se.length?pe.areas.filter(e=>Se.some(t=>t.area===e.name)).map(e=>(0,L.jsxs)(m.default,{style:{gap:6},accessibilityLabel:e.name,children:[(0,L.jsxs)(C.T,{size:13,center:!0,colour:S.colours.muted,children:[e.name,e.outdoor?' (outdoor)':'']}),(0,L.jsx)(C.Row,{wrap:!0,gap:6,children:Se.filter(t=>t.area===e.name).map(e=>{const t=Se[0]?.table===e.table;return(0,L.jsx)(C.Chip,{testID:`nb-dog-table-${(0,l.tableNumbers)(e.table)}`,label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.seats} seats${t?' \xb7 best':''}${Le&&(0,O.accessibleSetUp)(pe)&&!(0,O.isAccessible)(pe,e.table)?' \xb7 not step-free':''}`,selected:(ge??Se[0].table)===e.table,onPress:()=>he(e.table)},e.table)})})]},e.id)):(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Y," at ",J,". Try another time."]})]}):null,ze?(0,L.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,L.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",ze.from,"\u2013",ze.to,ze.reason?` (${ze.reason})`:'']}),Be?(0,L.jsx)(C.Chip,{label:H?'Manager override on':'Override and book anyway',selected:H,onPress:()=>U(e=>!e)}):(0,L.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,Te.length?null:(0,L.jsx)(m.default,{testID:"nb-closed",children:(0,L.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(ke)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,L.jsx)(P.MoreQuestions,{rid:b,r:h,value:ue,onChange:ce,party:Y,date:R,time:J,today:(0,w.ymd)(p),bookings:E,audience:"staff",showTables:!1!==h.settings.tableRequests}),Le&&!(0,O.accessibleSetUp)(pe)?(0,L.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,Ae&&!fe?(0,L.jsxs)(C.T,{size:14,colour:S.colours.goldLight,testID:"nb-large-group",children:["Large group: tables ",Ae.join(' + ')," joined."]}):null,Re.ok?null:(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,testID:"nb-dog-cap",children:["Online, a dog booking is for up to ",Fe.dogMaxParty," people. You can still book it here: check where they can sit."]}),(0,L.jsx)(C.Field,{label:"Notes (optional)",value:ee,onChangeText:te,placeholder:Fe.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"nb-notes"}),We.preorders?(0,L.jsxs)(C.Muted,{testID:"nb-preorder-deposit",children:["Pre-order deposit: ",(0,a.gbp)(We.preorders),We.adults?`, plus the group deposit: ${(0,a.gbp)(We.total)} in total`:'',". Staff can waive it."]}):null,(0,n.depositDue)((0,n.depositOf)(h.settings),Y,X)?(0,L.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(h.settings),Y,X))," (",(0,a.gbp)((0,n.depositOf)(h.settings).perPersonPence)," per adult for tables of ",(0,n.depositOf)(h.settings).fromParty,"+ adults",X?`; ${X} ${1===X?'child':'children'} free`:'; children free, and they do not count towards the number that needs a deposit',"). Staff can waive it. Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,L.jsx)(C.Muted,{children:"CoverCharge confirms the guest by email automatically (preview mode: shown in the Outbox, not sent)."}),Me?(0,L.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",J,". Try another time: dogs are very welcome then."]}):null,(0,L.jsx)(C.Button,{label:be.length?be[0]:'Save booking',testID:"nb-save",disabled:!Ne,onPress:()=>{if(R<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,P.needsPatch)(ue),s=ue.tableReq.find(e=>!fe||Se.some(t=>t.table===e)),o=fe?null:(0,B.requestedFreeTable)(ue.tableReq,{date:R,time:J,partySize:Y},pe.tables.map(e=>e.name),je,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:q.trim(),partySize:Y,date:R,time:J,notes:ee.trim(),security:We.total?'deposit':'none',depositPaid:0,...X?{children:X}:{},...We.total?{...(0,$.depositFields)(We),depositPolicy:(0,n.depositWords)((0,n.depositOf)(h.settings),Y,h.name,X).join(' '),depositRefundable:(0,n.depositOf)(h.settings).refundable,depositCutoffHours:(0,n.depositOf)(h.settings).cutoffHours}:{},phone:Ce.pretty,email:le.trim()||void 0,...ne?(0,$.marketingChoice)(le,!0):{},source:re,...e,...Te.find(e=>e.time===J)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...fe?{table:ge??s??Se[0]?.table}:o?{table:o}:{}}).then(e=>(0,z.postNewBookingToKitchen)(e,N)).catch(()=>{}),u?.({date:R,time:J,name:q.trim()}),t()}})]})}},1096,[812,1097,1098,843,851,841,1099,1100,1101,1102,17,842,385,85,856,1055,858,1103,1074,863,804,848,777,996,993,1104,1105,1077,1053,1076,1094,1093,1111,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return R}}),_e.useTableNames=W,_e.resetTableLive=E,_e.seatBookingNow=async function(e,t){await k.repo.bookings.setStatus(t.id,'seated'),E(e,t.table)},_e.finishBookingNow=async function(e,t){const s=(new Date).toISOString();await k.repo.bookings.update(t.id,(0,N.finishClearPatch)(s,t.table)),(0,v.tablesOf)(t.table).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=_,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return H}}),_e.TablePicker=U,_e.WalkInSheet=G,_e.AssignTableSheet=V,_e.undoNotice=Y,_e.NewBookingSheet=K,_e.useFrontDoor=function(e,t){const[s,o]=(0,c.useState)(!1),[l,a]=(0,c.useState)(!1),[n,i]=(0,c.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>i({b:e}),combineTables:e=>i({b:e,combine:!0}),elements:(0,A.jsxs)(A.Fragment,{children:[s?(0,A.jsx)(G,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,A.jsx)(K,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,u.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,w.niceDate)((0,w.parseYmd)(e.date))} at ${e.time}`})}):null,n?(0,A.jsx)(V,{booking:n.b,combine:n.combine,onClose:()=>i(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),b=e(c),h=_r(_d[11]),p=e(_r(_d[12])),m=e(_r(_d[13])),f=_r(_d[14]),y=_r(_d[15]),k=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),S=_r(_d[20]),T=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),D=_r(_d[24]),I=_r(_d[25]),P=_r(_d[26]),$=_r(_d[27]),O=_r(_d[28]),z=_r(_d[29]),B=_r(_d[30]),M=_r(_d[31]),N=_r(_d[32]),L=_r(_d[33]),A=_r(_d[34]);const F=e=>(0,u.notify)({id:'booking-blocked',testID:'booking-blocked-toast',timeoutMs:9e3,icon:'\u26a0',title:e}),R=Array.from({length:12},(e,t)=>String(t+1));function W(e){const t=(0,v.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function E(e,t){(0,v.tablesOf)(t).forEach(t=>v.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function _(e,t){const s=(0,k.useBookings)(e),o=(0,k.useOrders)(e),l=W(e),a=(0,v.useFloor)(t=>t.live[e])??{},n=(0,v.usePlan)(e),i=(0,D.useBlocks)(e=>e.blocks),r=(0,w.ymd)(t),d=(0,D.closedAreasAt)(i,e,r,(0,w.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(n.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,v.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,w.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const H=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function U({use:e,value:t,onPick:s,big:o,best:a,dense:n,bestSet:i,picked:r}){const d=Object.keys(e),[u,b]=(0,c.useState)(0),h=n?6:8,f=n?64:o?92:76,y=u?Math.max(3,Math.floor((u+h)/(f+h))):0,k=y?Math.floor((u-h*(y-1))/y):f,x=new Set(i??[]),j=a?(0,v.tablesOf)(a)[0]:null;return(0,A.jsx)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:h},testID:"table-picker",onLayout:e=>b(Math.floor(e.nativeEvent.layout.width)),children:d.map(o=>{const a=e[o],i=t===o||!!r?.includes(o),d=x.has(o),u=j===o&&!i,c=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,A.jsxs)(p.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${r?i?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${d?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:i,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:k,minHeight:n?58:64,borderRadius:12,borderWidth:i||u?2.5:1.5,paddingVertical:n?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:i||u?S.colours.gold:a.busy?S.colours.red:S.colours.ok,backgroundColor:i?S.colours.goldTint:a.busy?S.colours.redBg:S.colours.surface2,opacity:'Closed'!==a.label||i?1:.55},children:[(0,A.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,A.jsx)(C.T,{weight:"bold",size:22,colour:i?S.colours.goldLight:S.colours.text,children:(0,l.tableNumbers)(o)}),d?(0,A.jsx)(m.default,{testID:"best-table",style:{backgroundColor:S.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,A.jsx)(C.T,{size:11,weight:"bold",colour:S.colours.onGold,children:"BEST"})}):null]}),(0,A.jsx)(C.T,{size:n?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:c})]},o)})})}const q=[1,2,3,4,5,6,7,8];function G({onClose:e,onSeated:a,wide:n,initialTable:i}){const{rid:r,r:d,now:u}=(0,y.useCtx)(15e3),x=_(r,u),[T,I]=(0,c.useState)(2),[P,$]=(0,c.useState)(!1),[O,z]=(0,c.useState)(i??null),B=(0,v.usePlan)(r),N=(0,k.useBookings)(r),L=(0,D.useBlocks)(e=>e.blocks),R=(0,D.closedAreasAt)(L,r,(0,w.ymd)(u),(0,w.hm)(u)),W=b.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(x).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(B,N.filter(e=>e.date===(0,w.ymd)(u)),e,T,u,(0,j.turnFor)(T,d.settings.turnMins),90,void 0,{closed:R})?.table??null},[B,N,x,T,R.size,u.getTime()]);(0,c.useEffect)(()=>{O&&(0,v.tablesOf)(O).some(e=>'Closed'===x[e]?.label)&&z(null)},[O,R.size]);const[H,G]=(0,c.useState)(!1),[V,Y]=(0,c.useState)(''),K=(e,t=String(e),s=()=>{$(!1),I(e)})=>{const o='9+'===t?P:!P&&T===e;return(0,A.jsx)(p.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:n?58:60,height:n?58:56,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?S.colours.gold:'transparent'},children:(0,A.jsx)(C.T,{weight:"bold",size:22,colour:o?S.colours.onGold:S.colours.gold,children:t})},t)},Q=(0,A.jsx)(s.PartySizeInput,{value:T,onChange:I,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),X=(0,A.jsxs)(m.default,{style:{gap:8,width:n?256:void 0},children:[(0,A.jsx)(C.T,{weight:"semibold",children:"How many people?"}),(0,A.jsxs)(m.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[q.map(e=>K(e)),K(9,'9+',()=>{$(!0),I(e=>e>=9?e:9)})]}),P?Q:null]}),[J,Z]=(0,c.useState)(!1),ee=async(t=O)=>{if(!J&&(0,M.guardBookingChange)(F)){Z(!0);try{const s=await k.repo.bookings.seatWalkIn(r,T,t??void 0,V);E(r,t??void 0),a(s),e()}finally{Z(!1)}}},te=(0,A.jsxs)(m.default,{style:{gap:8,flex:n?1:void 0,minWidth:0},children:[(0,A.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(C.T,{weight:"semibold",children:["Table ",(0,A.jsx)(C.T,{colour:S.colours.muted,size:14,children:"(optional)"})]}),O?(0,A.jsx)(C.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>z(null)}):null]}),(0,A.jsx)(U,{use:x,value:O,onPick:e=>{x[e]&&!x[e].busy?ee(e):z(O===e?null:e)},big:n,dense:n,best:W,bestSet:(0,h.bestTables)(B)}),(0,A.jsxs)(C.Muted,{children:["Tap a free table to seat them there",W&&!O?` (suggested for ${T}: ${(0,l.tableNumbers)(W)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,w.hm)(u)}`,maxWidth:n?1100:void 0,testID:"walkin-sheet",children:[(0,A.jsx)(C.Button,{label:`Seat walk-in \xb7 ${T} ${1===T?'person':'people'}${O?` \xb7 ${(0,l.tableNumbers)(O)}`:''}`,disabled:J,onPress:()=>{ee()},testID:"seat-walkin",style:{minHeight:52}}),n?(0,A.jsxs)(C.Row,{gap:16,style:{alignItems:'flex-start'},children:[X,te]}):(0,A.jsxs)(A.Fragment,{children:[X,te]}),(0,A.jsxs)(C.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[H?(0,A.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:V,onChangeText:Y,style:[C.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,A.jsx)(C.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,A.jsx)(m.default,{style:{flex:1,minWidth:220},children:(0,A.jsxs)(C.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==f.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function V({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:n}=(0,y.useCtx)(15e3),i=_(o,n),r=(0,v.usePlan)(o),d=(0,k.useBookings)(o),u=(0,v.tablesOf)(e.table),p=b.default.useMemo(()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,u.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[i,e.table]),f=b.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(p).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,j.suggestTable)(r,d.filter(e=>e.date===(0,w.ymd)(n)),t,e.partySize,n,(0,j.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[r,d,p,e.partySize,n.getTime()]),[x,T]=(0,c.useState)(!!s||u.length>1),[D,I]=(0,c.useState)(u),P=e=>r.tables.find(t=>t.name===e)?.maxSeats??0,$=D.reduce((e,t)=>e+P(t),0),O=D.length>0&&${if(!(0,M.guardBookingChange)(F))return;const l=(0,v.joinTables)(s);await k.repo.bookings.assignTable(e.id,l);u.filter(e=>!s.includes(e)).forEach(t=>v.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&E(o,l),t()},B=x?(0,A.jsxs)(m.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,A.jsx)(m.default,{accessibilityLiveRegion:"polite",children:(0,A.jsx)(C.T,{size:17,weight:"semibold",colour:S.colours.text,children:D.length?`${(0,v.tablesLabel)((0,v.joinTables)(D))} \xb7 ${$} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,A.jsx)(m.default,{testID:"combine-short",children:(0,A.jsxs)(C.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-$," more needed. Add another table."]})}):null,(0,A.jsx)(C.T,{size:15,colour:S.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,A.jsxs)(C.Row,{gap:8,wrap:!0,children:[(0,A.jsx)(C.Button,{label:"Done",testID:"combine-done",disabled:!D.length,accessibilityLabel:D.length?`Done, save ${(0,v.tableCardLabel)((0,v.joinTables)(D))}`:'Done',onPress:()=>z(D)}),(0,A.jsx)(C.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,A.jsx)(m.default,{style:{gap:8},testID:"assign-table-tip",children:(0,A.jsx)(C.T,{size:15,colour:S.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`${x?'Combine tables':'Assign table'} \xb7 ${H(e)}`,testID:"assign-table-sheet",footer:B,children:[f&&!x?(0,A.jsx)(m.default,{testID:"assign-suggested",children:(0,A.jsxs)(C.T,{size:16,weight:"semibold",colour:S.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,v.tableCardLabel)(f)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(f)]})}):null,x?null:(0,A.jsx)(C.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>T(!0)}),(0,A.jsx)(U,{use:p,best:x?null:f,bestSet:(0,h.bestTables)(r),picked:x?D:void 0,onPick:x?e=>I(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await z([e])}})]})}function Y(e){(0,u.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${H(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>k.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function K({date:e,onClose:t,wide:s,onSaved:u}){const{rid:b,r:h,now:p,role:f,meId:N}=(0,y.useCtx)(6e4);(0,d.useBlurOutside)();const R=(0,w.ymd)(p),[W,E]=(0,c.useState)(ee.blocks),[U,q]=(0,c.useState)(!1),[G,V]=(0,c.useState)(''),[Y,K]=(0,c.useState)(2),[Q,X]=(0,c.useState)(0),J=Math.min(Q,Math.max(0,Y-1)),[Z,ee]=(0,c.useState)(null),[te,se]=(0,c.useState)(''),[oe,le]=(0,c.useState)(''),[ae,ne]=(0,c.useState)(''),[ie,re]=(0,c.useState)(!1),[de,ue]=(0,c.useState)('phone'),[ce,be]=(0,c.useState)([]),[ge,he]=(0,c.useState)(''),[pe,me]=(0,c.useState)((0,P.emptyNeeds)()),fe=(0,P.needsMissing)(pe),[ye,ke]=(0,c.useState)(null),xe=(0,v.usePlan)(b),je=(0,O.dogSetUp)(xe),we=!0===pe.dog&&je,Se=pe.dog?pe.dogs:0,Te=(0,w.parseYmd)(W),Ce=(0,j.turnFor)(Y,h.settings.turnMins),ve=_.filter(e=>e.date===W),De=e=>(0,j.dogTablesAt)(xe,ve,Y,(0,j.slotStart)(W,e),Ce,h.settings.turnMins,(0,D.closedAreasAt)(H,b,W,e)),Ie=we&&Z?De(Z):[];(0,c.useEffect)(()=>{ke(null)},[we,Z,Y]);const Pe=(0,x.bookingSlots)(h,Te,e=>_.filter(t=>t.date===W&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),Y,W===(0,w.ymd)(p)?p:(0,w.addMins)(Te,0),e=>_.filter(t=>t.date===W&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),$e=(0,T.guestPhone)(oe),[Oe,ze]=(0,c.useState)(!1),Be=Z?Pe.find(e=>e.time===Z):void 0,Me=Be&&Be.left=2&&!!Z&&(!Le||Oe)&&(0,o.validParty)(Y)&&$e.ok&&(0,T.emailOk)(ae)&&(!Ae||Fe&&U)&&(!we||Ie.length>0)&&!Re,Ee=pe.wheelchair>0||pe.stepFree,He=(0,$.bookingRulesOf)(h),Ue=(0,$.largeGroupTables)(He,Y),qe=(0,$.dogPartyCheck)(He,Y,!0===pe.dog,pe.assistDog),Ge=(0,$.bookingDepositSplit)((0,n.depositOf)(h.settings),Y,J,(0,P.needsPatch)(pe),(0,O.reservablesOf)(h));return(0,A.jsxs)(C.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,w.niceDate)(Te)}`,maxWidth:s?760:void 0,testID:"booking-sheet",children:[(0,A.jsx)(P.FirstQuestions,{rid:b,value:pe,onChange:me,party:Y,audience:"staff"}),pe.dog&&!je?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,A.jsx)(I.BookingDatePicker,{r:h,today:p,value:W,onChange:e=>{e!==W&&(E(e),ee(null),q(!1))}}),(0,A.jsxs)(C.Row,{gap:6,children:[(0,A.jsx)(C.Chip,{label:"Phone",selected:'phone'===de,onPress:()=>ue('phone')}),(0,A.jsx)(C.Chip,{label:"In person",selected:'in-person'===de,onPress:()=>ue('in-person')})]}),(0,A.jsx)(C.Field,{label:"Name",value:G,onChangeText:V,placeholder:"e.g. Reid",testID:"nb-name"}),(0,A.jsx)(C.Field,{label:"Mobile or phone number (needed)",value:oe,onChangeText:le,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!$e.ok&&oe?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:$e.error}):null,(0,A.jsx)(C.Field,{label:"Email (optional)",value:ae,onChangeText:ne,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email",testID:"nb-email"}),(0,T.emailOk)(ae)?null:(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"That email doesn\u2019t look quite right."}),ae.trim()&&He.marketingOptIn?(0,A.jsx)(C.Toggle,{label:He.marketingWords,value:ie,onChange:re,testID:"nb-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,A.jsx)(i.AdultsChildren,{value:(0,r.peopleOf)(Y,J),onChange:e=>{K(e.partySize),X(e.children),ze(!1)},depositsOn:(0,n.depositOf)(h.settings).on&&(0,n.depositOf)(h.settings).perPersonPence>0,testID:"nb-people"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,children:Pe.map(e=>{const t=we&&e.available&&!De(e.time).length||!(0,P.dogTimeOk)(h,_,W,e.time,Se);return(0,A.jsx)(C.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,D.blockAt)(H,b,W,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':null!=e.partiesLeft&&e.partiesLeft<1||e.left<=0?'Full':`${e.left} left`,disabled:(e.past??!e.available)||t,selected:Z===e.time,onPress:()=>{ee(e.time),q(!1),ze(!1)}},e.time)})}),Le?(0,A.jsxs)(m.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[Me?(0,A.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overCapacityNote)(Y,Me.left,Me.time)}):null,Ne?(0,A.jsx)(C.T,{weight:"semibold",colour:S.colours.amber,children:(0,o.overPartiesNote)(Ne.time,Ne.cap)}):null,(0,A.jsx)(C.Chip,{label:Oe?'Booking over the limit: on':'Book anyway (over the limit)',selected:Oe,onPress:()=>ze(e=>!e),testID:"nb-over-ok"})]}):null,we&&Z?(0,A.jsxs)(m.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,A.jsxs)(C.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,A.jsxs)(C.T,{size:13,colour:S.colours.muted,children:["(",xe.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),Ie.length?xe.areas.filter(e=>Ie.some(t=>t.area===e.name)).map(e=>(0,A.jsxs)(m.default,{style:{gap:6},accessibilityLabel:e.name,children:[(0,A.jsxs)(C.T,{size:13,center:!0,colour:S.colours.muted,children:[e.name,e.outdoor?' (outdoor)':'']}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,children:Ie.filter(t=>t.area===e.name).map(e=>{const t=Ie[0]?.table===e.table;return(0,A.jsx)(C.Chip,{testID:`nb-dog-table-${(0,l.tableNumbers)(e.table)}`,label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.seats} seats${t?' \xb7 best':''}${Ee&&(0,O.accessibleSetUp)(xe)&&!(0,O.isAccessible)(xe,e.table)?' \xb7 not step-free':''}`,selected:(ye??Ie[0].table)===e.table,onPress:()=>ke(e.table)},e.table)})})]},e.id)):(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["No dog-friendly table free for ",Y," at ",Z,". Try another time."]})]}):null,Ae?(0,A.jsxs)(m.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,A.jsxs)(C.T,{weight:"semibold",colour:S.colours.amber,children:["Bookings are paused ",Ae.from,"\u2013",Ae.to,Ae.reason?` (${Ae.reason})`:'']}),Fe?(0,A.jsx)(C.Chip,{label:U?'Manager override on':'Override and book anyway',selected:U,onPress:()=>q(e=>!e)}):(0,A.jsx)(C.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,Pe.length?null:(0,A.jsx)(m.default,{testID:"nb-closed",children:(0,A.jsxs)(C.T,{size:14,weight:"semibold",colour:S.colours.amber,children:["Closed on ",(0,w.niceDate)(Te)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,A.jsx)(P.MoreQuestions,{rid:b,r:h,value:pe,onChange:me,party:Y,date:W,time:Z,today:(0,w.ymd)(p),bookings:_,audience:"staff",showTables:!1!==h.settings.tableRequests}),Ee&&!(0,O.accessibleSetUp)(xe)?(0,A.jsx)(C.T,{size:13,colour:S.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,Ue&&!we?(0,A.jsxs)(C.T,{size:14,colour:S.colours.goldLight,testID:"nb-large-group",children:["Large group: tables ",Ue.join(' + ')," joined."]}):null,qe.ok?null:(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,testID:"nb-dog-cap",children:["Online, a dog booking is for up to ",He.dogMaxParty," people. You can still book it here: check where they can sit."]}),(0,A.jsx)(C.T,{size:16,center:!0,children:"VIP or regular"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:L.TAGS.map(e=>{const t=ce.includes(e);return(0,A.jsx)(C.Chip,{label:e,selected:t,testID:`nb-tag-${e}`,onPress:()=>be(t?ce.filter(t=>t!==e):[...ce,e].sort())},e)})}),(0,A.jsx)(C.T,{size:16,center:!0,children:"Occasion"}),(0,A.jsx)(C.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:L.OCCASIONS.map(e=>(0,A.jsx)(C.Chip,{label:e.label,selected:ge===e.id,testID:`nb-occasion-${e.id||'none'}`,onPress:()=>he(e.id)},e.id||'none'))}),(0,A.jsx)(C.Field,{label:"Notes (optional)",value:te,onChangeText:se,placeholder:He.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"nb-notes"}),Ge.preorders?(0,A.jsxs)(C.Muted,{testID:"nb-preorder-deposit",children:["Pre-order deposit: ",(0,a.gbp)(Ge.preorders),Ge.adults?`, plus the group deposit: ${(0,a.gbp)(Ge.total)} in total`:'',". Staff can waive it."]}):null,(0,n.depositDue)((0,n.depositOf)(h.settings),Y,J)?(0,A.jsxs)(C.Muted,{testID:"nb-deposit",children:["Deposit due: ",(0,a.gbp)((0,n.depositDue)((0,n.depositOf)(h.settings),Y,J))," (",(0,a.gbp)((0,n.depositOf)(h.settings).perPersonPence)," per adult for tables of ",(0,n.depositOf)(h.settings).fromParty,"+ adults",J?`; ${J} ${1===J?'child':'children'} free`:'; children free, and they do not count towards the number that needs a deposit',"). Staff can waive it. Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,A.jsx)(C.Muted,{children:"CoverCharge confirms the guest by email automatically (preview mode: shown in the Outbox, not sent)."}),Re?(0,A.jsxs)(C.T,{size:14,colour:S.colours.amber,children:["We already have the most dogs we can look after at ",Z,". Try another time: dogs are very welcome then."]}):null,(0,A.jsx)(C.Button,{label:fe.length?fe[0]:'Save booking',testID:"nb-save",disabled:!We,onPress:()=>{if(W<(0,w.ymd)(p))return;if(!(0,M.guardBookingChange)(F))return;const e=(0,P.needsPatch)(pe),s=pe.tableReq.find(e=>!we||Ie.some(t=>t.table===e)),o=we?null:(0,B.requestedFreeTable)(pe.tableReq,{date:W,time:Z,partySize:Y},xe.tables.map(e=>e.name),ve,h.settings.turnMins);k.repo.bookings.create({restaurantId:b,customerId:null,name:G.trim(),partySize:Y,date:W,time:Z,notes:te.trim(),security:Ge.total?'deposit':'none',depositPaid:0,...J?{children:J}:{},...Ge.total?{...(0,$.depositFields)(Ge),depositPolicy:(0,n.depositWords)((0,n.depositOf)(h.settings),Y,h.name,J).join(' '),depositRefundable:(0,n.depositOf)(h.settings).refundable,depositCutoffHours:(0,n.depositOf)(h.settings).cutoffHours}:{},phone:$e.pretty,email:ae.trim()||void 0,...ie?(0,$.marketingChoice)(ae,!0):{},source:de,...e,...Pe.find(e=>e.time===Z)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...ce.length?{tags:ce}:{},...ge?{occasion:ge}:{},...we?{table:ye??s??Ie[0]?.table}:o?{table:o}:{}}).then(e=>(0,z.postNewBookingToKitchen)(e,N)).catch(()=>{}),u?.({date:W,time:Z,name:G.trim()}),t()}})]})}},1096,[812,1097,1098,843,851,841,1099,1100,1101,1102,17,842,385,85,856,1055,858,1103,1074,863,804,848,777,996,993,1104,1105,1077,1053,1076,1094,1093,1111,1112,8]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,S]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{S(String(e))},[e]);const T=e=>p((0,s.clampParty)(e,b,y)),$=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>T(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:u.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(c.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:u.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?$(-10,'\u221210',"10 fewer people"):null,$(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{S(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&T((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);S(String(e)),T(e)},returnKeyType:"done",blurOnSubmit:!0,onSubmitEditing:e=>{e?.target?.blur?.()},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:u.colours.border,color:u.colours.text,backgroundColor:u.colours.surface,textAlign:'center',fontSize:20,fontFamily:u.fonts.semibold}}),$(1,'+','One more person'),y-b>=20?$(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),u=r(_d[5]),c=r(_d[6]),d=r(_d[7])},1097,[17,385,395,85,1098,804,777,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"overCapacityNote",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"overPartiesNote",{enumerable:!0,get:function(){return b}});const t=100,n=1,o=`Bookings are for ${n} to ${t} people.`,u=o=>'number'==typeof o&&Number.isInteger(o)&&o>=n&&o<=t,c=(o,u=n,c=t)=>{const s=parseInt(String(o??'').replace(/\D/g,'').slice(0,4),10);return Math.max(u,Math.min(c,Number.isFinite(s)?s:u))},s=(o,u=n,c=t)=>Math.max(u,Math.min(c,Math.round(Number(o)||u))),f=(t,n,o)=>n<=0?`${o} is already full for booked Covers. Booking ${t} more goes over the venue\u2019s limit: check tables and staffing.`:`${t} is more than the ${n} Covers left at ${o}. Booking goes over the venue\u2019s limit by ${t-n}: check tables and staffing.`,b=(t,n)=>`${t} already has the most bookings we take at one start time (${n}). Booking another goes over the venue\u2019s limit: check tables and staffing.`},1098,[]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdultsChildren=function({value:e,onChange:t,depositsOn:h,testID:x="people"}){const p=e=>t((0,s.storedPeople)(e)),b=(0,s.totalLine)(e);return(0,o.jsxs)(l.default,{testID:x,style:{gap:8,alignItems:'center',width:'100%'},children:[(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",children:"Adults"}),(0,o.jsx)(n.PartySizeInput,{value:e.adults,min:1,max:(0,s.maxAdults)(e.children),onChange:t=>p({adults:t,children:e.children}),label:"Adults",testID:`${x}-adults`}),(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",children:"Children"}),(0,o.jsx)(n.PartySizeInput,{value:e.children,min:0,max:(0,s.maxKids)(e.adults),onChange:t=>p({adults:e.adults,children:t}),label:"Children",testID:`${x}-children`}),(0,o.jsx)(u.T,{size:18,center:!0,weight:"semibold",colour:c.colours.goldLight,testID:`${x}-total`,accessibilityLabel:b,children:b}),h?(0,o.jsx)(u.Muted,{center:!0,children:"Children never pay a deposit."}):null]})},r(d[0]);var e,t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),u=r(d[4]),c=r(d[5]),o=r(d[6])},1099,[17,85,1100,1097,777,804,8]); @@ -1192,18 +1192,18 @@ __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,"ARM_MS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SELECT_HINT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SELECTED_A11Y",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"TABLE_SELECT_HINT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isArmed",{enumerable:!0,get:function(){return l}}),e.releaseOn=function(n,o,c,u){const b=l(n,o,u);return c?b?{arm:null,action:'move'}:{arm:n&&u-n.at!!n&&n.id===o&&c-n.at!e.signOff),S=k.filter(e=>e.signOff),_=j.map(o.allergenLabel).join(', '),C=e=>e.map(e=>e.name).join(', ')||'none';return(0,f.jsxs)(l.default,{testID:"menu-allergy-check",style:{gap:6,borderWidth:1,borderColor:p.length?h.colours.red:h.colours.border,borderRadius:12,padding:10,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(u.T,{weight:"semibold",children:["Allergy check against the menu (",_,")"]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.red,children:["Contains: ",p.length," dish",1===p.length?'':'es']}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.amber,children:["May contain: ",M.length]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.ok,children:["Free from ",1===j.length?'it':'them'," (signed off): ",S.length]}),w.length?(0,f.jsxs)(u.Muted,{children:[w.length," more awaiting the head chef's sign-off, so not shown as safe."]}):null,(0,f.jsx)(n.default,{testID:"menu-allergy-details",accessibilityRole:"button",onPress:()=>y(!x),hitSlop:6,children:(0,f.jsx)(u.T,{size:14,colour:h.colours.gold,children:x?'Hide dishes':'Show dishes'})}),x?(0,f.jsxs)(l.default,{style:{gap:4},children:[(0,f.jsxs)(u.Muted,{children:["Contains: ",C(p)]}),(0,f.jsxs)(u.Muted,{children:["May contain: ",C(M)]}),(0,f.jsxs)(u.Muted,{children:["Free from: ",C(S)]})]}):null,(0,f.jsx)(u.Muted,{children:'guest'===m?'From the kitchen\u2019s signed-off recipe cards. Specials on the board are checked by staff on the day.':'From the signed-off recipe cards. Specials on the board have their own allergens. Still check with the guest and the kitchen.'})]})};var s=r(d[0]),n=e(r(d[1])),l=e(r(d[2])),t=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8])},1110,[17,385,85,858,845,847,804,777,8]); __d(function(g,r,i,_a,m,_e,d){"use strict";function t(t){return String(t??'').split('+').map(t=>t.trim()).filter(Boolean)}function e(t){return t.length<=1?t[0]??'':2===t.length?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`}function n(n){const o=t(n);return o.length>1?`tables ${e(o)}`:o.length?`table ${o[0]}`:''}Object.defineProperty(_e,'__esModule',{value:!0}),_e.tableWords=n,Object.defineProperty(_e,"RECENT_SEATED_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"FINISH_UNDO_MS",{enumerable:!0,get:function(){return a}}),_e.seatedAgoMs=s,_e.seatedAgoWords=u,_e.needsRecentSeatedWarning=c,_e.finishConfirmPrompt=function(t){const e=t.name.trim()||'This party',n=t.parties&&t.parties>1?t.parties:1,o=t.seated&&c({seatedAt:t.seatedAt},t.now),a=o?u(s({seatedAt:t.seatedAt},t.now)):'',l=f(t.table);if(!t.seated)return`Mark ${e} finished without seating?`;if(n>1){return`${n} parties seated here${o?`, including ${e} seated ${a}`:''}. Mark all finished${l}?`}return o?`${e} seated ${a}. Mark finished${l}?`:`Mark ${e} finished${l}?`},_e.restoreSeatedPrompt=function(t,e){return`${t.trim()||'This party'} is finished. Seat them at ${n(e)}?`},_e.lastTableFromAudit=l,_e.tableForUndo=function(t,e){const n=String(t.table??'').trim();if(n)return n;const o=String(t.lastTable??'').trim();return o||l(e)},_e.finishClearPatch=function(t,e){const n=String(e??'').trim();return{status:'finished',finishedAt:t,table:void 0,...n?{lastTable:n}:{}}},_e.finishUndoPatch=function(t){const e=String(t??'').trim();return{status:'seated',finishedAt:void 0,lastTable:void 0,...e?{table:e}:{table:void 0}}};const o=15,a=15e3;function s(t,e){if(!t.seatedAt)return null;const n=new Date(t.seatedAt).getTime();return Number.isFinite(n)?Math.max(0,e.getTime()-n):null}function u(t){const e=Math.round(t/1e3);if(e<1)return'just now';if(e<60)return`${e} second${1===e?'':'s'} ago`;const n=Math.round(e/60);if(n<60)return`${n} minute${1===n?'':'s'} ago`;const o=Math.round(n/60);return`${o} hour${1===o?'':'s'} ago`}function c(t,e){const n=s(t,e);return null!=n&&n<9e5}function f(t){const e=t?n(t):'';return e?` and set ${e} to needs clearing`:''}function l(t){if(!t?.length)return;const e=[...t].sort((t,e)=>String(e.at??'').localeCompare(String(t.at??'')));for(const t of e){if(t.action&&'tables'!==t.action)continue;const e=String(t.from_value??'').trim(),n=String(t.to_value??'').trim();if(e&&!n)return e.replace(/\+/g,'+')}for(const t of e){if(t.action&&'tables'!==t.action)continue;const e=String(t.to_value??'').trim();if(e)return e;const n=String(t.from_value??'').trim();if(n)return n}}},1111,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FinishConfirm=I,_e.RestoreSeatedConfirm=function({prompt:e,onYes:t,onNo:n}){return(0,k.jsxs)(s.default,{testID:"restore-seated-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:"Yes, seat them",testID:"restore-seated-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"restore-seated-no",onPress:n,style:w})]})},Object.defineProperty(_e,"finishBookingNow",{enumerable:!0,get:function(){return p.finishBookingNow}}),_e.undoFinishedNow=D,_e.restoreFinishedToTable=async function(e,t,s){const o=(0,b.tableKey)(s);await n.repo.bookings.update(t.id,{...(0,f.tablePatch)(o||null),status:'seated',finishedAt:void 0,lastTable:void 0}),o&&(0,p.resetTableLive)(e,o)},_e.offerFinishUndo=F,_e.finishAndOfferUndo=v,_e.finishUnseatedAndOfferUndo=N,_e.FinishButton=function({rid:e,b:s,name:n,allowed:o=!0,hint:c,small:b,bigToast:f,testID:u,label:h="Finished",a11y:p,kind:D="secondary"}){const[F,j]=t.default.useState(!1);if(!o)return null;const x=(0,l.finishConfirmPrompt)({name:n,table:s.table,seatedAt:s.seatedAt,now:new Date,seated:'seated'===s.status});if(F)return(0,k.jsx)(I,{prompt:x,onNo:()=>j(!1),onYes:()=>{j(!1),'seated'===s.status?v(e,[s],n,{big:f,table:s.table}):N(e,s,n,{big:f})}});return(0,k.jsx)(y.Button,{small:b,kind:D,label:h,testID:u,accessibilityLabel:p??`${h}: ${n}`,accessibilityHint:c,disabled:!o,onPress:()=>j(!0),style:b?void 0:w})};var t=e(r(d[0])),s=e(r(d[1])),n=r(d[2]),o=r(d[3]),l=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),u=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]);const w={minHeight:64};function I({prompt:e,onYes:t,onNo:n,yesLabel:o="Yes, finish"}){return(0,k.jsxs)(s.default,{testID:"finish-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:o,testID:"finish-confirm-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"finish-confirm-no",onPress:n,style:w})]})}async function D(e,t,s){const c=(0,l.tableForUndo)(t,s);await n.repo.bookings.update(t.id,(0,l.finishUndoPatch)(c)),c&&(0,o.tablesOf)(c).forEach(t=>o.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function F(e){const t=e.bookings[0];if(!t)return;const s=e.bookings.length>1?`${e.bookings.length} parties finished.`:`${e.name} finished.`,n=e.table?`${(0,c.tableWords)(e.table).replace(/^t/,'T')} needs clearing.`:void 0,o=`finish-undo-${t.id}`;(0,u.notify)({id:o,title:s,body:n,timeoutMs:l.FINISH_UNDO_MS,big:e.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{for(const t of e.bookings)await D(e.rid,{...t,table:void 0,lastTable:t.table||t.lastTable});(0,u.dismissNotice)(o)})()}}]})}async function v(e,t,s,n){const o=n?.table??t.find(e=>e.table)?.table;for(const s of t)await(0,p.finishBookingNow)(e,s);F({rid:e,bookings:t,name:s,table:o,big:n?.big})}async function N(e,t,s,o){await n.repo.bookings.setStatus(t.id,'finished');const c=`finish-undo-${t.id}`;(0,u.notify)({id:c,title:`${s} finished.`,timeoutMs:l.FINISH_UNDO_MS,big:o?.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{await n.repo.bookings.setStatus(t.id,t.walkIn?'cancelled':'confirmed'),(0,u.dismissNotice)(c)})()}}]})}},1112,[17,85,858,996,1111,1113,1094,1090,916,804,777,1096,8]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return s.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return c}}),e.freeTablesNow=function(t,a,s=!1){const l=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),n=l.filter(([,t])=>t.table.maxSeats>=a),o=t=>t.map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}));return s?[...o(n),...o(l.filter(([,t])=>t.table.maxSeatsh[t]&&(l.includes(h[t].status)||'dirty'===h[t].status||'blocked'===h[t].status));if(p.length&&p.every(t=>h[t])&&!t.length)f.push({id:'seat',label:`Seat at ${b(s.table).replace(/^t/,'T')}`,a11y:`Seat ${n}, ${u(s.partySize)}, at ${b(s.table)}`,table:s.table});else if(c(s,$)){const a=p.length?t.length?`${b(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===h[t[0]].status?'waiting to be cleared':'blocked'===h[t[0]].status?'blocked':'in use'}`:`${b(s.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';f.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${n}, ${u(s.partySize)}. ${a}.`,note:a})}c(s,$)&&f.push({id:'finished',label:'Finished',a11y:`Finished, ${n}, ${s.time} booking, without seating at a table`}),o($,s)<=0&&f.push({id:'noshow',label:'No-show',a11y:`No-show, ${n}, ${s.time} booking`})}return f.push({id:'details',label:'Guest details',a11y:`Guest details, ${n}`}),f};var t=r(d[0]),a=r(d[1]),s=r(d[2]);const l=['seated','mains','dessert','bill'],n=t=>new Date(`${t.date}T${t.time}:00`),o=(t,a)=>(n(a).getTime()-t.getTime())/6e4,b=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},u=t=>`${t} ${1===t?'person':'people'}`,c=(t,a)=>o(a,t)<=45},1113,[996,863,1074]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return x}}),_e.cancelWalkInWords=I,_e.reinstateWalkInWords=$,_e.cancelWalkInNow=j,_e.reinstateWalkInNow=C,_e.CancelWalkInButton=function({rid:e,b:t,onDone:o,small:c,big:u}){const[b,f]=(0,n.useState)(!1),k=(0,l.useInStaffApp)(),x=(0,s.useSeatClearFinish)();return p(t)?k&&!x.ok?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(w.Button,{kind:"secondary",small:c,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>f(!0),style:u?{minHeight:64}:c?{minHeight:44}:h}),b?(0,y.jsx)(W,{rid:e,b:t,onClose:()=>f(!1),onDone:o}):null]}):null},_e.CancelWalkInConfirm=W,_e.ReinstateWalkInButton=function({rid:e,b:t,today:o,onDone:u,small:b}){const[f,p]=(0,n.useState)(!1),I=(0,l.useInStaffApp)(),j=(0,s.useSeatClearFinish)();if(!x(t,o))return null;if(I&&!j.ok)return null;const W=$(t);if(!f)return(0,y.jsx)(w.Button,{kind:"ghost",small:b,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>p(!0),style:b?{minHeight:44}:h});return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:()=>p(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:W,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:W})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[h,{flexGrow:1}],onPress:async()=>{await C(e,t),p(!1),u?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>p(!1),style:h})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]),o=r(d[4]),c=(e=o)&&e.__esModule?e:{default:e},u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]),w=r(d[9]),y=r(d[10]);const h={minHeight:56},p=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),x=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function I(e){const t=(0,b.tablesOf)(e.table),n=(0,f.tablesWords)(t);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${t.length?` at ${n}`:''}, arrived ${e.time}? It comes off the Covers${t.length?` and ${n} ${t.length>1?'go':'goes'} back to Free`:''}.`}function $(e){return`Put walk-in ${e.ref} back to seated? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`}async function j(e,n){await u.repo.bookings.setStatus(n.id,'cancelled'),await u.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,b.tablesOf)(n.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function C(e,t){await u.repo.bookings.setStatus(t.id,'seated'),(0,b.tablesOf)(t.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function W({rid:e,b:t,onClose:n,onDone:l}){const s=I(t);return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:s,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:s})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[h,{flexGrow:1}],onPress:async()=>{await j(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,b.tablesOf)(t.table).length?` ${(0,f.tablesWords)((0,b.tablesOf)(t.table))} free.`:''}`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:h})]})]})}},1114,[1115,17,1055,1117,85,858,996,1094,804,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.cancelStamp=C,_e.cancelBookingNow=w,_e.reinstateBookingNow=$,_e.CancelBookingButton=function({rid:e,b:n,name:o,onDone:s,big:l,small:c}){const[u,f]=(0,t.useState)(!1);return(0,b.canCancelBooking)(n)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(x.Button,{kind:"secondary",small:c,label:"Cancel booking",testID:`cancel-booking-${n.id}`,accessibilityLabel:`Cancel booking for ${o}, ${n.time}, ${n.partySize} Covers`,onPress:()=>f(!0),style:l?{minHeight:64}:c?{minHeight:44}:j}),u?(0,h.jsx)(D,{rid:e,b:n,name:o,onClose:()=>f(!1),onDone:s}):null]}):null},_e.CancelBookingConfirm=D,_e.ReinstateBookingButton=function({b:e,name:n,today:s,onDone:l}){const[c,u]=(0,t.useState)(!1);if(!(0,b.canReinstateBooking)(e,s))return null;const y=(0,b.reinstateBookingWords)(e,n);if(!c)return(0,h.jsx)(x.Button,{kind:"ghost",label:"Undo cancel",testID:`reinstate-booking-${e.id}`,accessibilityLabel:`Undo cancel for ${n}`,onPress:()=>u(!0),style:j});return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:()=>u(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center'},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, put back to booked",testID:"reinstate-booking-yes",accessibilityLabel:`Yes, put ${n} back to booked`,style:[j,{flexGrow:1}],onPress:async()=>{await $(e),u(!1),l?.(`${n} put back to booked.`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-booking-no",onPress:()=>u(!1),style:j})]})]})};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]),c=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]),y=r(d[8]),k=r(d[9]),p=r(d[10]),x=r(d[11]),h=r(d[12]);const j={minHeight:56},B={display:'Display',owner:'Managers app',staff:'Staff app',chef:'Kitchen app',customer:'Customer page'};function C(e){const t=y.useSession.getState().meId,n=t?k.useOwner.getState().staff.find(e=>e.id===t):void 0,o=B[p.APP_VARIANT]??'CoverCharge';return{by:n?`${n.name.replace(' (example)','')} (${o})`:o,at:(new Date).toISOString(),app:o,...e.table?{table:e.table}:{}}}async function w(e,t){const n=(0,l.tablesOf)(t.table);await s.repo.bookings.update(t.id,{status:'cancelled',cancelled:C(t),...(0,c.tablePatch)(null)}),n.forEach(t=>l.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function $(e){await s.repo.bookings.setStatus(e.id,'confirmed')}function D({rid:e,b:t,name:n,onClose:s,onDone:c}){const y=(0,b.cancelBookingWords)(t,n),k=(0,l.tablesOf)(t.table);return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:s,title:"Cancel booking?",maxWidth:560,testID:"cancel-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center',gap:8},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, cancel booking",testID:"cancel-booking-yes",accessibilityLabel:`Yes, cancel booking for ${n}`,style:[j,{flexGrow:1}],onPress:async()=>{await w(e,t),s(),c?.(`${n} cancelled.${k.length?` ${(0,u.tablesWords)(k)} free.`:''}`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep booking",testID:"cancel-booking-no",accessibilityLabel:`Keep booking for ${n}`,onPress:s,style:j})]})]})}},1115,[17,85,858,996,1090,1116,1094,804,920,876,856,777,8]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canCancelBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canReinstateBooking",{enumerable:!0,get:function(){return t}}),e.cancelBookingWords=function(n,t){const o=`${n.partySize} Cover${1===n.partySize?'':'s'}`;return`Cancel booking for ${t}, ${n.time}, ${o}? The table is freed. Website bookings will cancel it on the website and may email the guest.`},e.reinstateBookingWords=function(n,t){return`Put ${t} back to booked for ${n.time}? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`},e.cancelledOnDay=o,e.cancelledDayTally=function(n,t){const a=o(n,t),l=a.filter(n=>!!n.walkIn),c=a.filter(n=>!n.walkIn);return{count:a.length,covers:a.reduce((n,t)=>n+t.partySize,0),bookings:c.length,bookingCovers:c.reduce((n,t)=>n+t.partySize,0),walkIns:l.length,walkInCovers:l.reduce((n,t)=>n+t.partySize,0),list:a}},e.cancelledTallyWords=function(n,t="today"){if(!n.count)return`No cancellations ${t}`;const o=[],a=n.bookings??0,l=n.walkIns??0;a&&o.push(`${a} booking${1===a?'':'s'} (${n.bookingCovers??0} Cover${1===(n.bookingCovers??0)?'':'s'})`);l&&o.push(`${l} walk-in${1===l?'':'s'} (${n.walkInCovers??0} Cover${1===(n.walkInCovers??0)?'':'s'})`);if(!o.length)return`Cancelled ${t}: ${n.count} \xb7 ${n.covers} Cover${1===n.covers?'':'s'}`;return`Cancelled ${t}: ${o.join(' \xb7 ')}`};const n=n=>!n.walkIn&&('confirmed'===n.status||'pending'===n.status||'seated'===n.status),t=(n,t)=>!n.walkIn&&'cancelled'===n.status&&n.date>=t;function o(n,t){return n.filter(n=>n.date===t&&'cancelled'===n.status).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name))}},1116,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSeatClearFinish=function(){const t=(0,A.useSignedIn)(),o=(0,A.useInStaffApp)(),_='staff'===s.APP_VARIANT||'chef'===s.APP_VARIANT||o,l=(0,c.canSeatClearFinish)({device:s.IS_CAR||'display'===s.APP_VARIANT||!_&&!t,viaDisplay:(0,n.isKitchenViaDisplay)(),role:t?.role,ownerAccess:t?.ownerAccess,managerAccess:t?.managerAccess});return{ok:l,hint:l?void 0:c.SEAT_CLEAR_HINT}};var s=r(d[0]),n=r(d[1]),c=r(d[2]),A=r(d[3])},1117,[856,922,1118,1055]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEAT_CLEAR_HINT",{enumerable:!0,get:function(){return n}}),e.canSeatClearFinish=function(n){return!(!n.device&&!n.viaDisplay)||('owner'===n.role||'manager'===n.role||!(!n.ownerAccess&&!n.managerAccess))};const n='Ask a manager to seat, finish or clear a table.'},1118,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:s,who:i,role:n,inStaffApp:l,shiftManager:a,big:o,testID:d}){const[h,u]=(0,t.useState)(!1),p=(0,b.useSession)(e=>e.meId),y=(0,m.useOwner)(e=>e.staff.find(e=>e.id===p&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:l,role:n,shiftManager:a})||p&&!(0,x.canChangeBookings)(y)?null:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:d??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),h?(0,N.jsx)(V,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:n,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,l.useBookings)(e).filter(e=>!e.walkIn&&e.date>=s&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,200);return o?(0,N.jsx)(V,{rid:e,id:o,who:i,hidePrivate:a,onClose:n}):(0,N.jsxs)(z.Sheet,{visible:!0,onClose:n,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,N.jsx)(z.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${L(e.date,s)} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${L(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,N.jsx)(z.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,N.jsx)(z.Button,{kind:"ghost",label:"Close",onPress:n,style:{minHeight:44}})]})},_e.EditBookingSheet=V;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=(e=i)&&e.__esModule?e:{default:e},l=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),f=_r(_d[19]),C=_r(_d[20]),I=_r(_d[21]),k=_r(_d[22]),w=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),O=_r(_d[28]),W=_r(_d[29]),z=_r(_d[30]),B=_r(_d[31]),N=_r(_d[32]);const E=/^([01]\d|2[0-3]):[0-5]\d$/,R=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const L=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,D.ymd)(s)?'Tomorrow':F(e)};const A=e=>e?(e/100).toFixed(e%100?2:0):'',M=e=>{const t=(0,B.parseMoneyInput)(e);return null!=t&&t>=0?Math.round(100*t):NaN},F=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',H=e=>{const t=e.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);return t?`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`:''},_=e=>e.charAt(0).toUpperCase()+e.slice(1);function Y({title:e,children:t,testID:s}){return(0,N.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,N.jsx)(z.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const G=({label:e,value:t,onChange:s,max:i=20,testID:n})=>(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:e}),(0,N.jsx)(z.Stepper,{testID:n,value:t,min:0,max:i,onChange:s,label:e})]});function V({rid:e,id:i,who:b,onClose:m,hidePrivate:x=!1}){(0,$.useBlurOutside)();const B=(0,l.useBookings)(e),L=B.find(e=>e.id===i),V=(0,d.useRestaurant)(e),K=(0,a.usePlan)(e),U=(0,o.useBlocks)(e=>e.blocks),[q,X]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Q,J]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Z,ee]=(0,t.useState)(!1),[te,se]=(0,t.useState)(null),[ie,ne]=(0,t.useState)(null),[le,ae]=(0,t.useState)(!1),[oe,de]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositDue:0)),[re,ce]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositAmount:0)),[he,ue]=(0,t.useState)(F(L?(0,c.draftOf)(L).depositDate:''));if(!L||!q||!V)return null;const pe=e=>{se(null),ne(null),X({...q,...e})},ge=(0,O.depositOf)(V.settings),be=e=>{const t=e.partySize??q.partySize,s=Math.min(e.children??q.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(L)&&q.depositOn&&!q.depositPaid&&M(oe||'0')===(0,O.depositDue)(ge,q.partySize,q.children??0)){const e=(0,O.depositDue)(ge,t,s);e>0&&de(A(e))}pe({...e,children:s})},me=(0,v.bookingSlotMinutesOf)(V),xe=R(q.time),ye=E.test(xe),je=q.area?K.areas.filter(e=>e.name===q.area).map(e=>e.id):null,De=e=>!je||e.split('+').every(e=>je.includes(K.tables.find(t=>t.name===e)?.areaId??'')),ve=(0,y.tableOptions)(K,B.filter(e=>e.date===q.date),q.table).filter(e=>De(e)||e===q.table),fe=!(q.depositOn&&(Number.isNaN(M(oe||'0'))||q.depositPaid&&(Number.isNaN(M(re||'0'))||he.trim()&&!H(he)))),Ce={...q,time:xe,depositDue:M(oe||'0')||0,depositAmount:M(re||'0')||0,depositDate:H(he)},Ie=(0,c.changedDraftFields)(Q??(0,c.draftOf)(L),Ce),ke=V.settings.turnMins??90,we=!!q?.email?.trim()&&q.email.trim()!==(L?.email??'').trim(),Te=(0,u.bookingRulesOf)(V),Se=async()=>{const t=(0,c.editPatch)(L,Ce,{by:b||'Team member',app:r.APP_VARIANT});if(le&&we&&Object.assign(t,(0,u.marketingChoice)(Ce.email,!0)),Object.keys(t).length&&await l.repo.bookings.update(L.id,t),'seated'===L.status&&'table'in t&&t.table!==L.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(L.table),n=s(t.table),l=a.useFloor.getState(),o=i.map(t=>l.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!n.includes(e)).forEach(t=>l.setLive(e,t,{stage:void 0,dirty:!0})),n.forEach(t=>l.setLive(e,t,{stage:o,dirty:!1}))}ne(`Saved. Changed: ${(0,c.editedWords)(Ie)}.`),se(null),m()},$e=()=>{const t=ye?(0,o.blockAt)(U,e,q.date,xe):void 0,s=(0,c.editWarnings)(L,Ce,B,t,ke,K);!s.length||te?Se():se(s)},Pe=q.allergies??[],Oe=e=>pe({allergyNone:!1,allergies:Pe.some(t=>t.allergen===e)?Pe.filter(t=>t.allergen!==e):[...Pe,{allergen:e,severity:'allergy'}]}),We=(0,c.historyLines)(L);return(0,N.jsxs)(z.Sheet,{visible:!0,onClose:()=>{Ie.length?ee(!0):(ee(!1),m())},title:`Edit booking \xb7 ${L.name} \xb7 ${L.ref}`,maxWidth:760,testID:"edit-booking-sheet",onTypingDone:()=>{(0,C.hideKeyboard)(),Ie.length&&ye&&fe&&q.name.trim().length>=1&&$e()},typingDoneLabel:Ie.length?'Done, save changes':'Done, hide the keyboard',footer:(0,N.jsx)(z.Button,{label:te?'Save anyway':'Save changes',testID:"edit-save",disabled:!ye||!fe||q.name.trim().length<1||!Ie.length,onPress:$e,style:{minHeight:56,width:'100%'}}),children:[(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(w.DepositChip,{b:L,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(L)?(0,N.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,N.jsxs)(Y,{title:"Deposit",testID:"edit-section-deposit",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No deposit",selected:!q.depositOn,testID:"edit-deposit-none",onPress:()=>pe({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit due",selected:!!q.depositOn&&!q.depositPaid&&!q.depositWaived,testID:"edit-deposit-due",onPress:()=>pe({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit paid",selected:!!q.depositOn&&!!q.depositPaid,testID:"edit-deposit-paid",onPress:()=>{re||ce(oe),he||ue(F((0,D.ymd)(new Date))),pe({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsx)(z.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsxs)(z.T,{size:15,center:!0,colour:j.colours.goldLight,testID:"edit-deposit-waived-by",children:[L.depositWaived?.by?(0,O.waiverText)(L.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,q.depositWaived||Ie.includes('deposit')?null:(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(P.WaiveDepositButton,{b:L,who:b,onDone:e=>{const t={...q,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e};X(t),J(s=>s?{...s,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e}:t)}})}),q.depositOn?(0,N.jsx)(z.Field,{money:!0,label:"Deposit due (\xa3)",value:oe,onChangeText:e=>{de(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,q.depositOn&&q.depositPaid?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Field,{money:!0,label:"Amount paid (\xa3)",value:re,onChangeText:e=>{ce(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"How was it paid?"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,N.jsx)(z.Chip,{label:_(e),selected:q.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>pe({depositMethod:e})},e))}),(0,N.jsx)(z.Field,{label:"Date paid (DD/MM/YYYY)",value:he,onChangeText:e=>{ue((0,s.slashDate)(e,he)),pe({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),he.trim()&&!H(he)?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,fe?null:(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,N.jsx)(z.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,N.jsxs)(Y,{title:"When",testID:"edit-section-when",children:[(0,N.jsx)(k.BookingDatePicker,{r:V,today:new Date,value:q.date,onChange:e=>pe({date:e})}),(0,N.jsx)(I.TimeRoller,{testID:"edit-time",value:(0,f.snapTime)(q.time,me),onChange:e=>pe({time:e}),step:me}),ye?null:(0,N.jsx)(z.T,{size:15,colour:j.colours.amber,center:!0,children:"Choose a time on the roller."}),(0,N.jsx)(T.AdultsChildren,{value:(0,S.peopleOf)(q.partySize,q.children),onChange:e=>be(e),depositsOn:ge.on&&ge.perPersonPence>0,testID:"edit-people"}),(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:"Table time"}),(0,N.jsx)(z.Stepper,{testID:"edit-duration",value:q.duration||0,min:0,max:360,step:15,onChange:e=>pe({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,N.jsxs)(Y,{title:"Where",testID:"edit-section-where",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"Any area",selected:!q.area,testID:"edit-area-any",onPress:()=>pe({area:''})}),K.areas.map(e=>(0,N.jsx)(z.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:q.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>pe({area:e.name})},e.id))]}),(0,N.jsx)(z.T,{size:18,weight:"semibold",center:!0,children:(0,y.tableButtonLabel)(q.table)}),(0,y.splitChoices)(q.table).length?(0,N.jsxs)(n.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:"Split the joined tables"}),(0,N.jsx)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,y.splitChoices)(q.table).map(e=>(0,N.jsx)(z.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>pe({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:q.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(q.table?'':', chosen'),onPress:()=>pe({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),ve.map(e=>(0,N.jsx)(z.Button,{kind:e===q.table?'primary':'secondary',label:(0,y.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,y.tableButtonLabel)(e)}${e===q.table?', chosen':''}`,onPress:()=>pe({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,N.jsxs)(Y,{title:"Guest",testID:"edit-section-guest",children:[(0,N.jsx)(z.Field,{label:"Name",value:q.name,onChangeText:e=>pe({name:e}),testID:"edit-name"}),(0,N.jsx)(z.Field,{label:"Phone",value:q.phone,onChangeText:e=>pe({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,N.jsx)(z.Field,{label:"Email",value:q.email,onChangeText:e=>pe({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),we&&Te.marketingOptIn?(0,N.jsx)(z.Toggle,{label:Te.marketingWords,value:le,onChange:ae,testID:"edit-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,N.jsx)(z.T,{size:16,center:!0,children:"Booked by"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>pe({source:e.id})},e.id))}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(q.tags??[]).includes(e);return(0,N.jsx)(z.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>pe({tags:t?(q.tags??[]).filter(t=>t!==e):[...q.tags??[],e].sort()})},e)})})]}),(0,N.jsxs)(Y,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,N.jsx)(G,{label:"Dogs",value:q.dogs??0,max:6,onChange:e=>pe({dogs:e}),testID:"edit-dogs"}),(0,N.jsx)(G,{label:"High chairs",value:q.highChairs??0,max:10,onChange:e=>pe({highChairs:e}),testID:"edit-high-chairs"}),(0,N.jsx)(G,{label:"Wheelchair users",value:q.wheelchair??0,max:10,onChange:e=>pe({wheelchair:e}),testID:"edit-wheelchair"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"Occasion"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:(q.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>pe({occasion:e.id})},e.id||'none'))})]}),(0,N.jsxs)(Y,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No allergies",selected:!!q.allergyNone&&!Pe.length,testID:"edit-allergy-none",onPress:()=>pe({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,N.jsx)(z.Chip,{label:e.short,selected:Pe.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>Oe(e.id)},e.id))]}),Pe.map(e=>(0,N.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,N.jsxs)(z.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,N.jsx)(z.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>pe({allergies:Pe.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,N.jsx)(z.Field,{label:"Anything else about allergies",value:q.allergyNote,onChangeText:e=>pe({allergyNote:e}),testID:"edit-allergy-note"}),Ie.includes('allergies')&&Pe.length?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,N.jsx)(G,{label:"Vegan",value:q.vegan??0,max:q.partySize,onChange:e=>pe({vegan:e}),testID:"edit-vegan"}),(0,N.jsx)(G,{label:"Vegetarian",value:q.vegetarian??0,max:q.partySize,onChange:e=>pe({vegetarian:e}),testID:"edit-vegetarian"})]}),(q.holds??[]).length||(L.holds??[]).some(e=>e.qty>0&&!e.served)?(0,N.jsxs)(Y,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,N.jsx)(z.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(q.holds??[]).map(e=>{const t=(0,h.reservablesOf)(V),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),l=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,N.jsxs)(n.default,{testID:l,style:{gap:6,width:'100%'},children:[(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,N.jsx)(z.Stepper,{testID:l,value:e.qty,min:0,max:20,onChange:t=>pe({holds:(0,c.setEditableHoldQty)(q.holds??[],e.kind,e.id,t)}),label:i})]}),(0,N.jsx)(z.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${l}-remove`,onPress:()=>pe({holds:(0,c.removeEditableHold)(q.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(q.holds??[]).length?null:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==L.status?(0,N.jsxs)(Y,{title:"Status",testID:"edit-section-status",children:[(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>pe({status:e.id})},e.id))}),(0,N.jsx)(z.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,N.jsx)(Y,{title:"Notes",testID:"edit-section-notes",children:(0,N.jsx)(z.Field,{label:"Notes",value:q.notes,onChangeText:e=>pe({notes:e}),placeholder:Te.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),te?(0,N.jsxs)(n.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[te.map(e=>(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,ie?(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:ie}):null,Z?(0,N.jsxs)(n.default,{testID:"edit-discard-warn",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:j.colours.gold,backgroundColor:j.colours.surface2},children:[(0,N.jsx)(z.T,{size:20,weight:"bold",center:!0,children:"Discard unsaved changes?"}),(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.muted,children:"Your changes have not been saved."}),(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:"secondary",label:"Keep editing",testID:"edit-discard-keep",onPress:()=>ee(!1),style:{minHeight:52,flex:1}}),(0,N.jsx)(z.Button,{kind:"danger",label:"Discard changes",testID:"edit-discard-discard",onPress:()=>{ee(!1),m()},style:{minHeight:52,flex:1}})]})]}):null,We.length?(0,N.jsx)(Y,{title:"Changes",testID:"edit-history",children:We.slice(0,12).map((e,t)=>(0,N.jsx)(z.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,N.jsx)(W.CancelBookingButton,{rid:e,b:L,name:L.name,big:!0,onDone:()=>m()}),(0,N.jsx)(W.ReinstateBookingButton,{b:L,name:L.name,today:(0,D.ymd)(new Date),onDone:()=>m()})]})}},1119,[17,1031,85,858,996,993,860,856,1120,1053,1077,845,920,876,994,1090,804,863,1103,1121,815,1122,1104,1087,1099,1100,1101,1123,841,1115,777,840,8]); -__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedDraftFields=W,_e.changedFields=j,_e.historyText=E,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=j(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:E(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${D(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!j(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return x}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: high chair, birthday, quiet table',o='This booking is on the website too. Saving here updates the website booking. The website may email the guest about a new date, time or status.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],u=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],h=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],k=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),w=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return w(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){return l.filter(i=>M(i,e)!==M(i,t))}function j(e,t){return W(y(e),t)}const A=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,D=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function E(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${A(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=k(o.holds),i=k(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${D(s)}`}const x=e=>e.map(e=>f[e]).join(', ')},1120,[1053,1098,1090,1094]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return d}}),_e.canEditBooking=function(e){return'customer'!==e.variant&&('staff'===e.variant||e.inStaffApp?!!e.shiftManager:'display'===e.variant||'chef'===e.variant||'staff'!==e.role)},Object.defineProperty(_e,"isWixBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SOURCES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"editableHolds",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"servedHolds",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"holdsKey",{enumerable:!0,get:function(){return P}}),_e.setEditableHoldQty=function(e,t,i,a){const s=Math.max(0,Math.round(Number(a)||0));return e.map(e=>e.kind!==t||e.id!==i||e.served?e:{...e,qty:s}).filter(e=>e.served||e.qty>0)},_e.removeEditableHold=function(e,t,i){return e.filter(e=>e.served||!(e.kind===t&&e.id===i))},_e.holdLabel=$,Object.defineProperty(_e,"mergeHolds",{enumerable:!0,get:function(){return S}}),_e.changedDraftFields=W,_e.changedFields=j,_e.historyText=E,_e.editPatch=function(e,i,a,s=(new Date).toISOString()){const o=j(e,i);if(!o.length)return{};const d={};for(const n of o)switch(n){case'partySize':d.partySize=(0,t.clampParty)(Number(i.partySize));break;case'children':d.children=Math.max(0,Math.min((0,t.clampParty)(Number(i.partySize)),Math.round(Number(i.children??0))))||void 0;break;case'phone':case'email':case'table':d[n]=String(i[n]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[n]=String(i[n]??'').trim();break;case'area':d.area=(i.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(i.dogs??0)),d.dog=Number(i.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(i.highChairs??0))||void 0;break;case'wheelchair':d.access={...e.access??{},wheelchair:Math.max(0,Number(i.wheelchair??0))||void 0};break;case'occasion':d.occasion=i.occasion||void 0;break;case'allergies':d.allergies=[...i.allergies??[]],d.allergyNone=!!i.allergyNone&&!(i.allergies??[]).length,d.allergyNote=(i.allergyNote??'').trim()||void 0,(i.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(i.vegan??0)||void 0,vegetarian:Number(i.vegetarian??0)||void 0};break;case'deposit':if(!i.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0,depositWaived:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(i.depositDue??0))),!i.depositPaid&&i.depositWaived?d.depositWaived=e.depositWaived?.by&&(e.depositWaived.note??'')===(i.depositWaiveNote??'').trim()?e.depositWaived:{by:a.by.slice(0,80),at:s,...(i.depositWaiveNote??'').trim()?{note:(i.depositWaiveNote??'').trim().slice(0,120)}:{}}:d.depositWaived=void 0,i.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(i.depositDate??'')?i.depositDate:s.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(i.depositAmount??0))),depositPaidBy:a.by.slice(0,80),depositPaidAt:e===s.slice(0,10)?s:`${e}T12:00:00.000Z`,depositMethod:i.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=i.status,'seated'!==i.status||e.seatedAt||(d.seatedAt=s),'finished'!==i.status||e.finishedAt||(d.finishedAt=s),'confirmed'!==i.status&&'pending'!==i.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=i.source||void 0;break;case'tags':d.tags=[...(e.tags??[]).filter(e=>!b.includes(e)),...i.tags??[]];break;case'duration':d.durationMins=Number(i.duration??0)>=15?Number(i.duration):void 0;break;case'holds':d.holds=S(e.holds,i.holds)}o.includes('table')&&(d.tableSetHere=!0);const n=e;return d.locallyEdited=!0,d.editedFields=[...new Set([...n.editedFields??[],...o])],d.editLog=[...n.editLog??[],{at:s,by:a.by.slice(0,80),app:a.app,fields:o,text:E(e,i,o,a.by.slice(0,80),s)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>f[e]??e).join(', ')} changed by ${e.by} ${D(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,t,s,o,d=90,n){const l=[];if(!j(e,t).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return l;const c={...e,date:t.date,time:t.time,partySize:t.partySize,...Number(t.duration??0)>=15?{durationMins:Number(t.duration)}:{}};if(t.table){const e=(0,i.tableOverlaps)(c,t.table,s.filter(e=>e.date===t.date),d);if(e.length&&l.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),n){const e=t.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>n.tables.find(t=>t.name===e)).filter(Boolean),i=e.reduce((e,t)=>e+t.maxSeats,0),s=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),i,t.partySize):null;s&&l.push(s);const o=e.map(e=>n.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(t.dogs??0)>0&&o.length&&l.push(`Dogs aren\u2019t allowed in ${o[0].name}. Pick a dog-friendly table.`)}}o&&l.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return l},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return x}}),_e.bookingExtras=function(e){const t=e,i=e.dogs??(e.dog?1:0),a=[];e.children&&a.push(C(e.children,'child','children'));i&&a.push(C(i,'dog','dogs'));t.highChairs&&a.push(C(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&a.push(C(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&a.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&a.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&a.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&a.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&a.push(`Deposit by ${t.depositMethod}`);return a.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),i=r(_d[2]),a=r(_d[3]);const s='For example: high chair, birthday, quiet table',o='This booking is on the website too. Saving here updates the website booking. The website may email the guest about a new date, time or status.',d=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const n=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},l=['date','time','partySize','children','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration','holds'],c=['card','cash','bank transfer','website','other'],u=[{id:'pending',label:'Needs confirming'},{id:'confirmed',label:'Confirmed'},{id:'seated',label:'Seated'},{id:'finished',label:'Finished'},{id:'noshow',label:'No-show'}],h=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],p=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],b=['VIP','Regular'],f={date:'date',time:'time',partySize:'covers',children:'children',name:'name',phone:'phone',email:'email',notes:'notes',table:'table',area:'area',dogs:'dogs',highChairs:'high chairs',wheelchair:'wheelchairs',occasion:'occasion',allergies:'allergies',diet:'dietary',deposit:'deposit',status:'status',source:'source',tags:'tags',duration:'table time',holds:'reserved items'},y=e=>{const t=e;return{date:e.date,time:e.time,partySize:e.partySize,name:e.name,phone:e.phone??'',email:e.email??'',notes:e.notes??'',table:e.table??'',area:t.area??'',dogs:e.dogs??(e.dog?1:0),highChairs:t.highChairs??0,wheelchair:e.access?.wheelchair??0,occasion:e.occasion??'',allergies:e.allergies??[],allergyNone:!!e.allergyNone,allergyNote:e.allergyNote??'',vegan:e.diet?.vegan??0,vegetarian:e.diet?.vegetarian??0,depositOn:'deposit'===e.security||(e.depositDue??0)>0||(e.depositPaid??0)>0,depositPaid:(e.depositPaid??0)>0&&!!e.depositPaidBy,depositAmount:(e.depositPaid??0)>0?e.depositPaid:e.depositDue??0,depositMethod:t.depositMethod??'',depositDate:(i=e.depositPaidAt,i?i.slice(0,10):''),depositDue:e.depositDue??0,children:e.children??0,depositWaived:!!e.depositWaived?.by,depositWaiveNote:e.depositWaived?.note??'',status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0,holds:v(e.holds)};var i},v=e=>(e??[]).filter(e=>e.qty>0&&!e.served).map(e=>({kind:e.kind,id:e.id,qty:e.qty})),N=e=>(e??[]).filter(e=>e.qty>0&&!!e.served).map(e=>({...e})),P=e=>JSON.stringify(v(e).map(e=>[e.kind,e.id,e.qty]));function $(t,i){const a=(0,e.holdId)(t.id);return'item'===t.kind?i||e.ANCHORAGE_RESERVABLES.find(e=>e.id===a)?.name||'Reserved item':'lobster'===a?'Lobster':'crab'===a?'Crab':a}const S=(e,t)=>[...N(e),...v(t)],k=e=>v(e).map(e=>`${$(e)} \xd7${e.qty}`).join(', '),w=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),O=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'',!e.depositPaid&&!!e.depositWaived,!e.depositPaid&&e.depositWaived?(e.depositWaiveNote??'').trim():'']:[!1]);function M(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return w(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return O(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':case'children':return Number(t[e]??0);case'holds':return P(t.holds);default:return String(t[e]??'').trim()}}function W(e,t){return l.filter(i=>M(i,e)!==M(i,t))}function j(e,t){return W(y(e),t)}const A=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,D=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},C=(e,t,i)=>`${e} ${1===e?t:i}`;function E(e,t,i,a,s){const o=y(e),d=[];for(const e of[...i].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))if('deposit'===e)t.depositOn?t.depositPaid||!t.depositWaived||o.depositWaived?t.depositPaid||t.depositWaived||!o.depositWaived||o.depositPaid?t.depositPaid&&!o.depositPaid?d.push(`deposit marked paid (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&o.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${A(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${A(Number(t.depositDue??0))}`):d.push('deposit waiver taken off'):d.push("deposit waived"+((t.depositWaiveNote??'').trim()?` (${(t.depositWaiveNote??'').trim().slice(0,120)})`:'')):d.push('deposit taken off');else if('dogs'===e)d.push(!o.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?C(Number(t.dogs),'dog','dogs'):'no dog now');else if('highChairs'===e)d.push(t.highChairs?C(Number(t.highChairs),'high chair','high chairs'):'no high chair now');else if('wheelchair'===e)d.push(t.wheelchair?C(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now');else if('partySize'===e)d.push(`covers ${o.partySize} to ${t.partySize}`);else if('children'===e)d.push(t.children?`${C(Number(t.children),'child','children')} (no deposit for children)`:'no children now');else if('time'===e)d.push(`time ${o.time} to ${t.time}`);else if('date'===e)d.push(`date ${o.date} to ${t.date}`);else if('table'===e)d.push(t.table?`table ${t.table}`:'table taken off');else if('status'===e)d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`);else if('occasion'===e)d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off');else if('area'===e)d.push(t.area?`area ${t.area}`:'any area');else if('duration'===e)d.push(t.duration?`table time ${t.duration} min`:'table time as usual');else if('holds'===e){const e=k(o.holds),i=k(t.holds);d.push(i?e?`reserved items ${e} to ${i}`:`reserved ${i}`:'reserved items taken off')}else d.push(`${f[e]} changed`);const n=d.join(', ');return`${n.charAt(0).toUpperCase()}${n.slice(1)} by ${a} ${D(s)}`}const x=e=>e.map(e=>f[e]).join(', ')},1112,[1053,1098,1090,1094]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FinishConfirm=I,_e.RestoreSeatedConfirm=function({prompt:e,onYes:t,onNo:n}){return(0,k.jsxs)(s.default,{testID:"restore-seated-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:"Yes, seat them",testID:"restore-seated-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"restore-seated-no",onPress:n,style:w})]})},Object.defineProperty(_e,"finishBookingNow",{enumerable:!0,get:function(){return p.finishBookingNow}}),_e.undoFinishedNow=D,_e.restoreFinishedToTable=async function(e,t,s){const o=(0,b.tableKey)(s);await n.repo.bookings.update(t.id,{...(0,f.tablePatch)(o||null),status:'seated',finishedAt:void 0,lastTable:void 0}),o&&(0,p.resetTableLive)(e,o)},_e.offerFinishUndo=F,_e.finishAndOfferUndo=v,_e.finishUnseatedAndOfferUndo=N,_e.FinishButton=function({rid:e,b:s,name:n,allowed:o=!0,hint:c,small:b,bigToast:f,testID:u,label:h="Finished",a11y:p,kind:D="secondary"}){const[F,j]=t.default.useState(!1);if(!o)return null;const x=(0,l.finishConfirmPrompt)({name:n,table:s.table,seatedAt:s.seatedAt,now:new Date,seated:'seated'===s.status});if(F)return(0,k.jsx)(I,{prompt:x,onNo:()=>j(!1),onYes:()=>{j(!1),'seated'===s.status?v(e,[s],n,{big:f,table:s.table}):N(e,s,n,{big:f})}});return(0,k.jsx)(y.Button,{small:b,kind:D,label:h,testID:u,accessibilityLabel:p??`${h}: ${n}`,accessibilityHint:c,disabled:!o,onPress:()=>j(!0),style:b?void 0:w})};var t=e(r(d[0])),s=e(r(d[1])),n=r(d[2]),o=r(d[3]),l=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),u=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11]),k=r(d[12]);const w={minHeight:64};function I({prompt:e,onYes:t,onNo:n,yesLabel:o="Yes, finish"}){return(0,k.jsxs)(s.default,{testID:"finish-confirm",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:e,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:h.colours.amber,backgroundColor:h.colours.amberBg,width:'100%',maxWidth:420,alignSelf:'center'},children:[(0,k.jsx)(y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:e}),(0,k.jsx)(y.Button,{label:o,testID:"finish-confirm-yes",onPress:t,style:w}),(0,k.jsx)(y.Button,{kind:"secondary",label:"Cancel",testID:"finish-confirm-no",onPress:n,style:w})]})}async function D(e,t,s){const c=(0,l.tableForUndo)(t,s);await n.repo.bookings.update(t.id,(0,l.finishUndoPatch)(c)),c&&(0,o.tablesOf)(c).forEach(t=>o.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function F(e){const t=e.bookings[0];if(!t)return;const s=e.bookings.length>1?`${e.bookings.length} parties finished.`:`${e.name} finished.`,n=e.table?`${(0,c.tableWords)(e.table).replace(/^t/,'T')} needs clearing.`:void 0,o=`finish-undo-${t.id}`;(0,u.notify)({id:o,title:s,body:n,timeoutMs:l.FINISH_UNDO_MS,big:e.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{for(const t of e.bookings)await D(e.rid,{...t,table:void 0,lastTable:t.table||t.lastTable});(0,u.dismissNotice)(o)})()}}]})}async function v(e,t,s,n){const o=n?.table??t.find(e=>e.table)?.table;for(const s of t)await(0,p.finishBookingNow)(e,s);F({rid:e,bookings:t,name:s,table:o,big:n?.big})}async function N(e,t,s,o){await n.repo.bookings.setStatus(t.id,'finished');const c=`finish-undo-${t.id}`;(0,u.notify)({id:c,title:`${s} finished.`,timeoutMs:l.FINISH_UNDO_MS,big:o?.big,testID:'finish-undo-toast',actions:[{label:'Undo',testID:'finish-undo-yes',kind:'primary',onPress:()=>{(async()=>{await n.repo.bookings.setStatus(t.id,t.walkIn?'cancelled':'confirmed'),(0,u.dismissNotice)(c)})()}}]})}},1113,[17,85,858,996,1111,1114,1094,1090,916,804,777,1096,8]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return s.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return c}}),e.freeTablesNow=function(t,a,s=!1){const l=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),n=l.filter(([,t])=>t.table.maxSeats>=a),o=t=>t.map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}));return s?[...o(n),...o(l.filter(([,t])=>t.table.maxSeatsh[t]&&(l.includes(h[t].status)||'dirty'===h[t].status||'blocked'===h[t].status));if(p.length&&p.every(t=>h[t])&&!t.length)f.push({id:'seat',label:`Seat at ${b(s.table).replace(/^t/,'T')}`,a11y:`Seat ${n}, ${u(s.partySize)}, at ${b(s.table)}`,table:s.table});else if(c(s,$)){const a=p.length?t.length?`${b(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===h[t[0]].status?'waiting to be cleared':'blocked'===h[t[0]].status?'blocked':'in use'}`:`${b(s.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';f.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${n}, ${u(s.partySize)}. ${a}.`,note:a})}c(s,$)&&f.push({id:'finished',label:'Finished',a11y:`Finished, ${n}, ${s.time} booking, without seating at a table`}),o($,s)<=0&&f.push({id:'noshow',label:'No-show',a11y:`No-show, ${n}, ${s.time} booking`})}return f.push({id:'details',label:'Guest details',a11y:`Guest details, ${n}`}),f};var t=r(d[0]),a=r(d[1]),s=r(d[2]);const l=['seated','mains','dessert','bill'],n=t=>new Date(`${t.date}T${t.time}:00`),o=(t,a)=>(n(a).getTime()-t.getTime())/6e4,b=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},u=t=>`${t} ${1===t?'person':'people'}`,c=(t,a)=>o(a,t)<=45},1114,[996,863,1074]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return x}}),_e.cancelWalkInWords=I,_e.reinstateWalkInWords=$,_e.cancelWalkInNow=j,_e.reinstateWalkInNow=C,_e.CancelWalkInButton=function({rid:e,b:t,onDone:o,small:c,big:u}){const[b,f]=(0,n.useState)(!1),k=(0,l.useInStaffApp)(),x=(0,s.useSeatClearFinish)();return p(t)?k&&!x.ok?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(w.Button,{kind:"secondary",small:c,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>f(!0),style:u?{minHeight:64}:c?{minHeight:44}:h}),b?(0,y.jsx)(W,{rid:e,b:t,onClose:()=>f(!1),onDone:o}):null]}):null},_e.CancelWalkInConfirm=W,_e.ReinstateWalkInButton=function({rid:e,b:t,today:o,onDone:u,small:b}){const[f,p]=(0,n.useState)(!1),I=(0,l.useInStaffApp)(),j=(0,s.useSeatClearFinish)();if(!x(t,o))return null;if(I&&!j.ok)return null;const W=$(t);if(!f)return(0,y.jsx)(w.Button,{kind:"ghost",small:b,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>p(!0),style:b?{minHeight:44}:h});return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:()=>p(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:W,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:W})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[h,{flexGrow:1}],onPress:async()=>{await C(e,t),p(!1),u?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>p(!1),style:h})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=r(d[3]),o=r(d[4]),c=(e=o)&&e.__esModule?e:{default:e},u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]),w=r(d[9]),y=r(d[10]);const h={minHeight:56},p=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),x=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function I(e){const t=(0,b.tablesOf)(e.table),n=(0,f.tablesWords)(t);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${t.length?` at ${n}`:''}, arrived ${e.time}? It comes off the Covers${t.length?` and ${n} ${t.length>1?'go':'goes'} back to Free`:''}.`}function $(e){return`Put walk-in ${e.ref} back to seated? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`}async function j(e,n){await u.repo.bookings.setStatus(n.id,'cancelled'),await u.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,b.tablesOf)(n.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function C(e,t){await u.repo.bookings.setStatus(t.id,'seated'),(0,b.tablesOf)(t.table).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function W({rid:e,b:t,onClose:n,onDone:l}){const s=I(t);return(0,y.jsxs)(w.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,y.jsx)(c.default,{accessible:!0,accessibilityLabel:s,children:(0,y.jsx)(w.T,{size:18,colour:k.colours.text,children:s})}),(0,y.jsxs)(w.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(w.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[h,{flexGrow:1}],onPress:async()=>{await j(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,b.tablesOf)(t.table).length?` ${(0,f.tablesWords)((0,b.tablesOf)(t.table))} free.`:''}`)}}),(0,y.jsx)(w.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:h})]})]})}},1115,[1116,17,1055,1118,85,858,996,1094,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.cancelStamp=C,_e.cancelBookingNow=w,_e.reinstateBookingNow=$,_e.CancelBookingButton=function({rid:e,b:n,name:o,onDone:s,big:l,small:c}){const[u,f]=(0,t.useState)(!1);return(0,b.canCancelBooking)(n)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(x.Button,{kind:"secondary",small:c,label:"Cancel booking",testID:`cancel-booking-${n.id}`,accessibilityLabel:`Cancel booking for ${o}, ${n.time}, ${n.partySize} Covers`,onPress:()=>f(!0),style:l?{minHeight:64}:c?{minHeight:44}:j}),u?(0,h.jsx)(D,{rid:e,b:n,name:o,onClose:()=>f(!1),onDone:s}):null]}):null},_e.CancelBookingConfirm=D,_e.ReinstateBookingButton=function({b:e,name:n,today:s,onDone:l}){const[c,u]=(0,t.useState)(!1);if(!(0,b.canReinstateBooking)(e,s))return null;const y=(0,b.reinstateBookingWords)(e,n);if(!c)return(0,h.jsx)(x.Button,{kind:"ghost",label:"Undo cancel",testID:`reinstate-booking-${e.id}`,accessibilityLabel:`Undo cancel for ${n}`,onPress:()=>u(!0),style:j});return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:()=>u(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center'},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, put back to booked",testID:"reinstate-booking-yes",accessibilityLabel:`Yes, put ${n} back to booked`,style:[j,{flexGrow:1}],onPress:async()=>{await $(e),u(!1),l?.(`${n} put back to booked.`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-booking-no",onPress:()=>u(!1),style:j})]})]})};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]),c=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]),y=r(d[8]),k=r(d[9]),p=r(d[10]),x=r(d[11]),h=r(d[12]);const j={minHeight:56},B={display:'Display',owner:'Managers app',staff:'Staff app',chef:'Kitchen app',customer:'Customer page'};function C(e){const t=y.useSession.getState().meId,n=t?k.useOwner.getState().staff.find(e=>e.id===t):void 0,o=B[p.APP_VARIANT]??'CoverCharge';return{by:n?`${n.name.replace(' (example)','')} (${o})`:o,at:(new Date).toISOString(),app:o,...e.table?{table:e.table}:{}}}async function w(e,t){const n=(0,l.tablesOf)(t.table);await s.repo.bookings.update(t.id,{status:'cancelled',cancelled:C(t),...(0,c.tablePatch)(null)}),n.forEach(t=>l.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function $(e){await s.repo.bookings.setStatus(e.id,'confirmed')}function D({rid:e,b:t,name:n,onClose:s,onDone:c}){const y=(0,b.cancelBookingWords)(t,n),k=(0,l.tablesOf)(t.table);return(0,h.jsxs)(x.Sheet,{visible:!0,onClose:s,title:"Cancel booking?",maxWidth:560,testID:"cancel-booking-confirm",children:[(0,h.jsx)(o.default,{accessible:!0,accessibilityLabel:y,style:{alignItems:'center',gap:8},children:(0,h.jsx)(x.T,{size:18,colour:f.colours.text,style:{textAlign:'center'},children:y})}),(0,h.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,h.jsx)(x.Button,{label:"Yes, cancel booking",testID:"cancel-booking-yes",accessibilityLabel:`Yes, cancel booking for ${n}`,style:[j,{flexGrow:1}],onPress:async()=>{await w(e,t),s(),c?.(`${n} cancelled.${k.length?` ${(0,u.tablesWords)(k)} free.`:''}`)}}),(0,h.jsx)(x.Button,{kind:"secondary",label:"Keep booking",testID:"cancel-booking-no",accessibilityLabel:`Keep booking for ${n}`,onPress:s,style:j})]})]})}},1116,[17,85,858,996,1090,1117,1094,804,920,876,856,777,8]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canCancelBooking",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canReinstateBooking",{enumerable:!0,get:function(){return t}}),e.cancelBookingWords=function(n,t){const o=`${n.partySize} Cover${1===n.partySize?'':'s'}`;return`Cancel booking for ${t}, ${n.time}, ${o}? The table is freed. Website bookings will cancel it on the website and may email the guest.`},e.reinstateBookingWords=function(n,t){return`Put ${t} back to booked for ${n.time}? CoverCharge only \u2014 if it was cancelled on the website, put it back there too if needed.`},e.cancelledOnDay=o,e.cancelledDayTally=function(n,t){const a=o(n,t),l=a.filter(n=>!!n.walkIn),c=a.filter(n=>!n.walkIn);return{count:a.length,covers:a.reduce((n,t)=>n+t.partySize,0),bookings:c.length,bookingCovers:c.reduce((n,t)=>n+t.partySize,0),walkIns:l.length,walkInCovers:l.reduce((n,t)=>n+t.partySize,0),list:a}},e.cancelledTallyWords=function(n,t="today"){if(!n.count)return`No cancellations ${t}`;const o=[],a=n.bookings??0,l=n.walkIns??0;a&&o.push(`${a} booking${1===a?'':'s'} (${n.bookingCovers??0} Cover${1===(n.bookingCovers??0)?'':'s'})`);l&&o.push(`${l} walk-in${1===l?'':'s'} (${n.walkInCovers??0} Cover${1===(n.walkInCovers??0)?'':'s'})`);if(!o.length)return`Cancelled ${t}: ${n.count} \xb7 ${n.covers} Cover${1===n.covers?'':'s'}`;return`Cancelled ${t}: ${o.join(' \xb7 ')}`};const n=n=>!n.walkIn&&('confirmed'===n.status||'pending'===n.status||'seated'===n.status),t=(n,t)=>!n.walkIn&&'cancelled'===n.status&&n.date>=t;function o(n,t){return n.filter(n=>n.date===t&&'cancelled'===n.status).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name))}},1117,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSeatClearFinish=function(){const t=(0,A.useSignedIn)(),o=(0,A.useInStaffApp)(),_='staff'===s.APP_VARIANT||'chef'===s.APP_VARIANT||o,l=(0,c.canSeatClearFinish)({device:s.IS_CAR||'display'===s.APP_VARIANT||!_&&!t,viaDisplay:(0,n.isKitchenViaDisplay)(),role:t?.role,ownerAccess:t?.ownerAccess,managerAccess:t?.managerAccess});return{ok:l,hint:l?void 0:c.SEAT_CLEAR_HINT}};var s=r(d[0]),n=r(d[1]),c=r(d[2]),A=r(d[3])},1118,[856,922,1119,1055]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SEAT_CLEAR_HINT",{enumerable:!0,get:function(){return n}}),e.canSeatClearFinish=function(n){return!(!n.device&&!n.viaDisplay)||('owner'===n.role||'manager'===n.role||!(!n.ownerAccess&&!n.managerAccess))};const n='Ask a manager to seat, finish or clear a table.'},1119,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:s,who:i,role:n,inStaffApp:l,shiftManager:a,big:o,testID:d}){const[h,u]=(0,t.useState)(!1),p=(0,b.useSession)(e=>e.meId),y=(0,m.useOwner)(e=>e.staff.find(e=>e.id===p&&e.active));return s.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:l,role:n,shiftManager:a})||p&&!(0,x.canChangeBookings)(y)?null:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:d??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),h?(0,N.jsx)(V,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:n,hidePrivate:a}){const[o,d]=(0,t.useState)(null),r=(0,l.useBookings)(e).filter(e=>!e.walkIn&&e.date>=s&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,200);return o?(0,N.jsx)(V,{rid:e,id:o,who:i,hidePrivate:a,onClose:n}):(0,N.jsxs)(z.Sheet,{visible:!0,onClose:n,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),r.length?r.map(e=>(0,N.jsx)(z.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${L(e.date,s)} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${L(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56}},e.id)):(0,N.jsx)(z.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,N.jsx)(z.Button,{kind:"ghost",label:"Close",onPress:n,style:{minHeight:44}})]})},_e.EditBookingSheet=V;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=(e=i)&&e.__esModule?e:{default:e},l=_r(_d[3]),a=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),y=_r(_d[15]),j=_r(_d[16]),D=_r(_d[17]),v=_r(_d[18]),f=_r(_d[19]),C=_r(_d[20]),I=_r(_d[21]),k=_r(_d[22]),w=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),$=_r(_d[26]),P=_r(_d[27]),O=_r(_d[28]),W=_r(_d[29]),z=_r(_d[30]),B=_r(_d[31]),N=_r(_d[32]);const E=/^([01]\d|2[0-3]):[0-5]\d$/,R=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const L=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,D.ymd)(s)?'Tomorrow':F(e)};const A=e=>e?(e/100).toFixed(e%100?2:0):'',M=e=>{const t=(0,B.parseMoneyInput)(e);return null!=t&&t>=0?Math.round(100*t):NaN},F=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',H=e=>{const t=e.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);return t?`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`:''},_=e=>e.charAt(0).toUpperCase()+e.slice(1);function Y({title:e,children:t,testID:s}){return(0,N.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,N.jsx)(z.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const G=({label:e,value:t,onChange:s,max:i=20,testID:n})=>(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:e}),(0,N.jsx)(z.Stepper,{testID:n,value:t,min:0,max:i,onChange:s,label:e})]});function V({rid:e,id:i,who:b,onClose:m,hidePrivate:x=!1}){(0,$.useBlurOutside)();const B=(0,l.useBookings)(e),L=B.find(e=>e.id===i),V=(0,d.useRestaurant)(e),K=(0,a.usePlan)(e),U=(0,o.useBlocks)(e=>e.blocks),[q,X]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Q,J]=(0,t.useState)(L?(0,c.draftOf)(L):null),[Z,ee]=(0,t.useState)(!1),[te,se]=(0,t.useState)(null),[ie,ne]=(0,t.useState)(null),[le,ae]=(0,t.useState)(!1),[oe,de]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositDue:0)),[re,ce]=(0,t.useState)(A(L?(0,c.draftOf)(L).depositAmount:0)),[he,ue]=(0,t.useState)(F(L?(0,c.draftOf)(L).depositDate:''));if(!L||!q||!V)return null;const pe=e=>{se(null),ne(null),X({...q,...e})},ge=(0,O.depositOf)(V.settings),be=e=>{const t=e.partySize??q.partySize,s=Math.min(e.children??q.children??0,Math.max(0,t-1));if(!(0,c.isWixBooking)(L)&&q.depositOn&&!q.depositPaid&&M(oe||'0')===(0,O.depositDue)(ge,q.partySize,q.children??0)){const e=(0,O.depositDue)(ge,t,s);e>0&&de(A(e))}pe({...e,children:s})},me=(0,v.bookingSlotMinutesOf)(V),xe=R(q.time),ye=E.test(xe),je=q.area?K.areas.filter(e=>e.name===q.area).map(e=>e.id):null,De=e=>!je||e.split('+').every(e=>je.includes(K.tables.find(t=>t.name===e)?.areaId??'')),ve=(0,y.tableOptions)(K,B.filter(e=>e.date===q.date),q.table).filter(e=>De(e)||e===q.table),fe=!(q.depositOn&&(Number.isNaN(M(oe||'0'))||q.depositPaid&&(Number.isNaN(M(re||'0'))||he.trim()&&!H(he)))),Ce={...q,time:xe,depositDue:M(oe||'0')||0,depositAmount:M(re||'0')||0,depositDate:H(he)},Ie=(0,c.changedDraftFields)(Q??(0,c.draftOf)(L),Ce),ke=V.settings.turnMins??90,we=!!q?.email?.trim()&&q.email.trim()!==(L?.email??'').trim(),Te=(0,u.bookingRulesOf)(V),Se=async()=>{const t=(0,c.editPatch)(L,Ce,{by:b||'Team member',app:r.APP_VARIANT});if(le&&we&&Object.assign(t,(0,u.marketingChoice)(Ce.email,!0)),Object.keys(t).length&&await l.repo.bookings.update(L.id,t),'seated'===L.status&&'table'in t&&t.table!==L.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(L.table),n=s(t.table),l=a.useFloor.getState(),o=i.map(t=>l.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!n.includes(e)).forEach(t=>l.setLive(e,t,{stage:void 0,dirty:!0})),n.forEach(t=>l.setLive(e,t,{stage:o,dirty:!1}))}ne(`Saved. Changed: ${(0,c.editedWords)(Ie)}.`),se(null),m()},$e=()=>{const t=ye?(0,o.blockAt)(U,e,q.date,xe):void 0,s=(0,c.editWarnings)(L,Ce,B,t,ke,K);!s.length||te?Se():se(s)},Pe=q.allergies??[],Oe=e=>pe({allergyNone:!1,allergies:Pe.some(t=>t.allergen===e)?Pe.filter(t=>t.allergen!==e):[...Pe,{allergen:e,severity:'allergy'}]}),We=(0,c.historyLines)(L);return(0,N.jsxs)(z.Sheet,{visible:!0,onClose:()=>{Ie.length?ee(!0):(ee(!1),m())},title:`Edit booking \xb7 ${L.name} \xb7 ${L.ref}`,maxWidth:760,testID:"edit-booking-sheet",onTypingDone:()=>{(0,C.hideKeyboard)(),Ie.length&&ye&&fe&&q.name.trim().length>=1&&$e()},typingDoneLabel:Ie.length?'Done, save changes':'Done, hide the keyboard',footer:(0,N.jsx)(z.Button,{label:te?'Save anyway':'Save changes',testID:"edit-save",disabled:!ye||!fe||q.name.trim().length<1||!Ie.length,onPress:$e,style:{minHeight:56,width:'100%'}}),children:[(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(w.DepositChip,{b:L,money:!0,big:!0,testID:"edit-deposit"})}),(0,c.isWixBooking)(L)?(0,N.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: change what you need, then press Save changes. Website bookings are updated too."}),(0,N.jsxs)(Y,{title:"Deposit",testID:"edit-section-deposit",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No deposit",selected:!q.depositOn,testID:"edit-deposit-none",onPress:()=>pe({depositOn:!1,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit due",selected:!!q.depositOn&&!q.depositPaid&&!q.depositWaived,testID:"edit-deposit-due",onPress:()=>pe({depositOn:!0,depositPaid:!1,depositWaived:!1})}),(0,N.jsx)(z.Chip,{label:"Deposit paid",selected:!!q.depositOn&&!!q.depositPaid,testID:"edit-deposit-paid",onPress:()=>{re||ce(oe),he||ue(F((0,D.ymd)(new Date))),pe({depositOn:!0,depositPaid:!0,depositWaived:!1})}}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsx)(z.Chip,{label:"Deposit waived",selected:!0,testID:"edit-deposit-waived",onPress:()=>{}}):null]}),q.depositOn&&!q.depositPaid&&q.depositWaived?(0,N.jsxs)(z.T,{size:15,center:!0,colour:j.colours.goldLight,testID:"edit-deposit-waived-by",children:[L.depositWaived?.by?(0,O.waiverText)(L.depositWaived):'Waived',". Tap Deposit due to ask for it again."]}):null,q.depositWaived||Ie.includes('deposit')?null:(0,N.jsx)(n.default,{style:{alignItems:'center'},children:(0,N.jsx)(P.WaiveDepositButton,{b:L,who:b,onDone:e=>{const t={...q,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e};X(t),J(s=>s?{...s,depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:e}:t)}})}),q.depositOn?(0,N.jsx)(z.Field,{money:!0,label:"Deposit due (\xa3)",value:oe,onChangeText:e=>{de(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,q.depositOn&&q.depositPaid?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(z.Field,{money:!0,label:"Amount paid (\xa3)",value:re,onChangeText:e=>{ce(e),pe({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"How was it paid?"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.DEPOSIT_METHODS.map(e=>(0,N.jsx)(z.Chip,{label:_(e),selected:q.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>pe({depositMethod:e})},e))}),(0,N.jsx)(z.Field,{label:"Date paid (DD/MM/YYYY)",value:he,onChangeText:e=>{ue((0,s.slashDate)(e,he)),pe({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),he.trim()&&!H(he)?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,fe?null:(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,N.jsx)(z.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,N.jsxs)(Y,{title:"When",testID:"edit-section-when",children:[(0,N.jsx)(k.BookingDatePicker,{r:V,today:new Date,value:q.date,onChange:e=>pe({date:e})}),(0,N.jsx)(I.TimeRoller,{testID:"edit-time",value:(0,f.snapTime)(q.time,me),onChange:e=>pe({time:e}),step:me}),ye?null:(0,N.jsx)(z.T,{size:15,colour:j.colours.amber,center:!0,children:"Choose a time on the roller."}),(0,N.jsx)(T.AdultsChildren,{value:(0,S.peopleOf)(q.partySize,q.children),onChange:e=>be(e),depositsOn:ge.on&&ge.perPersonPence>0,testID:"edit-people"}),(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,children:"Table time"}),(0,N.jsx)(z.Stepper,{testID:"edit-duration",value:q.duration||0,min:0,max:360,step:15,onChange:e=>pe({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,N.jsxs)(Y,{title:"Where",testID:"edit-section-where",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"Any area",selected:!q.area,testID:"edit-area-any",onPress:()=>pe({area:''})}),K.areas.map(e=>(0,N.jsx)(z.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:q.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>pe({area:e.name})},e.id))]}),(0,N.jsx)(z.T,{size:18,weight:"semibold",center:!0,children:(0,y.tableButtonLabel)(q.table)}),(0,y.splitChoices)(q.table).length?(0,N.jsxs)(n.default,{testID:"edit-split",style:{gap:6,alignItems:'center',width:'100%'},children:[(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:"Split the joined tables"}),(0,N.jsx)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:(0,y.splitChoices)(q.table).map(e=>(0,N.jsx)(z.Button,{kind:"secondary",label:`Keep Table ${e} only`,accessibilityLabel:`Split the tables: keep table ${e} only, free the others`,onPress:()=>pe({table:e}),style:{minHeight:48,minWidth:140},testID:`edit-split-${e}`},`split-${e}`))})]}):null,(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:q.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(q.table?'':', chosen'),onPress:()=>pe({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),ve.map(e=>(0,N.jsx)(z.Button,{kind:e===q.table?'primary':'secondary',label:(0,y.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,y.tableButtonLabel)(e)}${e===q.table?', chosen':''}`,onPress:()=>pe({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,N.jsxs)(Y,{title:"Guest",testID:"edit-section-guest",children:[(0,N.jsx)(z.Field,{label:"Name",value:q.name,onChangeText:e=>pe({name:e}),testID:"edit-name"}),(0,N.jsx)(z.Field,{label:"Phone",value:q.phone,onChangeText:e=>pe({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,N.jsx)(z.Field,{label:"Email",value:q.email,onChangeText:e=>pe({email:e}),keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1,testID:"edit-email"}),we&&Te.marketingOptIn?(0,N.jsx)(z.Toggle,{label:Te.marketingWords,value:le,onChange:ae,testID:"edit-marketing",a11y:"Guest agrees to marketing emails. Only tick if the guest says yes."}):null,(0,N.jsx)(z.T,{size:16,center:!0,children:"Booked by"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.SOURCES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>pe({source:e.id})},e.id))}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.TAGS.map(e=>{const t=(q.tags??[]).includes(e);return(0,N.jsx)(z.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>pe({tags:t?(q.tags??[]).filter(t=>t!==e):[...q.tags??[],e].sort()})},e)})})]}),(0,N.jsxs)(Y,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,N.jsx)(G,{label:"Dogs",value:q.dogs??0,max:6,onChange:e=>pe({dogs:e}),testID:"edit-dogs"}),(0,N.jsx)(G,{label:"High chairs",value:q.highChairs??0,max:10,onChange:e=>pe({highChairs:e}),testID:"edit-high-chairs"}),(0,N.jsx)(G,{label:"Wheelchair users",value:q.wheelchair??0,max:10,onChange:e=>pe({wheelchair:e}),testID:"edit-wheelchair"}),(0,N.jsx)(z.T,{size:16,center:!0,children:"Occasion"}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.OCCASIONS.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:(q.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>pe({occasion:e.id})},e.id||'none'))})]}),(0,N.jsxs)(Y,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,N.jsxs)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Chip,{label:"No allergies",selected:!!q.allergyNone&&!Pe.length,testID:"edit-allergy-none",onPress:()=>pe({allergyNone:!0,allergies:[]})}),p.ALLERGENS.map(e=>(0,N.jsx)(z.Chip,{label:e.short,selected:Pe.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>Oe(e.id)},e.id))]}),Pe.map(e=>(0,N.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,N.jsxs)(z.T,{size:15,center:!0,children:[p.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:p.SEVERITIES.map(t=>(0,N.jsx)(z.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>pe({allergies:Pe.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,N.jsx)(z.Field,{label:"Anything else about allergies",value:q.allergyNote,onChangeText:e=>pe({allergyNote:e}),testID:"edit-allergy-note"}),Ie.includes('allergies')&&Pe.length?(0,N.jsx)(z.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,N.jsx)(G,{label:"Vegan",value:q.vegan??0,max:q.partySize,onChange:e=>pe({vegan:e}),testID:"edit-vegan"}),(0,N.jsx)(G,{label:"Vegetarian",value:q.vegetarian??0,max:q.partySize,onChange:e=>pe({vegetarian:e}),testID:"edit-vegetarian"})]}),(q.holds??[]).length||(L.holds??[]).some(e=>e.qty>0&&!e.served)?(0,N.jsxs)(Y,{title:"Reserved platters, crab and lobster",testID:"edit-section-holds",children:[(0,N.jsx)(z.Muted,{center:!0,children:"Change the number, or remove a reserved item. Saving updates this booking on every device."}),(q.holds??[]).map(e=>{const t=(0,h.reservablesOf)(V),s='item'===e.kind?t.find(t=>t.id===e.id||t.id===e.id.replace(/^:/,''))?.name:void 0,i=(0,c.holdLabel)(e,s),l=`edit-hold-${e.kind}-${e.id.startsWith(':')?'legacy-':''}${e.id.replace(/^:/,'')}`;return(0,N.jsxs)(n.default,{testID:l,style:{gap:6,width:'100%'},children:[(0,N.jsxs)(z.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,N.jsx)(z.T,{size:16,style:{flexShrink:1,paddingRight:8},children:i}),(0,N.jsx)(z.Stepper,{testID:l,value:e.qty,min:0,max:20,onChange:t=>pe({holds:(0,c.setEditableHoldQty)(q.holds??[],e.kind,e.id,t)}),label:i})]}),(0,N.jsx)(z.Button,{kind:"secondary",small:!0,label:"Remove",accessibilityLabel:`Remove reserved ${i}`,testID:`${l}-remove`,onPress:()=>pe({holds:(0,c.removeEditableHold)(q.holds??[],e.kind,e.id)}),style:{minHeight:44,alignSelf:'flex-start'}})]},`${e.kind}:${e.id}`)}),(q.holds??[]).length?null:(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,testID:"edit-holds-none",children:"No reserved platters, crab or lobster on this booking now. Save to keep this."})]}):null,'cancelled'!==L.status?(0,N.jsxs)(Y,{title:"Status",testID:"edit-section-status",children:[(0,N.jsx)(z.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:c.EDIT_STATUSES.map(e=>(0,N.jsx)(z.Chip,{label:e.label,selected:q.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>pe({status:e.id})},e.id))}),(0,N.jsx)(z.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,N.jsx)(Y,{title:"Notes",testID:"edit-section-notes",children:(0,N.jsx)(z.Field,{label:"Notes",value:q.notes,onChangeText:e=>pe({notes:e}),placeholder:Te.notesPlaceholder,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),te?(0,N.jsxs)(n.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[te.map(e=>(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,N.jsx)(z.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,ie?(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.goldLight,children:ie}):null,Z?(0,N.jsxs)(n.default,{testID:"edit-discard-warn",style:{gap:10,padding:14,borderRadius:14,borderWidth:1.5,borderColor:j.colours.gold,backgroundColor:j.colours.surface2},children:[(0,N.jsx)(z.T,{size:20,weight:"bold",center:!0,children:"Discard unsaved changes?"}),(0,N.jsx)(z.T,{size:16,center:!0,colour:j.colours.muted,children:"Your changes have not been saved."}),(0,N.jsxs)(z.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,N.jsx)(z.Button,{kind:"secondary",label:"Keep editing",testID:"edit-discard-keep",onPress:()=>ee(!1),style:{minHeight:52,flex:1}}),(0,N.jsx)(z.Button,{kind:"danger",label:"Discard changes",testID:"edit-discard-discard",onPress:()=>{ee(!1),m()},style:{minHeight:52,flex:1}})]})]}):null,We.length?(0,N.jsx)(Y,{title:"Changes",testID:"edit-history",children:We.slice(0,12).map((e,t)=>(0,N.jsx)(z.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,N.jsx)(W.CancelBookingButton,{rid:e,b:L,name:L.name,big:!0,onDone:()=>m()}),(0,N.jsx)(W.ReinstateBookingButton,{b:L,name:L.name,today:(0,D.ymd)(new Date),onDone:()=>m()})]})}},1120,[17,1031,85,858,996,993,860,856,1112,1053,1077,845,920,876,994,1090,804,863,1103,1121,815,1122,1104,1087,1099,1100,1101,1123,841,1116,777,840,8]); __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.hmToMins=n,e.minsToHm=o,e.snapTime=u,e.hourValues=function(){return Array.from({length:24},(t,n)=>n)},e.minuteValues=function(t){const n=t>0&&t<=60&&60%t==0?t:15,o=[];for(let t=0;t<60;t+=n)o.push(t);return o},e.splitHm=function(o){const i=n(t.test(o)?o:u(o,15));return Number.isFinite(i)?{hour:Math.floor(i/60),minute:i%60}:{hour:12,minute:0}},e.joinHm=function(t,n){const o=(n%60+60)%60;return`${String((t%24+24)%24).padStart(2,'0')}:${String(o).padStart(2,'0')}`},e.timeRollerHint=function(t){return`24-hour. Times are every ${t>0?t:15} minutes. Roll or swipe each wheel. No typing.`};const t=/^([01]\d|2[0-3]):[0-5]\d$/;function n(t){const n=t.trim().match(/^(\d{1,2}):(\d{2})$/);if(!n)return NaN;const o=Number(n[1]),u=Number(n[2]);return o>23||u>59?NaN:60*o+u}function o(t){const n=(Math.round(t)%1440+1440)%1440,o=Math.floor(n/60),u=n%60;return`${String(o).padStart(2,'0')}:${String(u).padStart(2,'0')}`}function u(t,u){const i=u>0&&u<=60&&60%u==0?u:15,s=n(t),c=Number.isFinite(s)?s:720;return o(Math.round(c/i)*i)}},1121,[]); __d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TimeRoller=function({value:e,onChange:t,step:n=15,testID:u="time-roller"}){const{hour:h,minute:m}=(0,s.splitHm)(e),f=(0,s.hourValues)(),x=(0,s.minuteValues)(n),p=f.indexOf(h),y=x.reduce((e,t)=>Math.abs(t-m)t((0,s.joinHm)(f[e],y)),label:"Hours",format:e=>String(e).padStart(2,'0'),testID:`${u}-hours`}),(0,c.jsx)(b,{values:x,index:j<0?0:j,onChange:e=>t((0,s.joinHm)(h,x[e])),label:"Minutes",format:e=>String(e).padStart(2,'0'),testID:`${u}-minutes`})]})]}),(0,c.jsx)(l.T,{size:13,center:!0,colour:o.colours.muted,children:(0,s.timeRollerHint)(n)})]})};var t=r(_d[0]),n=e(r(_d[1])),i=e(r(_d[2])),o=r(_d[3]),s=r(_d[4]),l=r(_d[5]),c=r(_d[6]);const d=48,u=5,h=2;function m(e,t){return(e%t+t)%t}function b({values:e,index:s,onChange:b,label:f,format:x,testID:p}){const y=(0,t.useRef)(null),j=(0,t.useRef)(0),v=e.length,w=e[m(s,v)],R=`${x(w)} ${f.toLowerCase()}`,S=e=>b(m(s+e,v)),T=()=>{y.current=null,j.current=0};return(0,c.jsx)(i.default,{testID:p,accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:f,accessibilityValue:{min:e[0],max:e[v-1],now:w,text:R},accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{'increment'===e.nativeEvent.actionName&&S(1),'decrement'===e.nativeEvent.actionName&&S(-1)},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{y.current=e.nativeEvent.pageY,j.current=0},onResponderMove:e=>{if(null==y.current)return;const t=e.nativeEvent.pageY-y.current;for(y.current=e.nativeEvent.pageY,j.current+=t;j.current<=-24;)S(1),j.current+=d;for(;j.current>=24;)S(-1),j.current-=d},onResponderRelease:T,onResponderTerminate:T,style:{width:120,height:240,alignItems:'center'},children:Array.from({length:u},(t,i)=>{const u=i-h,b=e[m(s+u,v)],f=0===u,p=2===Math.abs(u);return(0,c.jsx)(n.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",onPress:()=>{u&&S(u)},style:{height:d,width:'100%',alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(l.T,{size:f?28:p?18:22,weight:f?'bold':'medium',colour:f?o.colours.goldLight:o.colours.muted,center:!0,style:{opacity:f?1:p?.35:.7},children:x(b)})},`${i}-${b}`)})})}},1122,[17,385,85,804,1121,777,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1123,[17,85,858,856,1120,841,1095,804,777,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WaiveDepositButton=function({b:e,who:s,onDone:f,small:w}){const[x,W]=(0,t.useState)(!1),[j,k]=(0,t.useState)(''),[D,$]=(0,t.useState)(!1);if(!(0,u.canWaiveDeposit)(e))return null;const P=(e.depositDue??0)>0?y(e.depositDue):'the',I=e.walkIn?`walk-in ${e.ref}`:e.name,_=!!(0,u.wixPayStatus)(e);return x?(0,v.jsxs)(o.default,{testID:`waive-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:b.colours.surface,alignItems:'center',width:'100%'},children:[(0,v.jsxs)(h.T,{size:17,weight:"semibold",center:!0,children:["Waive ",P," deposit for ",I,"?"]}),(0,v.jsxs)(h.Muted,{center:!0,children:["The guest won\u2019t be asked for it. Your name (",(s||'Team member').slice(0,40),") is saved on the booking.",_?' Website bookings may still ask for it on the website.':'']}),(0,v.jsx)(h.Field,{label:"Why? (optional)",value:j,onChangeText:e=>k(e.slice(0,120)),placeholder:"For example: regular",testID:`waive-note-${e.id}`}),(0,v.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(h.Button,{label:"Yes, waive it",testID:`waive-yes-${e.id}`,accessibilityLabel:`Yes, waive the deposit for ${I}`,onPress:async()=>{if(D)return;$(!0);const t=(s||'Team member').slice(0,80),o=(0,c.editPatch)(e,{...(0,c.draftOf)(e),depositOn:!0,depositPaid:!1,depositWaived:!0,depositWaiveNote:j.trim()},{by:t,app:l.APP_VARIANT});try{Object.keys(o).length&&await n.repo.bookings.update(e.id,o),(0,p.announce)(`Deposit waived for ${I}. Saved with your name.`),f?.(j.trim()),W(!1)}finally{$(!1)}},disabled:D,style:{minHeight:48,minWidth:140}}),(0,v.jsx)(h.Button,{kind:"ghost",label:"Keep the deposit",testID:`waive-no-${e.id}`,onPress:()=>{W(!1),k('')},style:{minHeight:48,minWidth:140}})]})]}):(0,v.jsx)(h.Button,{small:w,kind:"secondary",label:"Waive deposit",testID:`waive-deposit-${e.id}`,accessibilityLabel:`Waive the deposit for ${I}`,onPress:()=>W(!0),style:{minHeight:44}})};var e,t=r(d[0]),s=r(d[1]),o=(e=s)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),b=r(d[7]),h=r(d[8]),v=r(d[9]);const y=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`},1123,[17,85,858,856,1112,841,1095,804,777,8]); __d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingHistory=function({rid:e,today:t}){const[b,k]=(0,s.useState)((0,n.addDaysIso)(t,-1)),[w,v]=(0,s.useState)('day'),[p,f]=(0,s.useState)((0,n.ddmmyyyy)((0,n.addDaysIso)(t,-1))),[D,$]=(0,s.useState)(!1),[_,I]=(0,s.useState)(0),T=(0,n.historyRange)(w,b,t),C=(0,c.useKitchenHistory)(e,T.from,T.to,t,_),P=(0,d.parseHistoryInput)(p),B=!!P&&(0,d.validPastDate)(P,t),L=e=>{(0,d.validPastDate)(e,t)&&(k(e),f((0,n.ddmmyyyy)(e)))};if(!C.allowed)return(0,h.jsx)(l.Card,{children:(0,h.jsx)(l.T,{size:20,center:!0,children:"Booking history is for the Head Chef and managers. Sign in to the Head Chef app to see it."})});const z='day'===w?1:7,S=(0,n.addDaysIso)('day'===w?b:(0,n.mondayOf)(b),-z),R='day'===w?(0,n.addDaysIso)(b,1):(0,n.addDaysIso)((0,n.mondayOf)(b),7),W='day'===w?'day':'week';return(0,h.jsxs)(o.default,{style:{gap:14},testID:"booking-history",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:12,alignItems:'stretch'},children:[(0,h.jsx)(l.T,{size:18,center:!0,children:"Bookings, covers and walk-ins on past days. Read-only; nothing is changed."}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:'day'===w?'primary':'secondary',testID:"bh-mode-day",label:"One day",accessibilityLabel:"Show one day"+('day'===w?', selected':''),onPress:()=>v('day')}),(0,h.jsx)(l.Button,{kind:'week'===w?'primary':'secondary',testID:"bh-mode-week",label:"Whole week",accessibilityLabel:"Show the whole week, Monday to Sunday"+('week'===w?', selected':''),onPress:()=>v('week')})]}),(0,h.jsx)(l.Field,{label:"Past date (DD/MM/YYYY)",value:p,onChangeText:e=>f((0,i.slashDate)(e,p)),placeholder:"09/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,accessibilityLabel:"Past date, day, month and four-digit year",autoCapitalize:"none",autoCorrect:!1,testID:"bh-date",style:{textAlign:'center'}}),B?null:(0,h.jsx)(l.T,{size:16,center:!0,testID:"bh-date-hint",children:"Enter a past date as DD/MM/YYYY, for example 09/11/2026."}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:"secondary",label:"Pick a date",testID:"bh-pick",accessibilityLabel:`Pick a date from a calendar. Now showing ${u(b)}`,onPress:()=>$(!0)}),(0,h.jsx)(l.Button,{label:"Show",testID:"bh-show",accessibilityLabel:`Show booking history for ${B&&P?u(P):'a valid past date'}`,disabled:!B,onPress:()=>{P&&L(P),I(_+1)}})]}),(0,h.jsxs)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:[(0,h.jsx)(l.Button,{kind:"secondary",testID:"bh-prev",label:`Previous ${W}`,accessibilityLabel:`Previous ${W}, ${u(S)}`,onPress:()=>L(S)}),(0,h.jsx)(l.Button,{kind:"secondary",testID:"bh-next",label:`Next ${W}`,accessibilityLabel:(0,d.validPastDate)(R,t)?`Next ${W}, ${u(R)}`:`Next ${W}, not available. Booking history is for past days only`,disabled:!(0,d.validPastDate)(R,t),onPress:()=>L(R)})]}),'day'===w?(0,h.jsx)(l.Row,{wrap:!0,gap:10,style:{justifyContent:'center'},children:(0,h.jsx)(l.Button,{small:!0,kind:"secondary",testID:"bh-prev-week",label:"Same day last week",accessibilityLabel:`Same day last week, ${u((0,n.addDaysIso)(b,-7))}`,onPress:()=>L((0,n.addDaysIso)(b,-7))})}):null]})}),(0,h.jsx)(y.LookBackCalendar,{visible:D,today:t,selected:b,purpose:"Booking history",idPrefix:"bh",onClose:()=>$(!1),onPick:e=>{L(e),$(!1)}}),C.data?'day'===w?C.data.days[0]?(0,h.jsx)(x,{d:C.data.days[0]}):null:(0,h.jsx)(j,{days:C.data.days,onDay:e=>{L(e),v('day')}}):(0,h.jsx)(l.Card,{children:(0,h.jsx)(o.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(l.T,{size:20,center:!0,testID:"bh-status",children:C.error||'Loading booking history\u2026'})})})]})};var e,s=r(_d[0]),t=r(_d[1]),o=(e=t)&&e.__esModule?e:{default:e},l=r(_d[2]),i=r(_d[3]),d=r(_d[4]),n=r(_d[5]),c=r(_d[6]),y=r(_d[7]),b=r(_d[8]),h=r(_d[9]);const u=e=>`${(0,n.dayName)(e)} ${(0,n.ddmmyyyy)(e)}`,k=({label:e,value:s,id:t})=>(0,h.jsxs)(o.default,{testID:`bh-stat-${t}`,accessible:!0,accessibilityLabel:`${e}: ${s}`,style:{alignItems:'center',minWidth:96,padding:8,borderRadius:12,borderWidth:1,borderColor:b.colours.border},children:[(0,h.jsx)(l.T,{size:28,weight:"bold",colour:b.colours.gold,center:!0,children:String(s)}),(0,h.jsx)(l.T,{size:16,center:!0,children:e})]});function x({d:e}){return(0,h.jsxs)(o.default,{style:{gap:12},testID:"bh-day",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:10,alignItems:'center'},accessible:!0,accessibilityLabel:(0,n.dayText)(e)+`. Done: ${e.done_covers+e.walk_in_covers} covers.`,children:[(0,h.jsx)(l.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:u(e.date)}),(0,h.jsx)(o.default,{testID:"bh-stats",style:{alignSelf:'stretch'},children:(0,h.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(k,{id:"bookings",label:"Bookings",value:e.bookings}),(0,h.jsx)(k,{id:"booked",label:"Booked covers",value:e.booked_covers}),(0,h.jsx)(k,{id:"walkins",label:"Walk-ins",value:e.walk_ins}),(0,h.jsx)(k,{id:"walkin-covers",label:"Walk-in covers",value:e.walk_in_covers}),(0,h.jsx)(k,{id:"done",label:"Done",value:e.done_covers+e.walk_in_covers}),(0,h.jsx)(k,{id:"total",label:"Total",value:e.total_covers})]})}),e.not_counted?(0,h.jsxs)(l.T,{size:16,center:!0,children:[e.not_counted," cancelled or no-show ",1===e.not_counted?'booking is':'bookings are'," listed but not counted."]}):null,e.old_records?(0,h.jsx)(l.T,{size:16,center:!0,colour:b.colours.muted,children:"Includes records from the previous booking system, which may be incomplete."}):null]})}),(e.lines??[]).length||e.walk_ins?null:(0,h.jsx)(l.Card,{children:(0,h.jsx)(l.T,{size:18,center:!0,children:"No bookings or walk-ins recorded for this day."})}),(e.lines??[]).map((e,s)=>(0,h.jsx)(o.default,{testID:"bh-line",accessible:!0,accessibilityLabel:(0,n.lineText)(e),style:{padding:10,borderRadius:12,borderWidth:1,borderColor:b.colours.border,alignItems:'center',opacity:e.counted?1:.7},children:(0,h.jsxs)(l.Row,{wrap:!0,gap:14,style:{justifyContent:'center'},children:[(0,h.jsx)(l.T,{size:20,weight:"bold",colour:b.colours.gold,children:e.time??'No time'}),(0,h.jsx)(l.T,{size:18,children:null==e.covers?'Covers not recorded':`${e.covers} ${1===e.covers?'cover':'covers'}`}),(0,h.jsx)(l.T,{size:18,children:e.table?`Table ${e.table}`:'No table'}),(0,h.jsx)(l.T,{size:18,children:(0,n.statusWord)(e.status)})]})},s))]})}function j({days:e,onDay:s}){const t=(0,n.sumDays)(e);return(0,h.jsxs)(o.default,{style:{gap:12},testID:"bh-week",children:[(0,h.jsx)(l.Card,{children:(0,h.jsxs)(o.default,{style:{gap:10,alignItems:'center'},accessible:!0,accessibilityLabel:`Week ${(0,n.ddmmyyyy)(e[0].date)} to ${(0,n.ddmmyyyy)(e[e.length-1].date)}: ${t.bookings} bookings, ${t.booked_covers} booked covers, ${t.walk_ins} walk-ins with ${t.walk_in_covers} covers, ${t.total_covers} covers in total`,children:[(0,h.jsxs)(l.T,{size:22,weight:"bold",center:!0,accessibilityRole:"header",children:["Week ",(0,n.ddmmyyyy)(e[0].date)," to ",(0,n.ddmmyyyy)(e[e.length-1].date)]}),(0,h.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(k,{id:"week-bookings",label:"Bookings",value:t.bookings}),(0,h.jsx)(k,{id:"week-walkins",label:"Walk-ins",value:t.walk_ins}),(0,h.jsx)(k,{id:"week-total",label:"Total",value:t.total_covers})]})]})}),e.map(e=>(0,h.jsx)(l.Button,{kind:"secondary",testID:`bh-week-day-${e.date}`,label:`${(0,n.day3)(e.date)} ${(0,n.ddmmyyyy)(e.date)} \xb7 ${e.bookings} booked (${e.booked_covers}) \xb7 ${e.walk_ins} walk-in (${e.walk_in_covers}) \xb7 Total ${e.total_covers}`,accessibilityLabel:`${(0,n.dayText)(e)}. Double tap to see this day's bookings.`,onPress:()=>s(e.date)},e.date))]})}},1124,[17,85,777,1031,1062,1125,1061,1048,804,8]); __d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"addDaysIso",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ddmmyyyy",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"day3",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"dayName",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"mondayOf",{enumerable:!0,get:function(){return l}}),e.historyRange=function(o,t,s){if('day'===o)return{from:t,to:t};const a=l(t),c=n(a,6),d=n(s,-1);return{from:a,to:c({bookings:o.bookings+t.bookings,booked_covers:o.booked_covers+t.booked_covers,walk_ins:o.walk_ins+t.walk_ins,walk_in_covers:o.walk_in_covers+t.walk_in_covers,total_covers:o.total_covers+t.total_covers}),{bookings:0,booked_covers:0,walk_ins:0,walk_in_covers:0,total_covers:0})};const o=o=>o.toISOString().slice(0,10),t=o=>new Date(o+'T12:00:00Z'),n=(n,s)=>{const a=t(n);return a.setUTCDate(a.getUTCDate()+s),o(a)},s=o=>`${o.slice(8,10)}/${o.slice(5,7)}/${o.slice(0,4)}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],c=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=o=>a[t(o).getUTCDay()],u=o=>c[t(o).getUTCDay()],l=o=>n(o,-(t(o).getUTCDay()+6)%7);function b(o){switch((o??'').toLowerCase()){case'finished':case'seated':return'Done';case'confirmed':case'booked':case'amended':return'Booked';case'cancelled':return'Cancelled';case'noshow':return'No-show';default:return o||'Not recorded'}}const y=(o,t,n)=>`${o} ${1===o?t:n}`},1125,[]); __d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TempUnitsSetup=function(){const e=(0,f.useSync)(e=>e.mode),s='live'===e||'offline'===e||'connecting'===e,o=(0,c.useSafety)(e=>e.points),b=(0,d.useOwner)(e=>e.site),[k,j]=(0,t.useState)(()=>(0,u.draftsFrom)(c.useSafety.getState().points)),[$,S]=(0,t.useState)(null),[I,w]=(0,t.useState)(!1),[T,D]=(0,t.useState)(''),[C,L]=(0,t.useState)(1),B=(0,t.useMemo)(()=>(0,u.changesOf)(k,o),[k,o]),z=e=>(0,h.chefCanSee)(b,e),A=Object.fromEntries(k.map(e=>[e.key,(0,u.problemOf)(e,k,z)])),P=Object.values(A).some(Boolean),R=e=>{j(t=>t.map(t=>t.key===e.key?e:t)),D(''),w(!1)},_=k.filter(e=>!e.archived),O=k.filter(e=>e.archived&&e.id),F=_.filter(e=>'fridge'===e.kind).length,H=_.length-F,M=e=>{const t=`new${C}`;L(C+1),D(''),w(!1),j(s=>[...s,{key:t,name:'',kind:e,location:'',max:String(u.DEFAULT_MAX[e]),due:'09:00, 16:00',archived:!1}])},W=P?'Fix the unit marked in red first.':B.length?`${B.length} change${1===B.length?'':'s'} not saved yet.`:'No changes yet.';return(0,x.jsxs)(n.default,{testID:"tu-setup",style:{gap:12,alignSelf:'center',width:'100%',maxWidth:560,alignItems:'stretch'},children:[(0,x.jsx)(l.T,{weight:"semibold",size:18,center:!0,accessibilityRole:"header",children:"Temperature units"}),(0,x.jsx)(l.T,{testID:"tu-count",size:15,center:!0,children:`${F} fridge${1===F?'':'s'} and ${H} freezer${1===H?'':'s'} checked`}),(0,x.jsx)(p.TempSaveBanner,{testID:"tu-save-banner"}),(0,x.jsx)(l.Banner,{kind:"info",title:s?'Shared with every device':'Not connected yet',children:s?'These units and their readings are on the shared food safety log, so every phone, tablet and screen at the venue shows the same units.':'These units are saved on this device until it connects. Then they are shared with every device at the venue.'}),_.map(e=>(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsx)(v,{d:e,problem:A[e.key],onChange:R,onArchive:()=>e.id?S(e.key):j(t=>t.filter(t=>t.key!==e.key))}),$===e.key?(0,x.jsxs)(n.default,{testID:"tu-archive-ask",style:{gap:8,padding:12,borderRadius:12,backgroundColor:y.colours.amberBg,alignItems:'center'},children:[(0,x.jsx)(l.T,{size:15,center:!0,children:`Archive ${e.name.trim()||'this unit'}? It will no longer be checked. Its past readings stay in History and the EHO report. Nothing is deleted.`}),(0,x.jsxs)(l.Row,{gap:8,children:[(0,x.jsx)(l.Button,{small:!0,testID:"tu-archive-confirm",label:"Archive",accessibilityLabel:`Yes, archive ${e.name}`,onPress:()=>{R({...e,archived:!0}),S(null)}}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-archive-cancel",label:"Keep it",accessibilityLabel:`No, keep ${e.name}`,onPress:()=>S(null)})]})]}):null]},e.key)),(0,x.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-add-fridge",label:"Add a fridge",onPress:()=>M('fridge')}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-add-freezer",label:"Add a freezer",onPress:()=>M('freezer')})]}),O.length?(0,x.jsxs)(n.default,{testID:"tu-archived",style:{gap:6,alignItems:'center'},children:[(0,x.jsx)(l.T,{weight:"medium",center:!0,children:"Archived (not checked, history kept)"}),O.map(e=>(0,x.jsxs)(l.Row,{gap:8,style:{justifyContent:'center'},children:[(0,x.jsx)(l.T,{size:14,center:!0,children:e.name}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:`tu-restore-${e.key}`,label:"Bring back",accessibilityLabel:`Bring back ${e.name}`,onPress:()=>R({...e,archived:!1,due:e.due||'09:00, 16:00'})})]},e.key))]}):null,I?(0,x.jsxs)(n.default,{testID:"tu-save-ask",style:{gap:8,padding:12,borderRadius:12,borderWidth:1,borderColor:y.colours.gold,alignItems:'center'},children:[(0,x.jsx)(l.T,{weight:"medium",center:!0,children:`Save ${B.length} change${1===B.length?'':'s'}?`}),B.map(e=>(0,x.jsx)(l.T,{size:14,center:!0,children:e.text},e.key)),(0,x.jsxs)(l.Row,{gap:8,children:[(0,x.jsx)(l.Button,{small:!0,testID:"tu-save-confirm",label:"Save",accessibilityLabel:"Yes, save the changes",onPress:()=>{const e=c.useSafety.getState(),t=new Set(e.points.map(e=>e.id));for(const t of B)t.add?e.addPoint(t.add):t.id&&t.patch&&e.setPoint(t.id,t.patch);j((0,u.draftsFrom)(c.useSafety.getState().points)),w(!1);const n=[...B.filter(e=>e.id).map(e=>e.id),...c.useSafety.getState().points.filter(e=>!t.has(e.id)).map(e=>e.id)],l=`Saved ${B.length} change${1===B.length?'':'s'}.`;D(s?`${l} Sending to every device\u2026`:`${l} (on this device until it connects).`),s&&(0,p.reportTempSave)('temp_units',n,l,D)}}),(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:"tu-save-cancel",label:"Back",accessibilityLabel:"Go back without saving",onPress:()=>w(!1)})]})]}):null,(0,x.jsx)(l.Button,{testID:"tu-save",label:"Save changes",disabled:!B.length||P,accessibilityHint:W,onPress:()=>w(!0),style:{alignSelf:'center',minWidth:200}}),T?(0,x.jsx)(l.T,{testID:"tu-saved",size:15,colour:y.colours.ok,center:!0,accessibilityRole:"text",children:T}):(0,x.jsx)(l.Muted,{style:{textAlign:'center'},children:W})]})};var e,t=r(_d[0]),s=r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),h=r(_d[6]),u=r(_d[7]),y=r(_d[8]),p=r(_d[9]),f=r(_d[10]),x=r(_d[11]);const b=['Downstairs','Upstairs'],k={fridge:'Fridge',freezer:'Freezer'};function v({d:e,problem:t,onChange:s,onArchive:c}){const d=e.name.trim()||'new unit';return(0,x.jsxs)(n.default,{testID:`tu-unit-${e.key}`,style:{gap:8,padding:12,borderRadius:12,borderWidth:1,borderColor:t?y.colours.red:y.colours.border,alignSelf:'stretch'},children:[(0,x.jsx)(o.TextInput,{testID:`tu-name-${e.key}`,accessibilityLabel:`Name of ${d}`,value:e.name,onChangeText:t=>s({...e,name:t}),placeholder:"e.g. Upstairs fridge 5",placeholderTextColor:"#7D776C",style:[l.styles.input,{alignSelf:'stretch',width:'100%'}]}),(0,x.jsxs)(l.Row,{wrap:!0,gap:6,children:[['fridge','freezer'].map(t=>(0,x.jsx)(l.Chip,{testID:`tu-kind-${e.key}-${t}`,label:k[t],selected:e.kind===t,accessibilityLabel:`${d}: ${k[t]}${e.kind===t?', selected':''}`,onPress:()=>s((0,u.withKind)(e,t))},t)),b.map(t=>(0,x.jsx)(l.Chip,{testID:`tu-loc-${e.key}-${t.toLowerCase()}`,label:t,selected:e.location.trim().toLowerCase()===t.toLowerCase(),accessibilityLabel:`${d}: location ${t}`,onPress:()=>s({...e,location:t})},t))]}),(0,x.jsxs)(l.Row,{wrap:!0,gap:8,children:[(0,x.jsx)(o.TextInput,{testID:`tu-loc-${e.key}`,accessibilityLabel:`Location of ${d}`,value:e.location,onChangeText:t=>s({...e,location:t}),placeholder:"Location",placeholderTextColor:"#7D776C",style:[l.styles.input,{flexGrow:1,flexBasis:120,minWidth:0,width:40}]}),(0,x.jsxs)(l.Row,{gap:6,style:{flexWrap:'nowrap'},children:[(0,x.jsx)(o.TextInput,{testID:`tu-max-${e.key}`,accessibilityLabel:`Safe limit for ${d}, degrees or colder`,value:e.max,onChangeText:t=>s({...e,max:t}),placeholder:String(u.DEFAULT_MAX[e.kind]),placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[l.styles.input,{width:72,textAlign:'center'}]}),(0,x.jsx)(l.T,{size:14,children:"\xb0C or colder"})]})]}),(0,x.jsx)(o.TextInput,{testID:`tu-due-${e.key}`,accessibilityLabel:`Check times for ${d}, 24 hour, comma separated`,value:e.due,onChangeText:t=>s({...e,due:t}),placeholder:"Check times, e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[l.styles.input,{alignSelf:'stretch',width:'100%'}]}),t?(0,x.jsx)(l.T,{testID:`tu-problem-${e.key}`,size:14,colour:y.colours.red,center:!0,accessibilityRole:"text",children:t}):null,(0,x.jsx)(l.Button,{small:!0,kind:"secondary",testID:`tu-archive-${e.key}`,label:"Archive",accessibilityLabel:`Archive ${d}`,accessibilityHint:"Stops the checks. Its past readings stay in History and the EHO report",onPress:c,style:{alignSelf:'center'}})]})}},1126,[17,85,777,812,1001,876,820,1127,804,1128,899,8]); @@ -1296,7 +1296,7 @@ __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule? __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSPECTOR_EMAIL",{enumerable:!0,get:function(){return o}}),_e.inspectorEmailProblem=r,Object.defineProperty(_e,"isInspectorEmail",{enumerable:!0,get:function(){return a}}),_e.inspectorNameProblem=s,_e.maySendInspectorLog=function(e,t){return'staff'!==e&&('chef'===e||!!t&&('owner'===t.role||'manager'===t.role||'Head Chef'===t.level))},_e.senderRoleWords=function(e,t){return'chef'===e||'Head Chef'===t?.level?'Head Chef':'owner'===t?.role?'Owner':'Manager'},_e.parseDmy=function(t){const o=/^\s*(\d{1,2})[/.\- ](\d{1,2})[/.\- ](\d{4})\s*$/.exec(t??'');if(!o)return null;const n=Number(o[1]),r=Number(o[2]),a=Number(o[3]),s=new Date(a,r-1,n);return s.getFullYear()!==a||s.getMonth()!==r-1||s.getDate()!==n?null:(0,e.ymdLocal)(s)},Object.defineProperty(_e,"dmy",{enumerable:!0,get:function(){return l}}),_e.rangeWords=d,_e.confirmQuestion=function(e,t,o){return`Send the full food-safety log, ${d(t,o)}, to ${e.trim()}?`},_e.firstLogDay=function(t,o){const n=[...t.entries.map(t=>(0,e.ymdLocal)(new Date(t.at))),...(t.diary??[]).map(e=>e.date),...(t.daySigns??[]).map(e=>e.date),...(t.weekly??[]).map(e=>e.week)].filter(e=>/^\d{4}-\d{2}-\d{2}$/.test(e)).sort(),r=(0,e.ymdLocal)(o);return n.length&&n[0]t.log.points.find(t=>t.id===e.pointId),r=[];for(const t of o.entries){const o=n(t);r.push(['Check',y(t.at),u(t.at),o?e.SECTION_LABEL[(0,e.sectionOf)(o)]:'',t.name,e.KIND_LABEL[t.kind]??'',(0,e.fmtEntryValue)(t),o?(0,e.limitText)(o):'',t.ok?'OK':null!=t.value?'OUT OF RANGE':'NOT DONE',t.corrective??'',t.note??'',`${t.initials??''} ${t.by}`.trim(),'probe'===t.source?'Wireless probe':'voice'===t.source?'Voice, confirmed':'Typed'])}for(const e of o.diary)r.push([`Diary: ${e.kind}`,l(e.date),u(e.at),'','','','','','',e.action??'',e.text,e.by,'']);for(const e of o.daySigns)r.push(['Daily sign-off: safe methods followed',l(e.date),u(e.at),'Management','','','','','Signed','','',e.by,'']);for(const t of o.weekly)r.push([`Weekly sign-off (week of ${l(t.week)})`,y(t.at),u(t.at),'Management','','',`${t.answers.filter(Boolean).length} of ${e.WEEKLY_QUESTIONS.length} answered yes`,'','Signed','',t.note??'',`${t.by} (${t.role})`,'']),e.WEEKLY_QUESTIONS.forEach((e,o)=>r.push([`Weekly question (week of ${l(t.week)})`,y(t.at),'','Management',e,'',t.answers[o]?'Yes':'No','','','','',t.by,'']));for(const e of(t.log.inspectorSends??[]).filter(e=>e.at.slice(0,10)<=t.to))r.push(['Log sent to inspector',y(e.at),u(e.at),'Management','','',`${l(e.from)} to ${l(e.to)}`,'','emailed'===e.method?'Emailed':'shared'===e.method?'Shared':'Downloaded','',`${e.inspectorName} <${e.inspectorEmail}>`,`${e.by} (${e.role})`,'']);const a=[['Food safety log (HACCP): full record'],[t.venue],[`Dates: ${d(t.from,t.to)}`],[`For: ${t.inspectorName.trim()} <${t.inspectorEmail.trim()}>`],[`Produced ${t.now.toLocaleString('en-GB')} by ${t.by}`],['Every reading was entered and signed by a member of staff. The app never fills in or estimates a reading.'],[]];return{csv:[...a,h,...r].map(e=>e.map(f).join(',')).join('\r\n')+'\r\n',records:o.records,fileName:`food-safety-log-${t.from}-to-${t.to}.csv`}},_e.prepareInspectorSend=function(e){if(!e.allowed)return{ok:!1,why:'Only the owner, a manager or the Head Chef can send the food-safety log.'};if(!e.confirmed)return{ok:!1,why:'Confirm before anything is sent.'};const t=s(e.inspectorName);if(t)return{ok:!1,why:t};const n=r(e.inspectorEmail);return n?{ok:!1,why:n}:!/^\d{4}-\d{2}-\d{2}$/.test(e.from)||!/^\d{4}-\d{2}-\d{2}$/.test(e.to)||e.from>e.to?{ok:!1,why:'Check the dates: the first date must be on or before the second.'}:'emailed'!==e.method||o.ready?{ok:!0,send:{at:e.at,by:e.by,byId:e.byId,role:e.role,inspectorName:e.inspectorName.trim(),inspectorEmail:e.inspectorEmail.trim(),from:e.from,to:e.to,records:e.records,method:e.method}}:{ok:!1,why:o.why}};var e=_r(_d[0]),t=_r(_d[1]);const o={ready:!1,why:'Email isn\u2019t set up yet \u2014 share the file instead.'},n=/^[^\s@<>()",;:\\[\]]+@[^\s@<>()",;:\\[\]]+\.[A-Za-z]{2,}$/;function r(e){const t=(e??'').trim();return t?t.length>254||!n.test(t)||/\.\./.test(t)||/^\.|\.@|@\./.test(t)?'That email address doesn\u2019t look right. Check it, for example name@council.gov.uk.':'':'Enter the inspector\u2019s email address.'}const a=e=>''===r(e);function s(e){const t=(e??'').trim();return t.length<2?'Enter the inspector\u2019s name.':t.length>80?'Keep the name under 80 characters.':''}const i=e=>{const[t,o,n]=e.split('-').map(Number);return new Date(t,o-1,n)},l=e=>{const[t,o,n]=e.split('-');return`${n}/${o}/${t}`},c=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];function d(e,t){const o=i(e),n=i(t),r=e=>`${e.getDate()} ${c[e.getMonth()]} ${e.getFullYear()}`;return e===t?r(n):`${o.getFullYear()===n.getFullYear()?`${o.getDate()} ${c[o.getMonth()]}`:r(o)} \u2013 ${r(n)}`}function m(t,o,n){const r=e=>e>=o&&e<=n,a=t.entries.filter(t=>r((0,e.ymdLocal)(new Date(t.at)))).sort((e,t)=>e.at.localeCompare(t.at)),s=(t.diary??[]).filter(e=>r(e.date)).sort((e,t)=>e.at.localeCompare(t.at)),l=(t.daySigns??[]).filter(e=>r(e.date)).sort((e,t)=>e.date.localeCompare(t.date)),c=(t.weekly??[]).filter(t=>{const a=new Date(i(t.week));return a.setDate(a.getDate()+6),r(t.week)||r((0,e.ymdLocal)(a))||t.weekn}).sort((e,t)=>e.week.localeCompare(t.week));return{entries:a,diary:s,daySigns:l,weekly:c,records:a.length+s.length+l.length+c.length}}const f=e=>(0,t.csvCell)(e),u=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),y=e=>new Date(e).toLocaleDateString('en-GB'),h=['Record','Date','Time','Section','Check','Type','Reading or answer','Safe limit','Result','Corrective action','Note','Recorded by','How entered']},1213,[1002,989]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CookSafeRecords=function({who:e,rid:s}){const[i,o]=(0,t.useState)('delivery'),c=(0,r.useCookSafe)(e=>e.records)??p,d=(e,t)=>({id:e,label:t}),u=[d('delivery','Deliveries'),d('reheat','Reheating 82\xb0C'),d('offsite','Off-site'),d('cleaning','Cleaning schedule'),d('pest','Pest control'),d('maintenance','Maintenance'),...b(e)?[d('calibration','Probe calibration'),d('training','Training'),d('exclusion','Exclusion'),d('review','6-month review')]:[],d('rules','House Rules'),d('flow','Flow diagram'),d('matrix','Allergen matrix')];return(0,m.jsxs)(l.default,{style:{gap:12},testID:"cooksafe-records",children:[b(e)&&(0,x.calibrationDue)(c,e.now)?(0,m.jsx)(n.Banner,{kind:"warn",title:"Monthly probe calibration due",children:"Open Probe calibration."}):null,(0,m.jsx)(a.Tabs,{value:i,onChange:o,options:u}),'delivery'===i?(0,m.jsx)(R,{who:e}):null,'reheat'===i?(0,m.jsx)(D,{who:e}):null,'offsite'===i?(0,m.jsx)(T,{who:e}):null,'calibration'===i?(0,m.jsx)(k,{who:e}):null,'cleaning'===i?(0,m.jsx)(E,{who:e}):null,'pest'===i?(0,m.jsx)(L,{kind:"pest",who:e,title:"Pest control",intro:"Signs of pests, contractor visits and what was done."}):null,'maintenance'===i?(0,m.jsx)(L,{kind:"maintenance",who:e,title:"Maintenance",intro:"Faults, repairs and equipment checks."}):null,'training'===i?(0,m.jsx)(P,{who:e}):null,'exclusion'===i?(0,m.jsx)(M,{who:e}):null,'review'===i?(0,m.jsx)(B,{who:e}):null,'rules'===i?(0,m.jsx)($,{who:e}):null,'flow'===i?(0,m.jsx)(F,{}):null,'matrix'===i?(0,m.jsx)(O,{rid:s}):null,b(e)?(0,m.jsx)(n.Button,{kind:"secondary",label:"Download CookSafe records (CSV)",testID:"cs-csv",onPress:()=>(0,a.downloadText)(`cooksafe-records-${(new Date).toISOString().slice(0,10)}.csv`,(0,x.csCsv)(c)),style:{alignSelf:'stretch'}}):null]})};var t=_r(_d[0]),s=e(t),l=e(_r(_d[1])),n=_r(_d[2]),i=_r(_d[3]),a=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),x=_r(_d[11]),m=_r(_d[12]);const p=[],f=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');if(!t||!/^-?\d+(\.\d+)?$/.test(t))return null;const s=Number(t);return s>=-80&&s<=400?s:null},j=e=>new Date(e).toLocaleString('en-GB',{weekday:'short',day:'2-digit',month:'2-digit',year:'numeric',hour:'2-digit',minute:'2-digit'}),y=e=>e.replace(' (example)',''),b=e=>'staff'!==e.mode;function S({children:e}){return(0,m.jsx)(n.T,{weight:"semibold",size:17,center:!0,accessibilityRole:"header",children:e})}function w({text:e,testID:t}){return(0,m.jsx)(l.default,{accessibilityRole:"alert",accessibilityLiveRegion:"polite",testID:t,children:(0,m.jsx)(n.T,{size:14,colour:i.colours.red,center:!0,children:e})})}function I(e){const s=(0,r.useCookSafe)(e=>e.records)??p;return(0,t.useMemo)(()=>s.filter(t=>t.kind===e&&!t.archived),[s,e])}function v({kind:e,who:t,testID:s}){const o=I(e);return(0,m.jsxs)(a.Box,{testID:s,style:{alignItems:'center'},children:[(0,m.jsxs)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:["Recent ",x.CS_KIND_LABEL[e].toLowerCase()," records"]}),o.length?o.slice(0,15).map(e=>(0,m.jsxs)(l.default,{style:{alignItems:'center',gap:2},accessible:!0,accessibilityLabel:`${j(e.at)}, ${e.by}: ${(0,x.recordSummary)(e)}`,children:[(0,m.jsx)(n.T,{size:14,center:!0,colour:!1===e.doc.ok||!1===e.doc.accepted?i.colours.amber:i.colours.text,children:(0,x.recordSummary)(e)}),(0,m.jsxs)(n.Muted,{size:12,center:!0,children:[j(e.at)," \xb7 ",e.by]}),b(t)?(0,m.jsx)(n.Button,{small:!0,kind:"secondary",label:"Archive",testID:`cs-archive-${e.id}`,accessibilityLabel:"Archive this record. It stays in the history.",onPress:()=>r.useCookSafe.getState().archive(e.id)}):null]},e.id)):(0,m.jsx)(n.Muted,{center:!0,children:"Nothing recorded yet."})]})}const C=e=>({by:y(e.me),byId:e.meId});function D({who:e}){const[s,i]=(0,t.useState)(''),[o,c]=(0,t.useState)(''),[d,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[j,y]=(0,t.useState)(!1),b=f(o),I=null!==b&&(0,x.reheatOk)(b),D=s.trim()?null===b?'Type the core temperature, for example 84.':!I&&d.trim().length<3?`Below ${x.REHEAT_MIN_C}\xb0C: write what you did (for example \u201cReheated again to 85\xb0C\u201d).`:'':'Type the food you reheated.';return(0,m.jsxs)(l.default,{style:{gap:12},testID:"cs-reheat",children:[(0,m.jsxs)(a.Box,{style:{alignItems:'center'},children:[(0,m.jsx)(S,{children:"Reheating"}),(0,m.jsxs)(n.Muted,{center:!0,children:["In Scotland reheated food must reach ",x.REHEAT_MIN_C,"\xb0C or above in the centre."]}),(0,m.jsx)(n.Field,{label:"Food",testID:"cs-reheat-food",value:s,onChangeText:i,maxLength:80}),(0,m.jsx)(n.Field,{label:"Core temperature (\xb0C)",testID:"cs-reheat-temp",value:o,onChangeText:c,keyboardType:"numbers-and-punctuation",maxLength:6}),null===b||I?null:(0,m.jsx)(n.Field,{label:"What you did (below 82\xb0C)",testID:"cs-reheat-action",value:d,onChangeText:u,maxLength:200}),j&&D?(0,m.jsx)(w,{text:D,testID:"cs-reheat-problem"}):null,(0,m.jsx)(n.Button,{label:"Save reheat check",testID:"cs-reheat-save",onPress:()=>{y(!0),D||(r.useCookSafe.getState().add('reheat',{food:s.trim(),value:b,ok:I,action:d.trim()||void 0},C(e)),p(`Saved: ${s.trim()} ${b}\xb0C.`),i(''),c(''),u(''),y(!1))},style:{alignSelf:'stretch'}}),h?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(n.Muted,{center:!0,children:h})}):null]}),(0,m.jsx)(v,{kind:"reheat",who:e,testID:"cs-reheat-list"})]})}function k({who:e}){const s=(0,r.useCookSafe)(e=>e.records)??p,[o,c]=(0,t.useState)('Probe 1'),[d,u]=(0,t.useState)(''),[h,j]=(0,t.useState)(''),[y,b]=(0,t.useState)(''),[I,D]=(0,t.useState)(!1),[k,T]=(0,t.useState)(''),R=f(d),L=f(h),P=null!==R&&null!==L&&(0,x.calibrationOk)(R,L),M=null===R?'Type the iced water reading, for example 0.':null===L?'Type the boiling water reading, for example 100.':!P&&y.trim().length<3?'Out of range: write what you did (for example \u201cProbe replaced\u201d).':'',B=(0,x.calibrationDue)(s,e.now);return(0,m.jsxs)(l.default,{style:{gap:12},testID:"cs-calibration",children:[(0,m.jsxs)(a.Box,{style:{alignItems:'center'},children:[(0,m.jsx)(S,{children:"Probe calibration (monthly)"}),B?(0,m.jsx)(n.Banner,{kind:"warn",title:"Monthly probe check due",children:"Check each probe in iced water and boiling water."}):(0,m.jsx)(n.Muted,{center:!0,children:"Done this month."}),(0,m.jsx)(n.Muted,{center:!0,children:"Iced water should read \u22121 to +1\xb0C. Boiling water should read 99 to 101\xb0C."}),(0,m.jsx)(n.Field,{label:"Probe name",testID:"cs-cal-probe",value:o,onChangeText:c,maxLength:40}),(0,m.jsx)(n.Field,{label:"Iced water reading (\xb0C)",testID:"cs-cal-ice",value:d,onChangeText:u,keyboardType:"numbers-and-punctuation",maxLength:6}),null===R||(0,x.iceOk)(R)?null:(0,m.jsx)(n.T,{size:14,colour:i.colours.amber,center:!0,children:"Iced water out of range."}),(0,m.jsx)(n.Field,{label:"Boiling water reading (\xb0C)",testID:"cs-cal-boil",value:h,onChangeText:j,keyboardType:"numbers-and-punctuation",maxLength:6}),null===L||(0,x.boilOk)(L)?null:(0,m.jsx)(n.T,{size:14,colour:i.colours.amber,center:!0,children:"Boiling water out of range."}),null===R||null===L||P?null:(0,m.jsx)(n.Field,{label:"What you did",testID:"cs-cal-action",value:y,onChangeText:b,maxLength:200}),I&&M?(0,m.jsx)(w,{text:M}):null,(0,m.jsx)(n.Button,{label:"Save probe check",testID:"cs-cal-save",onPress:()=>{D(!0),M||(r.useCookSafe.getState().add('calibration',{probe:o.trim()||'Probe',ice:R,boil:L,ok:P,action:y.trim()||void 0},C(e)),T(`Saved: ${o} ${P?'passed':'failed'}.`),u(''),j(''),b(''),D(!1))},style:{alignSelf:'stretch'}}),k?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(n.Muted,{center:!0,children:k})}):null]}),(0,m.jsx)(v,{kind:"calibration",who:e,testID:"cs-cal-list"})]})}function T({who:e}){const[s,i]=(0,t.useState)(''),[o,c]=(0,t.useState)(''),[d,u]=(0,t.useState)('chilled'),[h,p]=(0,t.useState)(''),[j,y]=(0,t.useState)(''),[b,I]=(0,t.useState)(!1),[D,k]=(0,t.useState)(''),T=f(h),R=null!==T&&(0,x.offsiteOk)(d,T),L=s.trim()?o.trim()?null===T?'Type the temperature.':!R&&j.trim().length<3?'Out of range: write what you did.':'':'Type the food.':'Type where (for example \u201cWedding, Kilmun Hall\u201d).';return(0,m.jsxs)(l.default,{style:{gap:12},testID:"cs-offsite",children:[(0,m.jsxs)(a.Box,{style:{alignItems:'center'},children:[(0,m.jsx)(S,{children:"Off-site temperatures"}),(0,m.jsx)(n.Muted,{center:!0,children:"Outside catering, events and food carried off site: chilled 8\xb0C or below, frozen \u221215\xb0C or below, hot 63\xb0C or above."}),(0,m.jsx)(n.Field,{label:"Where",testID:"cs-off-place",value:s,onChangeText:i,maxLength:80}),(0,m.jsx)(n.Field,{label:"Food",testID:"cs-off-food",value:o,onChangeText:c,maxLength:80}),(0,m.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:['chilled','frozen','hot'].map(e=>(0,m.jsx)(n.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:d===e,testID:`cs-off-${e}`,onPress:()=>u(e)},e))}),(0,m.jsx)(n.Field,{label:"Temperature (\xb0C)",testID:"cs-off-temp",value:h,onChangeText:p,keyboardType:"numbers-and-punctuation",maxLength:6}),null===T||R?null:(0,m.jsx)(n.Field,{label:"What you did",testID:"cs-off-action",value:j,onChangeText:y,maxLength:200}),b&&L?(0,m.jsx)(w,{text:L}):null,(0,m.jsx)(n.Button,{label:"Save off-site check",testID:"cs-off-save",onPress:()=>{I(!0),L||(r.useCookSafe.getState().add('offsite',{place:s.trim(),food:o.trim(),type:d,value:T,ok:R,action:j.trim()||void 0},C(e)),k('Saved.'),c(''),p(''),y(''),I(!1))},style:{alignSelf:'stretch'}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(n.Muted,{center:!0,children:D})}):null]}),(0,m.jsx)(v,{kind:"offsite",who:e,testID:"cs-off-list"})]})}function R({who:e}){const s=(0,o.useGpCalc)(e=>e.deliveries),i=(0,t.useMemo)(()=>Object.values(s??{}).filter(t=>t.date>=new Date(e.now.getTime()-2592e5).toISOString().slice(0,10)).sort((e,t)=>t.date.localeCompare(e.date)).slice(0,8),[s,e.now]),[c,d]=(0,t.useState)(null),[u,h]=(0,t.useState)(''),[p,j]=(0,t.useState)(''),[y,b]=(0,t.useState)('chilled'),[I,D]=(0,t.useState)(''),[k,T]=(0,t.useState)(!0),[R,L]=(0,t.useState)(''),[P,M]=(0,t.useState)(!1),[B,$]=(0,t.useState)(''),F=f(I),E=(0,x.deliveryOk)(y,F),O=u.trim()?'ambient'!==y&&null===F?'Type the delivery temperature.':!E&&k?'Too warm: reject it, or write why it was accepted.':'':'Type or pick the supplier.',_=O&&!(O.startsWith('Too warm')&&R.trim().length>=3);return(0,m.jsxs)(l.default,{style:{gap:12},testID:"cs-delivery",children:[(0,m.jsxs)(a.Box,{style:{alignItems:'center'},children:[(0,m.jsx)(S,{children:"Delivery record"}),(0,m.jsx)(n.Muted,{center:!0,children:"Chilled 8\xb0C or below, frozen \u221215\xb0C or below. Packaging intact, in date."}),i.length?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Muted,{center:!0,children:"From goods-in:"}),(0,m.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:i.map(e=>(0,m.jsx)(n.Chip,{label:e.supplier,sub:e.date.split('-').reverse().join('/'),selected:c===e.id,testID:`cs-del-goods-${e.id}`,onPress:()=>{d(e.id),h(e.supplier),j(`${e.lines.length} line${1===e.lines.length?'':'s'}`)}},e.id))})]}):(0,m.jsx)(n.Muted,{center:!0,children:"No goods-in from the last three days to link."}),(0,m.jsx)(n.Field,{label:"Supplier",testID:"cs-del-supplier",value:u,onChangeText:h,maxLength:60}),(0,m.jsx)(n.Field,{label:"Items",testID:"cs-del-items",value:p,onChangeText:j,maxLength:120}),(0,m.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:['chilled','frozen','ambient'].map(e=>(0,m.jsx)(n.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:y===e,testID:`cs-del-${e}`,onPress:()=>b(e)},e))}),'ambient'!==y?(0,m.jsx)(n.Field,{label:"Temperature (\xb0C)",testID:"cs-del-temp",value:I,onChangeText:D,keyboardType:"numbers-and-punctuation",maxLength:6}):null,(0,m.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,m.jsx)(n.Chip,{label:"Accepted",selected:k,testID:"cs-del-accepted",onPress:()=>T(!0)}),(0,m.jsx)(n.Chip,{label:"Rejected",selected:!k,testID:"cs-del-rejected",onPress:()=>T(!1)})]}),(0,m.jsx)(n.Field,{label:"Note",testID:"cs-del-note",value:R,onChangeText:L,maxLength:200}),P&&_?(0,m.jsx)(w,{text:O}):null,(0,m.jsx)(n.Button,{label:"Save delivery",testID:"cs-del-save",onPress:()=>{M(!0),_||(r.useCookSafe.getState().add('delivery',{supplier:u.trim(),items:p.trim(),type:y,value:'ambient'===y?null:F,ok:E,accepted:k,note:R.trim()||void 0,goodsInId:c??void 0},C(e)),$(`Saved: ${u.trim()} ${k?'accepted':'rejected'}.`),d(null),h(''),j(''),D(''),L(''),T(!0),M(!1))},style:{alignSelf:'stretch'}}),B?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(n.Muted,{center:!0,children:B})}):null]}),(0,m.jsx)(v,{kind:"delivery",who:e,testID:"cs-del-list"})]})}function L({kind:e,who:s,title:i,intro:o}){const[c,d]=(0,t.useState)(''),[u,h]=(0,t.useState)(''),[x,p]=(0,t.useState)(''),[f,j]=(0,t.useState)(!1),[y,b]=(0,t.useState)(''),I=c.trim().length<3?'Write what was found or checked.':'';return(0,m.jsxs)(l.default,{style:{gap:12},testID:`cs-${e}`,children:[(0,m.jsxs)(a.Box,{style:{alignItems:'center'},children:[(0,m.jsx)(S,{children:i}),(0,m.jsx)(n.Muted,{center:!0,children:o}),(0,m.jsx)(n.Field,{label:'pest'===e?'What was seen or checked':'Fault or job',testID:`cs-${e}-what`,value:c,onChangeText:d,maxLength:200,multiline:!0}),(0,m.jsx)(n.Field,{label:"Action taken",testID:`cs-${e}-action`,value:u,onChangeText:h,maxLength:200}),(0,m.jsx)(n.Field,{label:"Contractor (optional)",testID:`cs-${e}-contractor`,value:x,onChangeText:p,maxLength:60}),f&&I?(0,m.jsx)(w,{text:I}):null,(0,m.jsx)(n.Button,{label:"Save",testID:`cs-${e}-save`,onPress:()=>{j(!0),I||(r.useCookSafe.getState().add(e,{what:c.trim(),action:u.trim()||void 0,contractor:x.trim()||void 0},C(s)),b('Saved.'),d(''),h(''),p(''),j(!1))},style:{alignSelf:'stretch'}}),y?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(n.Muted,{center:!0,children:y})}):null]}),(0,m.jsx)(v,{kind:e,who:s,testID:`cs-${e}-list`})]})}function P({who:e}){const s=(0,d.useOwner)(e=>e.staff),i=(0,t.useMemo)(()=>(s??[]).filter(e=>!e.archived).map(e=>y(e.name)).sort(),[s]),[o,c]=(0,t.useState)(''),[x,p]=(0,t.useState)('Induction'),[f,j]=(0,t.useState)(''),[b,I]=(0,t.useState)(''),[D,k]=(0,t.useState)(''),[T,R]=(0,t.useState)(!1),[L,P]=(0,t.useState)(''),M=(0,h.parseDmy)(b),B=D.trim()?(0,h.parseDmy)(D):'',$=o.trim()?f.trim()?M?null===B?'Type the renewal date like 20/11/2029, or leave it empty.':'':'Type the date done like 20/11/2026.':'Type what the training was (for example \u201cFood hygiene level 2\u201d).':'Pick or type the person.';return(0,m.jsxs)(l.default,{style:{gap:12},testID:"cs-training",children:[(0,m.jsxs)(a.Box,{style:{alignItems:'center'},children:[(0,m.jsx)(S,{children:"Training and induction"}),(0,m.jsx)(n.Field,{label:"Person",testID:"cs-tr-person",value:o,onChangeText:c,maxLength:60}),(0,m.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:i.slice(0,24).map(e=>(0,m.jsx)(n.Chip,{label:e,selected:o===e,onPress:()=>c(e)},e))}),(0,m.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:['Induction','Training','Refresher'].map(e=>(0,m.jsx)(n.Chip,{label:e,selected:x===e,testID:`cs-tr-${e.toLowerCase()}`,onPress:()=>p(e)},e))}),(0,m.jsx)(n.Field,{label:"What (course or topic)",testID:"cs-tr-course",value:f,onChangeText:j,maxLength:100}),(0,m.jsx)(n.Field,{label:"Date done (DD/MM/YYYY)",testID:"cs-tr-done",value:b,onChangeText:e=>I((0,u.slashDate)(e,b)),keyboardType:"numbers-and-punctuation",maxLength:10}),(0,m.jsx)(n.Field,{label:"Renew by (DD/MM/YYYY, optional)",testID:"cs-tr-expires",value:D,onChangeText:e=>k((0,u.slashDate)(e,D)),keyboardType:"numbers-and-punctuation",maxLength:10}),T&&$?(0,m.jsx)(w,{text:$}):null,(0,m.jsx)(n.Button,{label:"Save training record",testID:"cs-tr-save",onPress:()=>{R(!0),$||(r.useCookSafe.getState().add('training',{person:o.trim(),type:x,course:f.trim(),done:M,expires:B||void 0},C(e)),P(`Saved for ${o.trim()}.`),j(''),I(''),k(''),R(!1))},style:{alignSelf:'stretch'}}),L?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(n.Muted,{center:!0,children:L})}):null]}),(0,m.jsx)(v,{kind:"training",who:e,testID:"cs-tr-list"})]})}function M({who:e}){const s=I('exclusion'),[o,c]=(0,t.useState)(''),[d,p]=(0,t.useState)(''),[f,b]=(0,t.useState)(!1),[v,D]=(0,t.useState)(''),k=(0,h.parseDmy)(d),T=o.trim()?k?'':'Type the first day off like 20/11/2026.':'Type the person.',R=e=>r.useCookSafe.getState().update(e.id,{stopped:(new Date).toISOString()}),L=t=>r.useCookSafe.getState().update(t.id,{returned:(new Date).toISOString().slice(0,10),returnBy:y(e.me)});return(0,m.jsxs)(l.default,{style:{gap:12},testID:"cs-exclusion",children:[(0,m.jsxs)(a.Box,{style:{alignItems:'center'},children:[(0,m.jsx)(S,{children:"Exclusion and return to work"}),(0,m.jsxs)(n.Muted,{center:!0,children:["Food handlers with sickness or diarrhoea stay off until ",x.EXCLUSION_HOURS," hours after the symptoms stop."]}),(0,m.jsx)(n.Field,{label:"Person",testID:"cs-ex-person",value:o,onChangeText:c,maxLength:60}),(0,m.jsx)(n.Field,{label:"First day off (DD/MM/YYYY)",testID:"cs-ex-from",value:d,onChangeText:e=>p((0,u.slashDate)(e,d)),keyboardType:"numbers-and-punctuation",maxLength:10}),f&&T?(0,m.jsx)(w,{text:T}):null,(0,m.jsx)(n.Button,{label:"Record off work",testID:"cs-ex-save",onPress:()=>{b(!0),T||(r.useCookSafe.getState().add('exclusion',{person:o.trim(),from:k},C(e)),D(`Saved: ${o.trim()} off work.`),c(''),p(''),b(!1))},style:{alignSelf:'stretch'}}),v?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(n.Muted,{center:!0,children:v})}):null]}),(0,m.jsxs)(a.Box,{testID:"cs-ex-list",style:{alignItems:'center'},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Off work and returns"}),s.length?s.slice(0,12).map(t=>{const s=t.doc,a=(0,x.mayReturn)(s.stopped,e.now);return(0,m.jsxs)(l.default,{style:{gap:6,alignItems:'center',alignSelf:'stretch'},children:[(0,m.jsx)(n.T,{center:!0,children:(0,x.recordSummary)(t)}),s.returned?(0,m.jsx)(n.Muted,{center:!0,children:"Back at work."}):s.stopped?a?(0,m.jsx)(n.Button,{small:!0,label:"Return to work",testID:`cs-ex-return-${t.id}`,accessibilityLabel:`${s.person} may return: ${x.EXCLUSION_HOURS} hours have passed. Record the return to work.`,onPress:()=>L(t)}):(0,m.jsxs)(n.T,{size:14,colour:i.colours.amber,center:!0,children:["Not before ",j((0,x.returnFrom)(s.stopped).toISOString())]}):(0,m.jsx)(n.Button,{small:!0,kind:"secondary",label:"Symptoms stopped now",testID:`cs-ex-stopped-${t.id}`,onPress:()=>R(t)})]},t.id)}):(0,m.jsx)(n.Muted,{center:!0,children:"Nobody is recorded off work."})]})]})}function B({who:e}){const s=(0,r.useCookSafe)(e=>e.records)??p,[i,o]=(0,t.useState)(x.REVIEW_QUESTIONS.map(()=>!1)),[c,d]=(0,t.useState)(''),[u,h]=(0,t.useState)(''),f=(0,x.reviewDue)(s,e.now);return(0,m.jsxs)(l.default,{style:{gap:12},testID:"cs-review",children:[(0,m.jsxs)(a.Box,{style:{alignItems:'center'},children:[(0,m.jsx)(S,{children:"Six-monthly CookSafe review"}),f?(0,m.jsx)(n.Banner,{kind:"warn",title:"Review due",children:"Go through your CookSafe manual at least every six months, and whenever the menu, suppliers or equipment change."}):(0,m.jsx)(n.Muted,{center:!0,children:"Reviewed in the last six months."}),x.REVIEW_QUESTIONS.map((e,t)=>(0,m.jsx)(n.Toggle,{label:e,value:i[t],testID:`cs-rev-${t}`,onChange:e=>o(s=>s.map((s,l)=>l===t?e:s))},e)),(0,m.jsx)(n.Field,{label:"Changes made (optional)",testID:"cs-rev-note",value:c,onChangeText:d,maxLength:500,multiline:!0}),(0,m.jsx)(n.Button,{label:"Sign the review",testID:"cs-rev-save",onPress:()=>{r.useCookSafe.getState().add('review',{answers:i,note:c.trim()||void 0},C(e)),h('Review saved and dated.'),o(x.REVIEW_QUESTIONS.map(()=>!1)),d('')},disabled:!b(e),style:{alignSelf:'stretch'}}),u?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(n.Muted,{center:!0,children:u})}):null]}),(0,m.jsx)(v,{kind:"review",who:e,testID:"cs-rev-list"})]})}function $({who:e}){const s=(0,r.useCookSafe)(e=>e.records)??p,[i,o]=(0,t.useState)(null),[c,d]=(0,t.useState)(''),u=b(e),h=e=>s.find(t=>t.id===(0,r.ruleRecordId)(e)),f=(t,s,l)=>{const n=h(t),i=(new Date).toISOString(),a=y(e.me),o=n?.doc??{},c=void 0!==l.text?'Wording changed':l.inPlace?'Ticked as in place':'Unticked',d={title:s,inPlace:l.inPlace??o.inPlace??!1,text:l.text??o.text,history:[...o.history??[],{at:i,by:a,what:c}].slice(-30)};n?r.useCookSafe.getState().update(n.id,d):r.useCookSafe.getState().add('houserule',d,C(e),i,(0,r.ruleRecordId)(t))};return(0,m.jsxs)(l.default,{style:{gap:12},testID:"cs-rules",children:[(0,m.jsxs)(a.Box,{style:{alignItems:'center'},children:[(0,m.jsx)(S,{children:"House Rules"}),(0,m.jsxs)(n.Muted,{center:!0,children:["Standard CookSafe House Rules wording. ",u?'Tick each one that is in place, or change the wording to fit your kitchen. Every change is dated.':'Read by everyone in the kitchen.']})]}),x.HOUSE_RULES.map(e=>{const t=h(e.id),s=t?.doc??{},l=s.history?.[s.history.length-1];return(0,m.jsxs)(a.Box,{testID:`cs-rule-${e.id}`,style:{alignItems:'center'},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:e.title}),i===e.id?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Field,{label:`${e.title} wording`,testID:`cs-rule-text-${e.id}`,value:c,onChangeText:d,multiline:!0,maxLength:1e3}),(0,m.jsxs)(n.Row,{gap:8,style:{justifyContent:'center'},children:[(0,m.jsx)(n.Button,{small:!0,label:"Save wording",testID:`cs-rule-save-${e.id}`,onPress:()=>{f(e.id,e.title,{text:c.trim()||e.text}),o(null)}}),(0,m.jsx)(n.Button,{small:!0,kind:"secondary",label:"Cancel",onPress:()=>o(null)})]})]}):(0,m.jsx)(n.T,{size:14,center:!0,children:s.text??e.text}),u?(0,m.jsxs)(n.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(n.Chip,{label:s.inPlace?'In place \u2713':'Tick: in place',selected:!!s.inPlace,testID:`cs-rule-tick-${e.id}`,onPress:()=>f(e.id,e.title,{inPlace:!s.inPlace})}),i!==e.id?(0,m.jsx)(n.Chip,{label:"Edit wording",testID:`cs-rule-edit-${e.id}`,onPress:()=>{o(e.id),d(s.text??e.text)}}):null]}):s.inPlace?(0,m.jsx)(n.Muted,{center:!0,children:"In place"}):null,l?(0,m.jsxs)(n.Muted,{size:12,center:!0,children:[l.what,": ",j(l.at)," \xb7 ",l.by]}):null]},e.id)})]})}function F(){return(0,m.jsxs)(l.default,{style:{gap:6,alignItems:'center'},testID:"cs-flow",accessibilityRole:"list",children:[(0,m.jsx)(S,{children:"Food flow"}),(0,m.jsx)(n.Muted,{center:!0,children:"How food moves through the kitchen, with the limit checked at each step."}),x.FLOW_STEPS.map((e,t)=>(0,m.jsxs)(s.default.Fragment,{children:[(0,m.jsxs)(l.default,{accessibilityRole:"text",accessibilityLabel:`Step ${t+1}, ${e.title}: ${e.limit}`,testID:`cs-flow-${e.id}`,style:{alignSelf:'stretch',alignItems:'center',padding:12,borderRadius:14,borderWidth:1.5,borderColor:i.colours.gold,backgroundColor:i.colours.surface},children:[(0,m.jsxs)(n.T,{weight:"semibold",center:!0,colour:i.colours.gold,children:[t+1,". ",e.title]}),(0,m.jsx)(n.T,{size:14,center:!0,children:e.limit})]}),te.records)??p,o=(0,t.useMemo)(()=>(0,r.scheduleOf)(s),[s]),c=(0,t.useMemo)(()=>new Set((0,x.cleaningDue)(o,s,e.now).map(e=>e.id)),[o,s,e.now]),[d,u]=(0,t.useState)(''),[h,f]=(0,t.useState)('daily'),[j,y]=(0,t.useState)(''),S=t=>{const s=r.useCookSafe.getState();s.records.find(e=>e.id===r.SCHEDULE_ID)?s.update(r.SCHEDULE_ID,{schedule:t}):s.add('cleaning',{schedule:t,task:'Cleaning schedule'},C(e),void 0,r.SCHEDULE_ID)};return(0,m.jsxs)(l.default,{style:{gap:12},testID:"cs-cleaning",children:[['daily','weekly','monthly'].map(t=>(0,m.jsxs)(a.Box,{style:{alignItems:'center'},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:x.FREQ_LABEL[t]}),o.filter(e=>e.freq===t).map(t=>(0,m.jsxs)(l.default,{style:{alignItems:'center',gap:4,alignSelf:'stretch'},children:[(0,m.jsxs)(n.T,{center:!0,colour:c.has(t.id)?i.colours.amber:i.colours.text,children:[t.task,c.has(t.id)?' \xb7 due':' \xb7 done']}),(0,m.jsx)(n.Button,{small:!0,label:"Done",testID:`cs-clean-${t.id}`,accessibilityLabel:`${t.task} done`,onPress:()=>{return s=t.id,l=t.task,r.useCookSafe.getState().add('cleaning',{taskId:s,task:l},C(e)),void y(`${l}: done.`);var s,l}})]},t.id))]},t)),j?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(n.Muted,{center:!0,children:j})}):null,b(e)?(0,m.jsxs)(a.Box,{style:{alignItems:'center'},children:[(0,m.jsx)(n.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Add to the schedule"}),(0,m.jsx)(n.Field,{label:"Cleaning task",testID:"cs-clean-new",value:d,onChangeText:u,maxLength:80}),(0,m.jsx)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:['daily','weekly','monthly'].map(e=>(0,m.jsx)(n.Chip,{label:x.FREQ_LABEL[e],selected:h===e,onPress:()=>f(e)},e))}),(0,m.jsx)(n.Button,{label:"Add task",testID:"cs-clean-add",disabled:d.trim().length<3,onPress:()=>{S([...o,{id:`cl-${Date.now().toString(36)}`,task:d.trim(),freq:h}]),u('')},style:{alignSelf:'stretch'}})]}):null,(0,m.jsx)(v,{kind:"cleaning",who:e,testID:"cs-clean-list"})]})}function O({rid:e}){const s=(0,c.useRecipeCards)(e),r=(0,t.useMemo)(()=>(0,x.allergenMatrix)(s),[s]);return(0,m.jsxs)(l.default,{style:{gap:12},testID:"cs-matrix",children:[(0,m.jsxs)(a.Box,{style:{alignItems:'center'},children:[(0,m.jsx)(S,{children:"14-allergen matrix"}),(0,m.jsx)(n.Muted,{center:!0,children:"Built only from recipe cards the Head Chef has signed off, from each card\u2019s own allergens. \u201cMay\u201d means may contain."}),r.left?(0,m.jsxs)(n.T,{size:14,colour:i.colours.amber,center:!0,testID:"cs-matrix-left",children:[r.left," card",1===r.left?'':'s'," waiting for sign-off ",1===r.left?'is':'are'," left out."]}):null,(0,m.jsx)(n.Button,{label:"Print allergen matrix",testID:"cs-matrix-print",disabled:!r.rows.length,onPress:()=>(0,a.printTable)('Allergen matrix (14 allergens)',`From signed-off recipe cards only \xb7 printed ${(new Date).toLocaleDateString('en-GB')}`,x.MATRIX_HEAD,r.rows.map(e=>[e.dish,...e.cells.map(x.matrixCell)])),style:{alignSelf:'stretch'}})]}),(0,m.jsx)(a.Box,{style:{alignItems:'center'},children:r.rows.length?r.rows.map(e=>(0,m.jsx)(n.T,{size:14,center:!0,testID:`cs-matrix-row-${e.id}`,children:(0,x.matrixSpoken)(e)},e.id)):(0,m.jsx)(n.Muted,{center:!0,children:"No signed-off cards yet."})})]})}},1214,[17,85,777,804,889,990,905,858,876,1031,1213,988,8]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SpecialsEditor=function(t){return null}},1215,[]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},1216,[843,1026,17,219,385,85,780,858,804,777,1217,1102,1218,8]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return k}}),_e.useCss=function(){(0,a.useEffect)(()=>{if(!h||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=y,document.head.appendChild(e)},[])},_e.KindChip=function({kind:e,size:t=34}){return(0,x.jsx)(o.default,{testID:`kind-chip-${e}`,style:{width:t,height:t,borderRadius:10,backgroundColor:'rgba(207,164,95,0.16)',alignItems:'center',justifyContent:'center'},children:(0,x.jsx)(j,{kind:e,size:Math.round(.53*t),colour:"#CFA45F"})})},_e.KindIcon=j,_e.SoundToggle=function({big:e}){const t=(0,b.useAlerts)(e=>e.prefs.muted);return(0,x.jsx)(s.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>b.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:u.colours.border},children:(0,x.jsx)(p.T,{size:e?15:12,colour:t?u.colours.muted:u.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:s,onOpen:o,skipTakeaway:l}){const c=(0,b.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind&&'review'!==n.kind||l&&'takeaway'===n.kind&&!n.test)),d=e=>'booking'===e.kind||'pending'===e.kind,u=c.filter(d),p=c.filter(e=>!d(e));D('managers'===e&&!n.ALERTS_PROMPT_ON);const h=p.map(e=>e.id+':'+e.at).join('|'),k=(0,a.useRef)({me:s,onOpen:o});return k.current={me:s,onOpen:o},(0,a.useEffect)(()=>{const t=new Set(p.map(e=>`alert:${e.id}`));m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of p){const n=b.KIND_META[t.kind],a='display'===e;(0,m.notify)({id:`alert:${t.id}`,tone:A(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${w(t.at)}`,title:t.name,timeoutMs:I(t,e),content:({close:n})=>(0,x.jsx)(C,{a:t,variant:e,big:a,me:k.current.me,onOpen:k.current.onOpen,close:n}),onClose:()=>b.useAlerts.getState().dismiss(t.id)})}},[h,e]),(0,a.useEffect)(()=>()=>m.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,x.jsx)(f.BookingBanners,{alerts:u,big:'display'===e,managers:'managers'===e,me:s,onOpen:o,onClose:e=>b.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]),a=r(_d[2]);r(_d[3]);var s=e(r(_d[4])),o=e(r(_d[5])),l=r(_d[6]),c=e(l),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]),x=r(_d[13]);const h='undefined'!=typeof document,k=e=>({dataSet:{ccal:e}}),y="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function j({kind:e,size:t=22,colour:n}){const a='booking'===e||'pending'===e||'takeaway'===e||'email'===e||'review'===e||'test'===e,s={stroke:n??b.KIND_META[e]?.colour??'#CFA45F',strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,x.jsxs)(c.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...s})]}):null,'pending'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Circle,{cx:"12",cy:"13",r:"8",...s}),(0,x.jsx)(l.Path,{d:"M12 9v4l2.5 2M9 2h6",...s})]}):null,'takeaway'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M5 8h14l-1.2 12H6.2z",...s}),(0,x.jsx)(l.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...s})]}):null,'email'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...s}),(0,x.jsx)(l.Path,{d:"M3 7l9 6 9-6",...s})]}):null,'review'===e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H10l-4 3.5V17H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",...s}),(0,x.jsx)(l.Path,{d:"M12 7.6l1.1 2.3 2.5.3-1.8 1.7.5 2.5-2.3-1.2-2.3 1.2.5-2.5-1.8-1.7 2.5-.3z",...s,strokeWidth:1.4})]}):null,'test'===e?(0,x.jsx)(l.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...s}):null,a?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z",...s}),(0,x.jsx)(l.Path,{d:"M10 20a2 2 0 0 0 4 0",...s})]})]})}function S({label:e,value:t,big:n}){return(0,x.jsxs)(o.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,x.jsx)(p.T,{size:n?13:10,weight:"semibold",colour:m.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,x.jsx)(p.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function T({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,x.jsx)(m.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const I=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,A=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function C({a:e,variant:n,big:s,me:l,onOpen:c,close:f}){const[b,h]=(0,a.useState)(!1),[k,y]=(0,a.useState)(null),w=e=>{y(e),setTimeout(f,1800)},j='managers'===n,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,x.jsxs)(o.default,{testID:`alert-${e.kind}`,style:{gap:s?12:8},children:['email'===e.kind?(0,x.jsx)(p.T,{size:s?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,x.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:s?10:6},children:A.map(([e,t])=>(0,x.jsx)(S,{label:e,value:t,big:s},e))}):null,e.allergy?(0,x.jsxs)(o.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:u.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:s?12:8},children:[(0,x.jsx)(p.T,{size:s?16:11,weight:"bold",colour:u.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,x.jsxs)(o.default,{style:{flex:1},children:[(0,x.jsx)(p.T,{size:s?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,x.jsx)(p.T,{size:s?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==n?(0,x.jsx)(p.T,{size:s?18:13,colour:u.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,x.jsx)(p.T,{size:12,colour:m.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,x.jsx)(p.T,{size:14,weight:"semibold",colour:u.colours.goldLight,children:k}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[j&&!k?'pending'===e.kind?b?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(p.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by email",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,x.jsx)(T,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'declined',I),w('Declined. The guest\u2019s message is in the Outbox.')}}),(0,x.jsx)(T,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&d.repo.bookings.decide(e.refId,'confirmed',I),w(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,x.jsx)(T,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I);w(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,x.jsx)(T,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await d.repo.orders.accept(e.refId,I,t);w(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&c?(0,x.jsx)(T,{kind:"ghost",label:"View bookings",onPress:()=>{f(),c(e)}}):null:null,k?null:(0,x.jsx)(T,{kind:"ghost",label:!j||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:f})]})]})}function D(e){const t=(0,b.useAlerts)(e=>e.askedSystem);(0,a.useEffect)(()=>{if(!e||t||'default'!==(0,b.systemSupport)())return;const n=setTimeout(()=>(0,m.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,b.requestSystemPermission)().then(()=>b.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>b.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},1216,[843,1026,17,219,385,85,780,858,804,777,1217,1102,1218,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,"BANNER_MS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e2,"MAX_STACK",{enumerable:!0,get:function(){return I}}),_e2.BookingBanners=function({alerts:e,big:n,managers:t,me:l,onOpen:d,onClose:b}){const g=(0,a.useSafeAreaInsets)();if((0,o.useEffect)(()=>{if(!h||document.getElementById('cc-banner-css'))return;const e=document.createElement('style');e.id='cc-banner-css',e.textContent=p,document.head.appendChild(e)},[]),!e.length)return null;const y=e.slice(0,I),x=e.length-y.length,R=(0,f.jsxs)(s.default,{testID:"booking-banners",pointerEvents:"box-none",style:{position:h?'fixed':'absolute',left:10,right:n?10:76,top:8+g.top,zIndex:2147483001,gap:8,alignItems:'center',...h?{top:"calc(8px + env(safe-area-inset-top))"}:{}},children:[y.map(e=>(0,f.jsx)(C,{a:e,big:n,managers:t,me:l,onOpen:d,onClose:()=>b(e)},e.id+':'+e.at)),x>0?(0,f.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderRadius:999,backgroundColor:u.SLIDER.bg,borderWidth:1,borderColor:u.SLIDER.border},children:(0,f.jsxs)(c.T,{size:13,colour:u.SLIDER.quiet,children:[x," more new ",1===x?'booking':'bookings']})}):null]});if(h)try{const e=r(_d[13],"react-dom");if(e?.createPortal)return e.createPortal(R,document.body)}catch{}return R};var n=r(_d[0]),o=r(_d[1]),t=e(r(_d[2]));r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),a=r(_d[6]),d=r(_d[7]),c=r(_d[8]),b=r(_d[9]),u=r(_d[10]),g=r(_d[11]),f=r(_d[12]);const h='undefined'!=typeof document,p="[data-ccbn=\"in\"]{animation:ccbn-in .42s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccbn-in{from{opacity:0;transform:translate3d(0,-120%,0)}to{opacity:1;transform:none}}\n@media (prefers-reduced-motion: reduce){[data-ccbn]{animation:none !important}}",y=e=>h?{dataSet:{ccbn:e}}:{},x=7e3,I=3;function C({a:e,big:a,managers:p,me:I,onOpen:C,onClose:R}){const j='pending'===e.kind,[k,D]=(0,o.useState)(null),L=j&&p&&!k;(0,o.useEffect)(()=>{if(L)return;const e=setTimeout(R,k?1800:x);return()=>clearTimeout(e)},[L,k]);const S=(0,o.useRef)(t.default.create({onMoveShouldSetPanResponder:(e,n)=>n.dy<-12&&Math.abs(n.dy)>Math.abs(n.dx),onPanResponderRelease:(e,n)=>{n.dy<-30&&R()}})).current,E=e.covers?`${e.covers} ${1===e.covers?'Cover':'Covers'}`:'',z=[e.when,E,e.table?(0,n.tableNumbers)(e.table):''].filter(Boolean).join(' \xb7 '),v=j?'Booking request':'New booking',w=[e.when,E,e.table?(0,n.tableNumbersA11y)(e.table):''].filter(Boolean).join(', '),T=`${v}: ${e.name}${w?', '+w:''}${e.allergy?'. Allergy: '+e.allergy:''}.${C?' Tap to open bookings.':''}`,$=n=>{e.refId&&!e.test&&g.repo.bookings.decide(e.refId,n,I??'Manager'),D('confirmed'===n?'Confirmed.':'Declined.')};return(0,f.jsxs)(s.default,{...S.panHandlers,...y('in'),testID:`booking-banner-${e.kind}`,style:{width:'100%',maxWidth:a?720:520,alignSelf:'center',flexDirection:'row',alignItems:'center',borderRadius:14,backgroundColor:u.SLIDER.bg,borderWidth:1,borderColor:e.allergy?'rgba(255,107,94,.75)':u.SLIDER.border,borderLeftWidth:5,borderLeftColor:e.allergy?d.colours.red:j?d.colours.amber:d.colours.gold,...h?{boxShadow:'0 8px 24px rgba(0,0,0,.55)'}:{elevation:10}},children:[(0,f.jsxs)(l.default,{testID:"booking-banner-open",accessibilityRole:"button",accessibilityLabel:T,disabled:!C,onPress:()=>{R(),C?.(e)},style:{flex:1,minHeight:56,paddingVertical:a?12:8,paddingLeft:12,paddingRight:6,gap:2},children:[(0,f.jsx)(c.T,{size:a?14:12,weight:"bold",colour:j?d.colours.amber:d.colours.gold,style:{letterSpacing:1.2},children:k??v.toUpperCase()}),(0,f.jsx)(c.T,{size:a?22:17,weight:"semibold",colour:u.SLIDER.text,numberOfLines:1,children:e.name}),z?(0,f.jsx)(c.T,{size:a?18:15,colour:u.SLIDER.quiet,numberOfLines:1,children:z}):null,e.allergy?(0,f.jsxs)(c.T,{size:a?16:14,weight:"semibold",colour:d.colours.red,numberOfLines:2,children:["Allergy: ",e.allergy]}):null]}),L?(0,f.jsxs)(s.default,{style:{gap:6,paddingVertical:6},children:[(0,f.jsx)(l.default,{testID:"booking-banner-confirm",accessibilityRole:"button",accessibilityLabel:`Confirm ${e.name}'s booking`,onPress:()=>$('confirmed'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,backgroundColor:u.SLIDER.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(c.T,{size:15,weight:"bold",colour:u.SLIDER.ink,children:"Confirm"})}),(0,f.jsx)(l.default,{testID:"booking-banner-decline",accessibilityRole:"button",accessibilityLabel:`Decline ${e.name}'s booking`,onPress:()=>$('declined'),style:{minHeight:44,minWidth:88,paddingHorizontal:12,borderRadius:10,borderWidth:1,borderColor:d.colours.red,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(c.T,{size:15,colour:d.colours.red,children:"Decline"})})]}):null,(0,f.jsx)(b.ToastClose,{testID:"booking-banner-close",label:`Close ${v.toLowerCase()} for ${e.name}`,onPress:R,size:a?'lg':'md',colour:u.SLIDER.quiet,style:{minWidth:56,minHeight:56,marginRight:4}})]})}},1217,[843,17,363,219,385,85,19,804,777,779,1102,858,8,260]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:'review'===a?{...o,id:`test-review:${Date.now()}`,kind:'review',name:'New review',subject:'A guest left a review. Managers can publish, hide or remove it.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},1218,[1219,1220,1222,1221,1223,1016,1224]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIND_META",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ALERT_KINDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"NAG_MS",{enumerable:!0,get:function(){return n}});const o={booking:{kicker:'NEW BOOKING',label:'New bookings',colour:'#CFA45F',glow:'rgba(207,164,95,'},pending:{kicker:'BOOKING NEEDS CONFIRMING',label:'Needs confirming',colour:'#FFB547',glow:'rgba(255,181,71,'},takeaway:{kicker:'NEW TAKEAWAY ORDER',label:'Takeaway orders',colour:'#CFA45F',glow:'rgba(207,164,95,'},email:{kicker:'NEW EMAIL',label:'Emails',colour:'#E2C489',glow:'rgba(226,196,137,'},review:{kicker:'NEW REVIEW',label:'Reviews',colour:'#CFA45F',glow:'rgba(207,164,95,'},test:{kicker:'TEST ALERT',label:'Tests',colour:'#E2C489',glow:'rgba(226,196,137,'}},l=['booking','pending','takeaway','email','review'],n=18e4},1219,[]); @@ -1410,7 +1410,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1327,[812,843,17,85,777,845,851,1151,1328,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})},1328,[928,899,1151]); __d(function(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]})}},1329,[13,17,856,1330,1402,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 Je}}),_e2.DisplayBoard=function(e={}){const t=(0,ie.useOwner)(e=>e.site);return(0,te.useRestaurant)(t)?(0,qe.jsx)(at,{...e}):(0,qe.jsx)(U.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Y.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]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),E=_r(_d[36]),O=_r(_d[37]),N=_r(_d[38]),_=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=_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]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Ee=_r(_d[90]),Oe=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]);const Ye='#221C12',Qe='#2E2618',Je=12e4,Xe={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},Ze={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},et={width:I.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},tt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),lt=e=>e.slotTime?(0,ee.hm)(new Date(e.slotTime)):'ASAP';function it({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,qe.jsxs)(U.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)(U.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)(U.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)(Y.T,{size:s?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,qe.jsx)(Y.T,{size:s?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,qe.jsx)(F.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)(U.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)(Y.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,qe.jsxs)(U.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,qe.jsx)(U.default,{style:{width:`${l.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,qe.jsx)(U.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,qe.jsxs)(F.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)(U.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,qe.jsx)(Y.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Y.T,{size:12,colour:se.colours.muted,children:s}):null]})}function ot({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ve.statusBlock)(e,t,(0,Ve.linkedBooking)(e,l));return e.length?(0,qe.jsx)(U.default,{style:{gap:8},children:e.map(e=>(0,qe.jsxs)(U.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:s?16:18,weight:"bold",children:[lt(e)," \xb7 ",tt(e.customerName)]}),(0,qe.jsx)(Y.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)(Y.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)(Y.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,Z.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Fe.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Y.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Y.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>te.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Y.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Y.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Ce.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Y.Muted,{children:"No takeaway orders right now."})}function at({embedded:e=!1,boardW:b,headerExtra:Z,subHeader:Fe,noVoice:Ve=!1}={}){const lt=(0,K.default)(),at=b??lt.width,dt=lt.height,ct=at<700,ut=at>=dt,ht=!ct&&ut&&at>=600,gt=ht,bt=Math.round(Math.min(520,Math.max(at>=1e3?448:280,.3*at))),yt=P.default.useRef(null),pt=P.default.useRef(0),[ft,xt]=(0,H.useState)({w:0,h:0}),mt=(0,ie.useOwner)(e=>e.site),jt=(0,te.useRestaurant)(mt);(0,Re.useAlertWatcher)(mt,{enabled:!e});const wt=(0,te.useOrders)(mt),kt=(0,te.useBookings)(mt),It=(0,te.useEvents)(mt),Dt=(0,te.useStore)(e=>e.skipMinutes),vt=(0,te.useStore)(e=>e.clock.mode),St=(0,te.useNow)(5e3),Ct=(0,ie.useOwner)(e=>e.staff),Tt=(0,ie.useOwner)(e=>e.attendance),Rt=(0,ie.useOwner)(e=>e.shifts),$t=(0,ie.useOwner)(e=>e.leave),Bt=P.default.useMemo(()=>(0,Oe.workingShifts)(Rt,$t),[Rt,$t]);P.default.useEffect(()=>{(0,oe.ensureAttendance)((0,ee.ymd)(St),St)},[(0,ee.ymd)(St)]);const Wt=(0,R.useSession)(e=>e.meId),Lt=(0,D.displayActionBy)({isCar:I.IS_CAR,isDisplayApp:'display'===I.APP_VARIANT&&!e,personName:tt(Ct.find(e=>e.id===Wt)?.name)}),zt=I.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Ht=(0,ee.ymd)(St),Pt=(0,A.useTravelDay)('display',Ht),Mt=(0,ne.useFrontDoor)(Ht,ut),At=(0,ae.useDisplaySettings)(mt),Et=At.privacy,Ot=(0,pe.useSaverSync)(),Nt=(0,ae.usePlan)(mt),_t=(0,ae.useFloor)(e=>e.live[mt]),Gt=(0,$e.useBlocks)(e=>e.blocks),[Ft,Vt]=(0,H.useState)('plan'),[Ut,Kt]=(0,H.useState)(!1),[qt,Yt]=(0,H.useState)('all'),[Qt,Jt]=(0,H.useState)(null),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(!1),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(null),[rs,ds]=(0,H.useState)(!1),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(null),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[ks,Is]=(0,H.useState)(!1),Ds=P.default.useRef(0),vs=e=>{Ds.current=Date.now(),ws(e)};P.default.useEffect(()=>{if(!js)return;const e=setInterval(()=>{Date.now()-Ds.current>=ze.DAY_IDLE_MS&&ws(null)},5e3);return()=>clearInterval(e)},[js]);const Ss=(0,te.useWaitlist)(mt),Cs=(0,te.useStore)(e=>e.walkIns[mt]??0),[Ts,Rs]=(0,H.useState)(!1),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1);(0,J.useReviewAlerts)(mt);const[Ps,Ms]=(0,H.useState)({view:0,content:0}),[As,Es]=(0,H.useState)(null);P.default.useEffect(()=>{As&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:As,timeoutMs:4500,big:!0,testID:'floor-toast'}),Es(null))},[As]),P.default.useEffect(()=>{if(!e)return(0,E.setDisplaySilent)(!0),()=>(0,E.setDisplaySilent)(!1)},[e]);const[Os,Ns]=(0,H.useState)(null),_s=P.default.useRef(0),[Gs,Fs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Os)return;_s.current=Date.now();const e=setInterval(()=>{const e=Date.now()-_s.current;if(e>=Je)return Ns(null),void Es('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Fs(e>=105e3?Math.ceil((Je-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Os]);const Vs=e=>e.date!==Ht?ts({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Ht)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Ht?(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Ht)}, ${e.time}`,disabled:!wi.ok,accessibilityHint:wi.hint,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}):null,(0,ve.bookingDetails)(e)]})}):ts({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(rt,{rid:mt,id:e.id,turnBase:jt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(we.CancelWalkInButton,{rid:mt,b:e,big:!0,onDone:e=>{ts(null),Es(e)}}):null,e.walkIn?(0,qe.jsx)(we.ReinstateWalkInButton,{rid:mt,b:e,today:Ht,onDone:e=>{ts(null),Es(e)}}):null,(0,ve.bookingDetails)(e)]})}),Us=kt.filter(e=>e.date===Ht).sort((e,t)=>e.time.localeCompare(t.time)),Ks=Us.filter(e=>!['cancelled','noshow'].includes(e.status)),qs=wt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,H.useMemo)(()=>(0,c.forecastToday)(jt,kt,wt,It,St),[jt,kt,wt,It,St.getTime()/6e4|0]),Qs=(0,$e.closedAreasAt)(Gt,mt,Ht,(0,ee.hm)(St)),Js=[...Qs].join(','),Xs=(0,H.useMemo)(()=>(0,re.floorView)(Nt,kt,wt,_t??{},St,jt.settings.turnMins,Qs),[Nt,kt,wt,_t,St.getTime(),Js]),Zs=(0,De.hoursFor)(jt,St),el=Zs?.open??new Date(`${Ht}T12:00:00`),tl=Zs?.close??new Date(`${Ht}T21:00:00`),sl=(0,ee.addMins)(el,-el.getMinutes()),ll=(0,ee.addMins)(tl,30),il=e=>new Date(`${Ht}T${e}:00`),nl=(0,$e.blocksOn)(Gt,mt,Ht).map(e=>({from:il(e.from),to:il(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(jt,St,Ht)),ol=Object.keys(Xs).filter(e=>'blocked'===Xs[e]?.status),al=js&&js!==Ht?js:Ht,rl=al!==Ht,dl=(0,ze.dayWord)(al,Ht),cl=/^(Today|Yesterday|Tomorrow)$/.test(dl),ul=rl?(0,ze.bookingsForDay)(kt,al,Ht).sort((e,t)=>e.time.localeCompare(t.time)):Us,hl=(0,ee.parseYmd)(al);hl.setHours(12);const gl=rl?(0,De.hoursFor)(jt,hl):Zs,bl=gl?.open??new Date(`${al}T12:00:00`),yl=gl?.close??new Date(`${al}T21:00:00`),pl=e=>new Date(`${al}T${e}:00`),fl=[...rl?(0,$e.blocksOn)(Gt,mt,al).map(e=>({from:pl(e.from),to:pl(e.to),label:e.reason??'Paused'})):nl,...rl?(0,n.queuedServicePauses)(jt,hl,al):[]],xl=(0,n.queuedServiceSessions)(jt,hl),ml=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),jl=(0,qe.jsxs)(U.default,{testID:"queued-hours-gate",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Y.Muted,{children:i.queuedVenues[mt]?.hours.note})]}),wl=rl?gl||ul.length?alrl?(0,re.dayFloorView)(Nt,ul,al):Xs,[rl,Nt,ul,al,Xs]),[Il,Dl]=(0,H.useState)(null),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(!1),[Rl,$l]=(0,H.useState)(null),Bl=rl?ul.filter(e=>!['cancelled','noshow'].includes(e.status)):Ks,Wl=Bl.reduce((e,t)=>e+t.partySize,0),Ll=(0,u.coversSplit)(Bl,al),zl=(0,Pe.cancelledDayTally)(kt,al),Hl=(0,Me.cancellationsFor)(kt,al,e=>e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)','')),Pl=(0,Pe.cancelledTallyWords)(zl,cl?dl.toLowerCase():rl?`on ${dl}`:'today'),Ml=Gt.filter(e=>e.rid===mt&&e.date===al&&!e.removedAt),Al=60*bl.getHours()+bl.getMinutes(),El=60*yl.getHours()+yl.getMinutes(),Ol=(0,Le.chartBands)(Ml,Al,El),Nl=(0,Le.seasonClosedAreaIds)(Ml,Al,El),_l=Nl.size?{...Nt,areas:Nt.areas.filter(e=>!Nl.has(e.id)),tables:Nt.tables.filter(e=>!Nl.has(e.areaId))}:Nt,Gl=rl?[]:ol.filter(e=>!Nl.has(Nt.tables.find(t=>t.name===e)?.areaId??'')),Fl=new Set((0,Le.blockedHours)(Ol)),Vl=St.getHours()+(St.getMinutes()>=30?1:0),Ul=Ys.hours.filter(e=>e.hour>=Vl&&!Fl.has(e.hour)),Kl=Ul.reduce((e,t)=>e+t.coversHigh,0),ql=Ul.reduce((e,t)=>e+t.coversLow,0),Yl=Math.round((ql+Kl)/2),Ql=!Ys.example&&Ys.open&&Ys.enough&&Kl>0?`Usually ${(0,c.coversRange)(Yl,Yl)} more`:void 0,Jl=async(e,t)=>{const s=Xs[e]?.booking;if(!s||e===t)return;const l=Xs[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 ${re.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,ke.guardBookingChange)(Es,{b:s,tables:[t]}))return;await te.repo.bookings.update(s.id,{table:t});const i=_t?.[e]?.stage;ae.useFloor.getState().setLive(mt,t,{stage:i??'seated',dirty:!1}),ae.useFloor.getState().setLive(mt,e,{stage:void 0,dirty:!0}),Es(`Saving: ${(0,fe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,ke.reportBookingSave)(s.id,`${(0,fe.privName)(s,Et)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}`,Es)},Xl=e=>{if(xs)return Sl(null),void ms(t=>t?{...t,tables:(0,Ie.toggleTable)(t.tables,e)}:t);rl?Dl(e):Xt?(e!==Xt&&Jl(Xt,e),Zt(null)):Jt(e)},Zl=xs?kt.find(e=>e.id===xs.id):void 0,ei=xs&&Zl?(()=>{const e=Zl.walkIn?(0,fe.privName)(Zl,Et):tt(Zl.name),t=(0,Ie.seatsOf)(Nt,xs.tables).total,s=(0,Ie.seatLine)(t,Zl.partySize),l=(0,Ie.pickClashes)(Zl,xs.tables,kt.filter(e=>e.date===Zl.date),jt.settings.turnMins),i=(0,Ie.tableKey)(xs.tables)!==(0,Ie.tableKey)((0,ae.tablesOf)(Zl.table));return(0,qe.jsxs)(U.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,qe.jsxs)(U.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Zl.date,Ht)} ${Zl.time}. Tap tables on the plan to add or take them off. ${(0,Ie.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Zl.date,Ht)," ",Zl.time]}),(0,qe.jsxs)(Y.T,{size:16,colour:se.colours.text,children:[(0,Ie.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),vl?(0,qe.jsx)(U.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:vl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,qe.jsx)(Y.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:vl})}):null,Cl&&Zl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Tl(!1),(async()=>{if(!(0,ke.guardBookingChange)(Es,{b:Zl,tables:xs.tables}))return Sl(null),void ms(null);const s=xs.tables;ms(null),await(0,ke.saveTablesReported)(mt,Zl,s,e,t,Es)})()},onNo:()=>Tl(!1)}):null,(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:vl?'plan-pick-overcap-yes':'plan-pick-save',label:vl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${vl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,Ie.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Zl)return void ms(null);if(!(0,ke.guardBookingChange)(Es,{b:Zl,tables:xs.tables}))return Sl(null),void ms(null);const s=(0,Ie.overCapacityAsk)(xs.tables,t,Zl.partySize);if(s&&!vl)return void Sl(s);if('finished'===Zl.status&&xs.tables.length&&!Cl)return void Tl(!0);Sl(null),Tl(!1);const l=xs.tables;ms(null),await(0,ke.saveTablesReported)(mt,Zl,l,e,t,Es)}}),(0,qe.jsx)(Y.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Sl(null),ms(null)}})]})]})})():null,ti=_l.areas.filter(e=>_l.tables.some(t=>t.areaId===e.id)),si=e=>{const t=Nt.tables.filter(t=>t.areaId===e);return rl?`${t.filter(e=>!kl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Xs[e.name]?.status??'free')).length}/${t.length} free`},li='all'===qt||ti.some(e=>e.id===qt)?qt:'all',ii=e=>(0,qe.jsx)(de.FloorCanvas,{plan:_l,areaId:e,mode:"live",fit:"contain",crop:!0,fill:ht,big:!0,view:kl,privacy:Et,turnBase:jt.settings.turnMins,highlight:xs?xs.tables:Xt?[Xt]:void 0,onTap:e=>Xl(e.name),onDrop:(e,t)=>xs||rl?void 0:Jl(e.name,t.name)}),ni=ct?1:ut||ti.length>2?2:1,oi=e=>{const t=Nt.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},ai=[];for(let e=0;e{const t=(0,de.areaBounds)(Nt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,de.minReadableScale)(Nt,e.id)}}),ft.w,ft.h):null,di=e=>(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',height:ce.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:si(e.id)})]}),ci=(0,qe.jsx)(U.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-ft.w)>1||Math.abs(s-ft.h)>1)&&xt({w:t,h:s})},children:ri?(0,qe.jsx)(V.default,{style:{flex:1},scrollEnabled:ri.scroll,showsVerticalScrollIndicator:ri.scroll,contentContainerStyle:{gap:ce.GRID_GAP},children:ri.rows.map((e,t)=>(0,qe.jsx)(U.default,{style:{height:ri.rowHeights[t],flexDirection:'row',gap:ce.GRID_GAP},children:e.map(e=>{const t=ti.find(t=>t.id===e);return(0,qe.jsxs)(U.default,{testID:`area-cell-${e}`,style:{width:ri.cellW,gap:2},children:[di(t),(0,qe.jsx)(U.default,{style:{flex:1},children:ii(e)})]},e)})},t))}):null}),ui=(0,qe.jsxs)(U.default,{testID:"venue-plan",style:{flex:ct?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:Nt}),Nt.tables.length?null:(0,qe.jsxs)(U.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,qe.jsx)(Y.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Y.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)(Y.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,qe.jsx)(nt,{chipId:"all",compact:!ct,label:"Whole venue",selected:'all'===li,onPress:()=>Yt('all')},"__all"),...ti.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ct,label:`${e.name}${(0,ue.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ct?Qs.has(e.id)?'closed':li===e.id?si(e.id):void 0:void 0,selected:li===e.id,onPress:()=>Yt(e.id)},e.id))];return ct?(0,qe.jsx)(U.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,qe.jsx)(V.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:Ps.view>0&&Ps.content>0&&Ps.content<=Ps.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ps.view>0&&Ps.content<=Ps.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),ei,Xt?(0,qe.jsxs)(Y.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Y.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Xt),": tap the new table."]}),(0,qe.jsx)(Y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Zt(null)})]}):null,'all'===li&&ht?ci:'all'===li?(0,qe.jsx)(U.default,{style:{flex:ct?void 0:1,gap:12,minHeight:gt?void 0:360},children:ai.map((e,t)=>(0,qe.jsxs)(U.default,{style:{flex:ct?void 0:Math.max(.3,...e.map(e=>oi(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(U.default,{style:{flex:1,gap:2},children:[ct?(0,qe.jsxs)(U.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Y.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{center:!0,children:si(e.id)})]}):(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{children:si(e.id)})]}),(0,qe.jsx)(U.default,{style:ct?{height:Math.max(280,Math.round((at-40)*oi(e.id)))}:{flex:1},children:ii(e.id)})]},e.id)),e.length{if(rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},al)}),gi='timeline'===Ft,bi=Ut?(0,qe.jsx)(_.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Kt(!1),supportedOrientations:['landscape','portrait'],children:(0,qe.jsxs)(U.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,qe.jsx)(F.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Kt(!1),style:{minHeight:64,minWidth:at<600?120:180,paddingHorizontal:at<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,qe.jsx)(U.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,qe.jsx)(Y.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${rl?(0,ze.dayLong)(al):'Today'}`})}),at<600?null:(0,qe.jsx)(U.default,{style:{minWidth:180}})]}),ml?jl:(0,qe.jsx)(U.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(be.Timeline,{hideNow:!0,fit:!0,plan:_l,bookings:rl?ul:Us,now:rl?bl:St,privacy:Et,turnBase:jt.settings.turnMins,t0:rl?(0,ee.addMins)(bl,-bl.getMinutes()):sl,t1:rl?(0,ee.addMins)(yl,30):ll,pauses:rl?fl:nl,blockedTables:Gl,onOpen:e=>{if(Kt(!1),rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},`full-${al}`)})]})}):null,yi=rl?(0,qe.jsxs)(U.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:cl?`Showing ${dl} \xb7 ${(0,ee.niceDate)((0,ee.parseYmd)(al))}`:`Showing ${(0,ze.dayWord)(al,Ht)}`}),(0,qe.jsx)(U.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Pl}. Showing ${(0,ze.dayLong)(al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Y.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ms(null),vs(null)},style:{minHeight:44}})]}):null,pi=(0,qe.jsx)(U.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:ct?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(gi||Ut);return(0,qe.jsx)(F.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?(Vt('plan'),Kt(!0)):(Kt(!1),Vt('plan'))},style:{flex:ct?1:void 0,minHeight:ct?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',...Ne.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)(Y.T,{size:ct?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),fi='display'===I.APP_VARIANT&&!e,xi='display'===I.APP_VARIANT&&!e,mi=!e&&!I.IS_CAR&&!ct,ji=fi?(0,qe.jsxs)(U.default,{testID:"display-view-row",style:{flexDirection:ct?'column':'row',flexWrap:ct||mi?'nowrap':'wrap',gap:6,alignItems:ct||mi?'stretch':'center'},children:[pi,(0,qe.jsx)(k.DisplayRotaKitchenButtons,{phone:ct,fill:mi,shifts:Rt,staff:Ct,today:Ht,leave:$t})]}):pi,wi=(0,h.useBookingWrite)(),ki=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Walk-in",onPress:Mt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"New booking",onPress:Mt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint})]});(0,Ke.useDisplayNotices)(mt,!e);const Ii=!e&&!I.IS_CAR&&!ct,Di=ct?180:202,[vi,Si]=(0,H.useState)(ct?180:168),Ci=P.default.useRef(ct?180:168),Ti=P.default.useRef(null),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(!1),[Wi,Li]=(0,H.useState)(!1),zi=!ct&&dt<=800,Hi=We.DAY_GRAPH_CHROME+(zi?24:8),Pi=P.default.useRef(0),[Mi,Ai]=(0,H.useState)(Hi),[Ei,Oi]=(0,H.useState)(!0),[Ni,Gi]=(0,H.useState)(!1);P.default.useEffect(()=>{Gi(!1)},[at,dt]);const Fi=P.default.useRef(()=>{}),Vi=P.default.useCallback(e=>{Math.abs(e-Pi.current)>=2&&(Pi.current=e,setTimeout(()=>Fi.current(),0))},[]),Ui=()=>{const e=Ti.current,t=Ri.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=t>Ci.current?Math.ceil(t-Ci.current):0,o=Ii?Math.max(Hi,Pi.current):Math.max(Hi,n);Ii&&o!==Mi&&Ai(o);const a=!ct&&dt>=700?140:70,r=Math.floor(s-4-e)-o-l,d=i>0&&r-i>=a;Ii&&d!==Ei&&Oi(d),Ii&&!Ni&&r<48&&Gi(!0);const c=r-(d?i:0),u=Math.min(Di,c>=a?Math.max(a,c):Math.max(0,c));Math.abs(Ci.current-u)>=2&&(Ci.current=u,Si(u))},l=44+(dt<820?4:8),i=46+(dt<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=$i.current;Ii&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=dt<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Bi.current?44+d:0)}):s(n,a,t,Ii?i:l)})})};Fi.current=Ui,P.default.useEffect(()=>{const e=setTimeout(()=>Fi.current(),60),t=setTimeout(()=>Fi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[at,dt,al]);const Ki=(0,qe.jsxs)(U.default,{ref:Ri,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ui()},style:{flexDirection:'row',flexWrap:at>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ct?12:zi?2:6,justifyContent:ct?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ue.DisplayClockButton,{}),(0,qe.jsx)(ge.HoldToEdit,{quiet:!0,onUnlock:()=>{Fs(null),Ns({at:Date.now()})},onHint:()=>Es('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(Be.BlockBookingsButton,{rid:mt,r:jt,now:St,by:Lt,quiet:!0,display:!0,day:al}),Nt.areas.some(e=>e.outdoor)?(0,qe.jsx)(Be.CloseGardenButton,{rid:mt,r:jt,now:St,by:Lt,quiet:!0,short:!0}):null,(0,qe.jsx)(F.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Hs(!0),style:({pressed:e})=>({...Ne.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),I.IS_CAR||I.IS_OWNER_DESKTOP?null:(0,qe.jsx)(f.GiftQrButton,{rid:mt,venue:jt.name})]}),qi=qs.length?(0,qe.jsxs)(U.default,{testID:"takeaway-panel",style:[Ne.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Y.T,{size:12,colour:se.colours.muted,children:[qs.length," live"]})]}),(0,qe.jsx)(U.default,{style:{padding:10},children:(0,qe.jsx)(ot,{list:qs,me:Lt,compact:!0,bookings:kt})})]}):null,Yi=(Ee.DueToday,jt.settings.turnMins||90),Qi=rl?ul:(0,v.todaysGuestList)(Us,St,Yi),Ji=rl?[]:(0,v.todaysFinishedList)(Us,St,Yi),Xi=rl?cl?`${dl}\u2019s guests`:`Guests ${dl}`:'Today\u2019s guests',Zi=(0,qe.jsxs)(qe.Fragment,{children:[0===Qi.length?(0,qe.jsx)(Y.Muted,{children:rl?al{const t=(0,v.isLeftEarly)(e,St,Yi),s=(0,le.isSeatedHighlight)(e.status,{otherDay:rl})&&!t,l=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=se.colours.text,n=s?se.colours.goldLight:se.colours.muted,o=se.colours.gold,a=l.depositWarn?se.colours.amber:se.colours.goldLight;return(0,qe.jsxs)(F.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:rl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,le.seatedHighlightStyle)({backgroundColor:e?Qe:Ye,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,qe.jsx)(Y.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)(U.default,{style:{paddingTop:2},children:(0,qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,qe.jsxs)(Y.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Y.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}),(0,qe.jsx)(Y.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,qe.jsx)(Y.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(U.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(me.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,qe.jsx)(Y.T,{size:15,colour:se.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),Ji.length?(0,qe.jsxs)(U.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(F.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ji.length}${bs?', expanded':', collapsed'}`,accessibilityState:{expanded:bs},onPress:()=>ys(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Y.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ji.length,")"]}),(0,qe.jsx)(Y.T,{size:16,colour:se.colours.muted,children:bs?'\u25be':'\u25b8'})]}),bs?Ji.map(e=>{const t=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Et):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,qe.jsxs)(F.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Y.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Y.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,qe.jsx)(U.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,qe.jsx)(S.BookingUndo,{b:e,rid:mt,today:Ht,who:t.name,allowed:wi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ae.CancellationsSection,{items:Hl,dayWord:rl?cl?dl.toLowerCase():`on ${dl}`:'today'})]}),en=(0,qe.jsx)(V.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Zi}),tn=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&gs(!1)}}),sn=(0,qe.jsxs)(F.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Xi}, ${Qi.length}`,accessibilityState:{expanded:hs},'aria-expanded':hs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>gs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:hs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:hs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Y.T,{size:16,weight:"bold",colour:se.colours.gold,children:Qi.length}),(0,qe.jsx)(U.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(U.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,qe.jsxs)(Y.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Xi," ",hs?'\u2039':'\u203a']})})})]}),ln=hs?(0,qe.jsxs)(U.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,qe.jsxs)(U.default,{testID:"guests-drawer",...tn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*at)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,...Ne.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,qe.jsxs)(U.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Xi.toUpperCase()," (",Qi.length,")"]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Xi}`,onPress:()=>gs(!1),style:{marginRight:-6}})]}),zl.count?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Pl}):null,(0,qe.jsx)(U.default,{testID:"guests-tools",style:{flexDirection:'row',gap:8,marginTop:6,justifyContent:'center'},children:(0,qe.jsx)(F.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:cs},'aria-expanded':cs,onPress:()=>us(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:14,borderRadius:12,borderWidth:1,borderColor:cs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',backgroundColor:e?se.colours.tilePressed:cs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:se.colours.goldLight,children:["Guest key ",cs?'\u25b4':'\u25be']})})}),cs?(0,qe.jsx)(U.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: warning sign allergy, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:6},children:[['\u26a0','allergy'],['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(Y.T,{size:16,children:e}),(0,qe.jsx)(Y.T,{size:14,children:t})]},t))}):null]}),en]}),(0,qe.jsx)(F.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Xi}`,accessibilityRole:"button",onPress:()=>gs(!1),style:{flex:1}})]}):null,nn=ml?jl:l.IS_KIRKTON&&!Object.values(jt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(U.default,{testID:"kirkton-hours-to-confirm",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Y.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(jt,kt,St).busy,todays:ul,open:bl,close:yl,now:St,turnBase:jt.settings.turnMins,blocks:Ml,pauses:fl,compact:ct,dense:!ct,fit:ht,tight:ht&&dt<=600,height:ht?vi:Di,forecastNote:rl?void 0:Ql,emptyText:wl,past:al{Ds.current=Date.now(),Is(!0)},shortDay:!ct&&at<1100}),rn=(0,qe.jsx)(He.DisplayCalendar,{visible:ks,today:Ht,day:al,bookings:kt,restaurant:jt,now:St,onDay:vs,onClose:()=>Is(!1)}),dn=()=>{rl?gs(!0):Kt(!0)},cn=(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',padding:zi?4:dt<820?8:12,paddingTop:zi?Ii?2:4:dt<820?Ii?4:6:Ii?8:10,gap:zi?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:yi,Pt?(0,qe.jsx)(V.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"})}):gi?hi:ui,bi,ln]}),(0,qe.jsxs)(U.default,{testID:"display-side",style:{width:bt,gap:dt<820?4:8,minHeight:0},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ki(!1)}),(0,qe.jsx)(U.default,{style:{flexShrink:0},children:ji}),Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",onLayout:Ui,style:Ii&&!Ni?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:dt<820,snug:dt<820,tight:dt<800,fill:Ii&&!Ni,sound:(0,E.flapSoundOn)(),onPress:dn})}),Pt?null:(0,qe.jsx)(U.default,{ref:Ti,testID:"day-graph-slot",onLayout:Ui,style:{flexGrow:0,flexShrink:Ii?0:1,flexBasis:(ct?Di:vi)+(Ii?Mi:Hi),height:(ct?Di:vi)+(Ii?Mi:Hi),minHeight:dt<=600?90:Math.min((ct?Di:vi)+We.DAY_GRAPH_CHROME,!ct&&dt>=768?140+We.DAY_GRAPH_CHROME:120),overflow:'visible'},children:on}),Ii&&!Pt?(0,qe.jsx)(U.default,{ref:$i,testID:"display-side-split",onLayout:Ui,style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})}):null,(0,qe.jsxs)(V.default,{testID:"display-side-scroll",style:Ii?{flexGrow:0,flexShrink:1,minHeight:Wi&&Ei?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Bi.current&&(Bi.current=s,Li(s),setTimeout(Ui,0))},children:[Ii||xi?null:(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),qi,(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt})]})]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Ds.current=Date.now()},onMouseDown:()=>{Ds.current=Date.now()},children:[ct?(0,qe.jsx)(U.default,{style:{flex:1},children:(0,qe.jsxs)(V.default,{ref:yt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,qe.jsxs)(U.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,qe.jsx)(U.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,qe.jsx)(j.ExitButton,{})}),(0,qe.jsx)(X.RestaurantLogo,{rid:mt,size:64}),(0,qe.jsx)(Y.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:jt.name}),(0,qe.jsx)(X.PoweredBy,{}),(0,qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(U.default,{accessible:!0,accessibilityLabel:`Current time ${(0,ee.hm)(St)}`,children:(0,qe.jsx)(Y.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,ee.hm)(St)})}),(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:"m"}),(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",size:"m"}),Z]}),Fe,I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(ke.BookingSaveBanner,{rid:mt}),an,(0,qe.jsx)(U.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(it,{phone:!0,split:Ll,items:[{label:`Tables \xb7 ${dl}`,value:Bl.length,testID:'badge-tables'},{label:`Covers \xb7 ${dl}`,value:Wl,testID:'badge-covers'},{label:'Takeaway',value:qs.length,alert:qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ls(!0)}]})}),(0,qe.jsx)(U.default,{testID:"primary-actions",style:{gap:8},children:ki(!0)}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt}),ji,(0,qe.jsxs)(U.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[gi?hi:ui,bi]}),(0,qe.jsxs)(U.default,{onLayout:e=>{pt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ne.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Y.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Xi," (",Qi.length,")"]}),(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{gap:4},children:Zi})]}),qi,on,(0,qe.jsx)(U.default,{testID:"covers-dock",children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:!0,sound:(0,E.flapSoundOn)(),onPress:()=>yt.current?.scrollTo({y:pt.current,animated:!0})})}),(0,qe.jsxs)(U.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,qe.jsx)(Y.T,{center:!0,size:14,colour:Et?se.colours.muted:se.colours.amber,children:Et?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Y.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Rs(!0),style:{minHeight:48,alignSelf:'stretch'}}),xi?null:(0,qe.jsx)(Y.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ki]})}):(0,qe.jsxs)(qe.Fragment,{children:[Ii?(0,qe.jsx)(U.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:se.colours.hairline},children:(0,qe.jsx)(U.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)(U.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,paddingVertical:zi?2:dt<820?4:8,gap:8,minHeight:zi&&Ii?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ne.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(U.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:Ii?16:8,minWidth:0,overflow:'hidden',...Ii?{justifyContent:'flex-start'}:null},children:[(0,qe.jsx)(U.default,{testID:"display-header-brand",style:Ii?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(X.RestaurantBrand,{rid:jt.id,size:at<900?32:40,beside:!0,noLogo:Ii})}),(0,qe.jsxs)(U.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Y.T,{size:at<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,ee.hm)(St)}),at>=900?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:(0,ee.niceDate)(St)}):null]})]}),Pt?(0,qe.jsx)(U.default,{style:{width:220}}):(0,qe.jsx)(U.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:an}),(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,qe.jsxs)(U.default,{testID:"display-header-chips",style:{flexDirection:at>=1400||Ii?'row':'column',alignItems:at>=1400||Ii?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:at<1240?'xs':at<1280||dt<700?'s':'m'}),Pt?null:(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",slot:Ii,size:at<1340?'xs':at<1400||dt<700?'s':'m'})]}),'simulated'===vt?(0,qe.jsx)(F.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>Dt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,Z,e?null:(0,qe.jsx)(U.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(j.ExitButton,{size:44})})]})]}),Fe,I.IS_CAR||!Pt||Ii?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(ke.BookingSaveBanner,{rid:mt,margin:{marginHorizontal:12,marginTop:6}}),Pt||Ii?null:(0,qe.jsx)(U.default,{testID:"display-day-stats",style:Xe,children:(0,qe.jsxs)(U.default,{style:Ze,children:[I.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(U.default,{style:et,children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})})]})}),ht?cn:(un=(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{testID:"front-door-bar",style:{gap:10},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ki(!1)}),ji]}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:St,big:!0,by:Lt}),Pt?(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"}):(0,qe.jsx)(qe.Fragment,{children:(0,qe.jsxs)(U.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[yi,gi?hi:ui,bi,ln]})]})}),qi,Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,sound:(0,E.flapSoundOn)(),onPress:dn})}),Pt?null:(0,qe.jsx)(U.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Di+We.DAY_GRAPH_CHROME},children:on})]}),(0,qe.jsx)(V.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:un})),Ki]}),(0,qe.jsx)($.SoldOutStrip,{rid:mt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:zs,onClose:()=>Hs(!1),rid:mt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:mt}),Mt.elements,is?(0,qe.jsx)(y.EditBookingPicker,{rid:mt,today:Ht,who:Lt,onClose:()=>ns(!1)}):null,os?(0,qe.jsx)(y.EditBookingSheet,{rid:mt,id:os,who:Lt,onClose:()=>as(null)}):null,Qt?(0,qe.jsx)(ve.TableSheet,{rid:mt,name:Qt,view:Xs,plan:Nt,todays:Us,now:St,privacy:Et,turnBase:jt.settings.turnMins,onClose:()=>Jt(null),onWalkIn:e=>Mt.openWalkInAt(e),onMove:e=>Zt(e),onDetails:Vs}):null,Il?(()=>{const e=kl[Il],t=e?.dayBookings??[];return(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>{$l(null),Dl(null)},title:`${(0,d.tableNumbersA11y)(Il)} \xb7 ${cl?dl:(0,ze.dayLong)(al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Y.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${cl?dl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${cl?dl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Et):tt(e.name);return(0,qe.jsx)(Y.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,Ie.tablesWords)((0,ae.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Dl(null),fs(e.id)},style:{minHeight:56}},e.id)}),al>=Ht?(()=>{const t=e?.table.maxSeats??0,s=kt.filter(e=>e.date===al&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,ae.tablesOf)(e.table).includes(Il)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,qe.jsxs)(U.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(Il)]}),Rl?(0,qe.jsxs)(U.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Rl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Rl.ask}),(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!wi.ok,accessibilityHint:wi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=kt.find(e=>e.id===Rl.id);if($l(null),!e)return;const s=tt(e.name);Dl(null),await(0,ke.saveTablesReported)(mt,e,[Il],s,t,Es)}}),(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>$l(null)})]})]}):null,Rl?null:s.slice(0,12).map(e=>{const s=tt(e.name),l=e.partySize>t;return(0,qe.jsx)(Y.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:!wi.ok,accessibilityHint:wi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(Il)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,ke.guardBookingChange)(Es,{b:e,tables:[Il]}))return;const l=(0,Ie.overCapacityAsk)([Il],t,e.partySize);l?$l({id:e.id,ask:l}):(Dl(null),await(0,ke.saveTablesReported)(mt,e,[Il],s,t,Es))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Y.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{$l(null),Dl(null)},style:{minHeight:56}})]})})():null,ps?(()=>{const e=kt.find(e=>e.id===ps);return e?(0,qe.jsx)(je.GuestActionsSheet,{rid:mt,b:e,name:e.walkIn?(0,fe.privName)(e,Et):tt(e.name),view:Xs,now:St,otherDay:e.date!==Ht,turnBase:jt.settings.turnMins,onClose:()=>fs(null),onDetails:Vs,onDone:Es,onEdit:e=>{fs(null),as(e.id)},onPickOnPlan:(e,t)=>{gs(!1),Vt('plan'),Yt('all'),ms({id:e.id,tables:t})}}):null})():null,es?(0,qe.jsx)(ve.DetailsPanel,{title:es.title,onClose:()=>ts(null),children:es.body}):null,rn,rs?(0,qe.jsx)(ve.ServiceSummary,{r:jt,todays:Us,orders:wt,waitlistAll:Ss,walkInCount:Cs,onClose:()=>ds(!1)}):null,Ts?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Rs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsx)(Y.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Rs(!1)})]}):null,Ws?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ls(!1),Bs(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,$s?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(Q.ReviewsSection,{rid:mt,mode:"read",venueName:jt.name}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,ss?(0,qe.jsxs)(ve.DetailsPanel,{title:"Takeaway",onClose:()=>ls(!1),children:[(0,qe.jsx)(Y.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(ot,{list:qs,me:Lt,bookings:kt})]}):null,Os?(0,qe.jsx)(U.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,qe.jsx)(he.PlanDesigner,{initial:Nt,venue:jt.name,mode:"display",startStep:"arrange",onActivity:()=>{_s.current=Date.now(),null!==Gs&&Fs(null)},notice:null!==Gs?`Locking again in ${Gs} s \xb7 touch to keep editing`:null,onSave:e=>{ae.useFloor.getState().setPlan(mt,e),Ns(null),Es('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{ae.useFloor.getState().setPlan(mt,e),Es('Live seating plan updated on every screen.')},onCancel:()=>{Ns(null),Es('No changes kept. Editing is locked again.')}},Os.at)}):null,e?null:(0,qe.jsx)(ye.Screensaver,{rid:mt,idleMins:At.idleMins,pinOn:At.pinOn,wake:At,tonightCards:At.tonightCards,cfg:Ot}),e?null:(0,qe.jsx)(Ce.PrintHost,{rid:mt}),e?null:(0,qe.jsx)(Se.AlertHost,{variant:"display",rid:mt,skipTakeaway:!0}),e?null:(0,qe.jsx)(O.SeatAllergenReminder,{rid:mt}),e?null:(0,qe.jsx)(Te.TakeawayTakeover,{rid:mt,me:Lt})]});var un}function rt({rid:e,id:t,turnBase:s}){const l=(0,te.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1330,[1051,779,805,806,1331,813,1332,1092,843,1138,1333,1334,1335,1089,1119,1336,1337,1342,1343,1200,1344,856,1349,1350,1351,1112,1111,920,1352,1150,891,1102,1353,17,1070,1176,1016,1085,1354,378,363,385,278,85,409,19,777,1227,1231,857,845,863,858,804,1088,876,1096,1055,996,1074,1107,1355,1106,1356,1363,1365,1368,1373,1367,1374,1377,1378,1114,1093,1094,862,1383,1216,1384,1226,1218,993,1389,1394,1395,1052,1050,1116,1397,1398,1399,1069,1169,1400,1168,1159,853,1345,1401,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 Je}}),_e2.DisplayBoard=function(e={}){const t=(0,ie.useOwner)(e=>e.site);return(0,te.useRestaurant)(t)?(0,qe.jsx)(at,{...e}):(0,qe.jsx)(U.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:se.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,qe.jsx)(Y.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]),S=_r(_d[23]),v=_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=_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]),Se=_r(_d[76]),ve=_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]);const Ye='#221C12',Qe='#2E2618',Je=12e4,Xe={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},Ze={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},et={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},tt=e=>(e??'').replace(' (example)',''),st=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),lt=e=>e.slotTime?(0,ee.hm)(new Date(e.slotTime)):'ASAP';function it({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,qe.jsxs)(U.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)(U.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)(U.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)(Y.T,{size:s?24:19,weight:"semibold",colour:e.alert?se.colours.amber:se.colours.text,children:e.value}),(0,qe.jsx)(Y.T,{size:s?14:12,colour:se.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,qe.jsx)(F.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)(U.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)(Y.T,{size:14,colour:se.colours.muted,children:"No Covers yet"}):(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",colour:se.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,qe.jsx)(Y.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,qe.jsxs)(U.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:se.colours.gold},children:[(0,qe.jsx)(U.default,{style:{width:`${l.walkInPct}%`,backgroundColor:se.colours.gold}}),(0,qe.jsx)(U.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function nt({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,qe.jsxs)(F.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)(U.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,qe.jsx)(Y.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?se.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,qe.jsx)(Y.T,{size:12,colour:se.colours.muted,children:s}):null]})}function ot({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ve.statusBlock)(e,t,(0,Ve.linkedBooking)(e,l));return e.length?(0,qe.jsx)(U.default,{style:{gap:8},children:e.map(e=>(0,qe.jsxs)(U.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:se.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?se.colours.ok:e.allergies.length?se.colours.red:se.colours.gold},children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:s?16:18,weight:"bold",children:[lt(e)," \xb7 ",tt(e.customerName)]}),(0,qe.jsx)(Y.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)(Y.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)(Y.T,{size:14,weight:"semibold",colour:se.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,Z.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,qe.jsx)(Fe.AllergyChain,{o:e,me:t,compact:!0}):null,(0,qe.jsxs)(Y.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,qe.jsx)(Y.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>te.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,qe.jsx)(Y.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,qe.jsx)(Y.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>te.repo.orders.setStatus(e.id,'collected',t)}):null,(0,qe.jsx)(Ce.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,qe.jsx)(Y.Muted,{children:"No takeaway orders right now."})}function at({embedded:e=!1,boardW:b,headerExtra:Z,subHeader:Fe,noVoice:Ve=!1}={}){const lt=(0,K.default)(),at=b??lt.width,dt=lt.height,ct=at<700,ut=at>=dt,ht=!ct&&ut&&at>=600,gt=ht,bt=Math.round(Math.min(520,Math.max(at>=1e3?448:280,.3*at))),yt=P.default.useRef(null),pt=P.default.useRef(0),[ft,xt]=(0,H.useState)({w:0,h:0}),mt=(0,ie.useOwner)(e=>e.site),jt=(0,te.useRestaurant)(mt);(0,Re.useAlertWatcher)(mt,{enabled:!e});const wt=(0,te.useOrders)(mt),It=(0,te.useBookings)(mt),kt=(0,te.useEvents)(mt),Dt=(0,te.useStore)(e=>e.skipMinutes),St=(0,te.useStore)(e=>e.clock.mode),vt=(0,te.useNow)(5e3),Ct=(0,ie.useOwner)(e=>e.staff),Tt=(0,ie.useOwner)(e=>e.attendance),Rt=(0,ie.useOwner)(e=>e.shifts),$t=(0,ie.useOwner)(e=>e.leave),Bt=P.default.useMemo(()=>(0,Ee.workingShifts)(Rt,$t),[Rt,$t]);P.default.useEffect(()=>{(0,oe.ensureAttendance)((0,ee.ymd)(vt),vt)},[(0,ee.ymd)(vt)]);const Wt=(0,R.useSession)(e=>e.meId),Lt=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:tt(Ct.find(e=>e.id===Wt)?.name)}),zt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:zt,!0);const Ht=(0,ee.ymd)(vt),Pt=(0,A.useTravelDay)('display',Ht),Mt=(0,ne.useFrontDoor)(Ht,ut),At=(0,ae.useDisplaySettings)(mt),Ot=At.privacy,Et=(0,pe.useSaverSync)(),Nt=(0,ae.usePlan)(mt),_t=(0,ae.useFloor)(e=>e.live[mt]),Gt=(0,$e.useBlocks)(e=>e.blocks),[Ft,Vt]=(0,H.useState)('plan'),[Ut,Kt]=(0,H.useState)(!1),[qt,Yt]=(0,H.useState)('all'),[Qt,Jt]=(0,H.useState)(null),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(!1),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(null),[rs,ds]=(0,H.useState)(!1),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(null),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(!1),Ds=P.default.useRef(0),Ss=e=>{Ds.current=Date.now(),ws(e)};P.default.useEffect(()=>{if(!js)return;const e=setInterval(()=>{Date.now()-Ds.current>=ze.DAY_IDLE_MS&&ws(null)},5e3);return()=>clearInterval(e)},[js]);const vs=(0,te.useWaitlist)(mt),Cs=(0,te.useStore)(e=>e.walkIns[mt]??0),[Ts,Rs]=(0,H.useState)(!1),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1);(0,J.useReviewAlerts)(mt);const[Ps,Ms]=(0,H.useState)({view:0,content:0}),[As,Os]=(0,H.useState)(null);P.default.useEffect(()=>{As&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:As,timeoutMs:4500,big:!0,testID:'floor-toast'}),Os(null))},[As]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[Es,Ns]=(0,H.useState)(null),_s=P.default.useRef(0),[Gs,Fs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Es)return;_s.current=Date.now();const e=setInterval(()=>{const e=Date.now()-_s.current;if(e>=Je)return Ns(null),void Os('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Fs(e>=105e3?Math.ceil((Je-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Es]);const Vs=e=>e.date!==Ht?ts({title:`Guest details \xb7 ${(0,ze.dayWord)(e.date,Ht)} ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[!e.walkIn&&e.date>Ht?(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,ze.dayWord)(e.date,Ht)}, ${e.time}`,disabled:!wi.ok,accessibilityHint:wi.hint,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ts({title:`Guest details \xb7 ${e.time}`,body:(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(rt,{rid:mt,id:e.id,turnBase:jt.settings.turnMins}),e.walkIn?null:(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ts(null),as(e.id)},style:{minHeight:56}}),e.walkIn?(0,qe.jsx)(we.CancelWalkInButton,{rid:mt,b:e,big:!0,onDone:e=>{ts(null),Os(e)}}):null,e.walkIn?(0,qe.jsx)(we.ReinstateWalkInButton,{rid:mt,b:e,today:Ht,onDone:e=>{ts(null),Os(e)}}):null,(0,Se.bookingDetails)(e)]})}),Us=It.filter(e=>e.date===Ht).sort((e,t)=>e.time.localeCompare(t.time)),Ks=Us.filter(e=>!['cancelled','noshow'].includes(e.status)),qs=wt.filter(st).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ys=(0,H.useMemo)(()=>(0,c.forecastToday)(jt,It,wt,kt,vt),[jt,It,wt,kt,vt.getTime()/6e4|0]),Qs=(0,$e.closedAreasAt)(Gt,mt,Ht,(0,ee.hm)(vt)),Js=[...Qs].join(','),Xs=(0,H.useMemo)(()=>(0,re.floorView)(Nt,It,wt,_t??{},vt,jt.settings.turnMins,Qs),[Nt,It,wt,_t,vt.getTime(),Js]),Zs=(0,De.hoursFor)(jt,vt),el=Zs?.open??new Date(`${Ht}T12:00:00`),tl=Zs?.close??new Date(`${Ht}T21:00:00`),sl=(0,ee.addMins)(el,-el.getMinutes()),ll=(0,ee.addMins)(tl,30),il=e=>new Date(`${Ht}T${e}:00`),nl=(0,$e.blocksOn)(Gt,mt,Ht).map(e=>({from:il(e.from),to:il(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(jt,vt,Ht)),ol=Object.keys(Xs).filter(e=>'blocked'===Xs[e]?.status),al=js&&js!==Ht?js:Ht,rl=al!==Ht,dl=(0,ze.dayWord)(al,Ht),cl=/^(Today|Yesterday|Tomorrow)$/.test(dl),ul=rl?(0,ze.bookingsForDay)(It,al,Ht).sort((e,t)=>e.time.localeCompare(t.time)):Us,hl=(0,ee.parseYmd)(al);hl.setHours(12);const gl=rl?(0,De.hoursFor)(jt,hl):Zs,bl=gl?.open??new Date(`${al}T12:00:00`),yl=gl?.close??new Date(`${al}T21:00:00`),pl=e=>new Date(`${al}T${e}:00`),fl=[...rl?(0,$e.blocksOn)(Gt,mt,al).map(e=>({from:pl(e.from),to:pl(e.to),label:e.reason??'Paused'})):nl,...rl?(0,n.queuedServicePauses)(jt,hl,al):[]],xl=(0,n.queuedServiceSessions)(jt,hl),ml=l.IS_QUEUED_VENUE&&(void 0===xl||!xl.length),jl=(0,qe.jsxs)(U.default,{testID:"queued-hours-gate",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:void 0===xl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,qe.jsx)(Y.Muted,{children:i.queuedVenues[mt]?.hours.note})]}),wl=rl?gl||ul.length?alrl?(0,re.dayFloorView)(Nt,ul,al):Xs,[rl,Nt,ul,al,Xs]),[kl,Dl]=(0,H.useState)(null),[Sl,vl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(!1),[Rl,$l]=(0,H.useState)(null),Bl=rl?ul.filter(e=>!['cancelled','noshow'].includes(e.status)):Ks,Wl=Bl.reduce((e,t)=>e+t.partySize,0),Ll=(0,u.coversSplit)(Bl,al),zl=(0,Pe.cancelledDayTally)(It,al),Hl=(0,Me.cancellationsFor)(It,al,e=>e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)','')),Pl=(0,Pe.cancelledTallyWords)(zl,cl?dl.toLowerCase():rl?`on ${dl}`:'today'),Ml=Gt.filter(e=>e.rid===mt&&e.date===al&&!e.removedAt),Al=60*bl.getHours()+bl.getMinutes(),Ol=60*yl.getHours()+yl.getMinutes(),El=(0,Le.chartBands)(Ml,Al,Ol),Nl=(0,Le.seasonClosedAreaIds)(Ml,Al,Ol),_l=Nl.size?{...Nt,areas:Nt.areas.filter(e=>!Nl.has(e.id)),tables:Nt.tables.filter(e=>!Nl.has(e.areaId))}:Nt,Gl=rl?[]:ol.filter(e=>!Nl.has(Nt.tables.find(t=>t.name===e)?.areaId??'')),Fl=new Set((0,Le.blockedHours)(El)),Vl=vt.getHours()+(vt.getMinutes()>=30?1:0),Ul=Ys.hours.filter(e=>e.hour>=Vl&&!Fl.has(e.hour)),Kl=Ul.reduce((e,t)=>e+t.coversHigh,0),ql=Ul.reduce((e,t)=>e+t.coversLow,0),Yl=Math.round((ql+Kl)/2),Ql=!Ys.example&&Ys.open&&Ys.enough&&Kl>0?`Usually ${(0,c.coversRange)(Yl,Yl)} more`:void 0,Jl=async(e,t)=>{const s=Xs[e]?.booking;if(!s||e===t)return;const l=Xs[t]?.status;if(l&&!['free','soon'].includes(l))return void Os('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${re.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,Ie.guardBookingChange)(Os,{b:s,tables:[t]}))return;await te.repo.bookings.update(s.id,{table:t});const i=_t?.[e]?.stage;ae.useFloor.getState().setLive(mt,t,{stage:i??'seated',dirty:!1}),ae.useFloor.getState().setLive(mt,e,{stage:void 0,dirty:!0}),Os(`Saving: ${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,Ie.reportBookingSave)(s.id,`${(0,fe.privName)(s,Ot)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,fe.privName)(s,Ot)} to ${(0,d.tableNumbers)(t)}`,Os)},Xl=e=>{if(xs)return vl(null),void ms(t=>t?{...t,tables:(0,ke.toggleTable)(t.tables,e)}:t);rl?Dl(e):Xt?(e!==Xt&&Jl(Xt,e),Zt(null)):Jt(e)},Zl=xs?It.find(e=>e.id===xs.id):void 0,ei=xs&&Zl?(()=>{const e=Zl.walkIn?(0,fe.privName)(Zl,Ot):tt(Zl.name),t=(0,ke.seatsOf)(Nt,xs.tables).total,s=(0,ke.seatLine)(t,Zl.partySize),l=(0,ke.pickClashes)(Zl,xs.tables,It.filter(e=>e.date===Zl.date),jt.settings.turnMins),i=(0,ke.tableKey)(xs.tables)!==(0,ke.tableKey)((0,ae.tablesOf)(Zl.table));return(0,qe.jsxs)(U.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:se.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,padding:10},children:[(0,qe.jsxs)(U.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,ze.dayWord)(Zl.date,Ht)} ${Zl.time}. Tap tables on the plan to add or take them off. ${(0,ke.tablesWords)(xs.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",colour:se.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,ze.dayWord)(Zl.date,Ht)," ",Zl.time]}),(0,qe.jsxs)(Y.T,{size:16,colour:se.colours.text,children:[(0,ke.tablesWords)(xs.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Sl?(0,qe.jsx)(U.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Sl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:(0,qe.jsx)(Y.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Sl})}):null,Cl&&Zl&&xs.tables.length?(0,qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,xs.tables.join('+')),onYes:()=>{Tl(!1),(async()=>{if(!(0,Ie.guardBookingChange)(Os,{b:Zl,tables:xs.tables}))return vl(null),void ms(null);const s=xs.tables;ms(null),await(0,Ie.saveTablesReported)(mt,Zl,s,e,t,Os)})()},onNo:()=>Tl(!1)}):null,(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.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,ke.tablesWords)(xs.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Zl)return void ms(null);if(!(0,Ie.guardBookingChange)(Os,{b:Zl,tables:xs.tables}))return vl(null),void ms(null);const s=(0,ke.overCapacityAsk)(xs.tables,t,Zl.partySize);if(s&&!Sl)return void vl(s);if('finished'===Zl.status&&xs.tables.length&&!Cl)return void Tl(!0);vl(null),Tl(!1);const l=xs.tables;ms(null),await(0,Ie.saveTablesReported)(mt,Zl,l,e,t,Os)}}),(0,qe.jsx)(Y.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{vl(null),ms(null)}})]})]})})():null,ti=_l.areas.filter(e=>_l.tables.some(t=>t.areaId===e.id)),si=e=>{const t=Nt.tables.filter(t=>t.areaId===e);return rl?`${t.filter(e=>!Il[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Xs[e.name]?.status??'free')).length}/${t.length} free`},li='all'===qt||ti.some(e=>e.id===qt)?qt:'all',ii=e=>(0,qe.jsx)(de.FloorCanvas,{plan:_l,areaId:e,mode:"live",fit:"contain",crop:!0,fill:ht,big:!0,view:Il,privacy:Ot,turnBase:jt.settings.turnMins,highlight:xs?xs.tables:Xt?[Xt]:void 0,onTap:e=>Xl(e.name),onDrop:(e,t)=>xs||rl?void 0:Jl(e.name,t.name)}),ni=ct?1:ut||ti.length>2?2:1,oi=e=>{const t=Nt.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},ai=[];for(let e=0;e{const t=(0,de.areaBounds)(Nt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,de.minReadableScale)(Nt,e.id)}}),ft.w,ft.h):null,di=e=>(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',height:ce.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:si(e.id)})]}),ci=(0,qe.jsx)(U.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-ft.w)>1||Math.abs(s-ft.h)>1)&&xt({w:t,h:s})},children:ri?(0,qe.jsx)(V.default,{style:{flex:1},scrollEnabled:ri.scroll,showsVerticalScrollIndicator:ri.scroll,contentContainerStyle:{gap:ce.GRID_GAP},children:ri.rows.map((e,t)=>(0,qe.jsx)(U.default,{style:{height:ri.rowHeights[t],flexDirection:'row',gap:ce.GRID_GAP},children:e.map(e=>{const t=ti.find(t=>t.id===e);return(0,qe.jsxs)(U.default,{testID:`area-cell-${e}`,style:{width:ri.cellW,gap:2},children:[di(t),(0,qe.jsx)(U.default,{style:{flex:1},children:ii(e)})]},e)})},t))}):null}),ui=(0,qe.jsxs)(U.default,{testID:"venue-plan",style:{flex:ct?void 0:1,gap:10,minWidth:0},children:[(0,qe.jsx)(r.TableNumberWarning,{plan:Nt}),Nt.tables.length?null:(0,qe.jsxs)(U.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,qe.jsx)(Y.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,qe.jsx)(Y.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)(Y.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,qe.jsx)(nt,{chipId:"all",compact:!ct,label:"Whole venue",selected:'all'===li,onPress:()=>Yt('all')},"__all"),...ti.map(e=>(0,qe.jsx)(nt,{chipId:e.id,compact:!ct,label:`${e.name}${(0,ue.areaMarks)(e)}`,colour:(0,se.brandColour)(e.colour),sub:ct?Qs.has(e.id)?'closed':li===e.id?si(e.id):void 0:void 0,selected:li===e.id,onPress:()=>Yt(e.id)},e.id))];return ct?(0,qe.jsx)(U.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,qe.jsx)(V.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Ms(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Ms(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:Ps.view>0&&Ps.content>0&&Ps.content<=Ps.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ps.view>0&&Ps.content<=Ps.view+1?'100%':void 0},children:e})})(),(0,qe.jsx)(g.FloorLegend,{}),ei,Xt?(0,qe.jsxs)(Y.Row,{gap:8,style:{backgroundColor:se.colours.goldTint,borderRadius:10,padding:8},children:[(0,qe.jsxs)(Y.T,{weight:"semibold",colour:se.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Xt),": tap the new table."]}),(0,qe.jsx)(Y.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Zt(null)})]}):null,'all'===li&&ht?ci:'all'===li?(0,qe.jsx)(U.default,{style:{flex:ct?void 0:1,gap:12,minHeight:gt?void 0:360},children:ai.map((e,t)=>(0,qe.jsxs)(U.default,{style:{flex:ct?void 0:Math.max(.3,...e.map(e=>oi(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,qe.jsxs)(U.default,{style:{flex:1,gap:2},children:[ct?(0,qe.jsxs)(U.default,{style:{alignItems:'center',gap:4},children:[(0,qe.jsxs)(Y.T,{center:!0,size:18,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{center:!0,size:14,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{center:!0,children:si(e.id)})]}):(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between'},children:[(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:(0,se.brandColour)(e.colour),children:[e.name,(0,ue.areaMarks)(e)]}),Qs.has(e.id)?(0,qe.jsx)(Y.T,{size:13,weight:"semibold",colour:se.colours.blue,children:"Closed for weather"}):(0,qe.jsx)(Y.Muted,{children:si(e.id)})]}),(0,qe.jsx)(U.default,{style:ct?{height:Math.max(280,Math.round((at-40)*oi(e.id)))}:{flex:1},children:ii(e.id)})]},e.id)),e.length{if(rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},al)}),gi='timeline'===Ft,bi=Ut?(0,qe.jsx)(_.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Kt(!1),supportedOrientations:['landscape','portrait'],children:(0,qe.jsxs)(U.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:se.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,qe.jsx)(F.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Kt(!1),style:{minHeight:64,minWidth:at<600?120:180,paddingHorizontal:at<600?14:22,borderRadius:16,borderWidth:2,borderColor:se.colours.goldLight,backgroundColor:se.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,qe.jsx)(U.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,qe.jsx)(Y.T,{size:22,weight:"semibold",colour:se.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${rl?(0,ze.dayLong)(al):'Today'}`})}),at<600?null:(0,qe.jsx)(U.default,{style:{minWidth:180}})]}),ml?jl:(0,qe.jsx)(U.default,{style:{flex:1,minHeight:0},children:(0,qe.jsx)(be.Timeline,{hideNow:!0,fit:!0,plan:_l,bookings:rl?ul:Us,now:rl?bl:vt,privacy:Ot,turnBase:jt.settings.turnMins,t0:rl?(0,ee.addMins)(bl,-bl.getMinutes()):sl,t1:rl?(0,ee.addMins)(yl,30):ll,pauses:rl?fl:nl,blockedTables:Gl,onOpen:e=>{if(Kt(!1),rl)return void fs(e.id);const t=(0,ae.tablesOf)(e.table)[0];t&&Xs[t]?Jt(t):Vs(e)}},`full-${al}`)})]})}):null,yi=rl?(0,qe.jsxs)(U.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:se.colours.gold,backgroundColor:se.colours.goldTint},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:cl?`Showing ${dl} \xb7 ${(0,ee.niceDate)((0,ee.parseYmd)(al))}`:`Showing ${(0,ze.dayWord)(al,Ht)}`}),(0,qe.jsx)(U.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Pl}. Showing ${(0,ze.dayLong)(al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,qe.jsx)(Y.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ms(null),Ss(null)},style:{minHeight:44}})]}):null,pi=(0,qe.jsx)(U.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:ct?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(gi||Ut);return(0,qe.jsx)(F.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?(Vt('plan'),Kt(!0)):(Kt(!1),Vt('plan'))},style:{flex:ct?1:void 0,minHeight:ct?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?se.colours.gold:'transparent',...Ne.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)(Y.T,{size:ct?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),fi='display'===k.APP_VARIANT&&!e,xi='display'===k.APP_VARIANT&&!e,mi=!e&&!k.IS_CAR&&!ct,ji=fi?(0,qe.jsxs)(U.default,{testID:"display-view-row",style:{flexDirection:ct?'column':'row',flexWrap:ct||mi?'nowrap':'wrap',gap:6,alignItems:ct||mi?'stretch':'center'},children:[pi,(0,qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ct,fill:mi,shifts:Rt,staff:Ct,today:Ht,leave:$t})]}):pi,wi=(0,h.useBookingWrite)(),Ii=e=>(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Walk-in",onPress:Mt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"New booking",onPress:Mt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint}),(0,qe.jsx)(_e.BigAction,{premium:!0,label:"Edit booking",onPress:()=>ns(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!wi.ok,accessibilityHint:wi.hint})]});(0,Ke.useDisplayNotices)(mt,!e);const ki=!e&&!k.IS_CAR&&!ct,Di=ct?180:202,[Si,vi]=(0,H.useState)(ct?180:168),Ci=P.default.useRef(ct?180:168),Ti=P.default.useRef(null),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(!1),[Wi,Li]=(0,H.useState)(!1),zi=!ct&&dt<=800,Hi=We.DAY_GRAPH_CHROME+(zi?24:8),Pi=P.default.useRef(0),[Mi,Ai]=(0,H.useState)(Hi),[Oi,Ei]=(0,H.useState)(!0),[Ni,Gi]=(0,H.useState)(!1);P.default.useEffect(()=>{Gi(!1)},[at,dt]);const Fi=P.default.useRef(()=>{}),Vi=P.default.useCallback(e=>{Math.abs(e-Pi.current)>=2&&(Pi.current=e,setTimeout(()=>Fi.current(),0))},[]),Ui=()=>{const e=Ti.current,t=Ri.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=t>Ci.current?Math.ceil(t-Ci.current):0,o=ki?Math.max(Hi,Pi.current):Math.max(Hi,n);ki&&o!==Mi&&Ai(o);const a=!ct&&dt>=700?140:70,r=Math.floor(s-4-e)-o-l,d=i>0&&r-i>=a;ki&&d!==Oi&&Ei(d),ki&&!Ni&&r<48&&Gi(!0);const c=r-(d?i:0),u=Math.min(Di,c>=a?Math.max(a,c):Math.max(0,c));Math.abs(Ci.current-u)>=2&&(Ci.current=u,vi(u))},l=44+(dt<820?4:8),i=46+(dt<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=$i.current;ki&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=dt<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Bi.current?44+d:0)}):s(n,a,t,ki?i:l)})})};Fi.current=Ui,P.default.useEffect(()=>{const e=setTimeout(()=>Fi.current(),60),t=setTimeout(()=>Fi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[at,dt,al]);const Ki=(0,qe.jsxs)(U.default,{ref:Ri,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ui()},style:{flexDirection:'row',flexWrap:at>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ct?12:zi?2:6,justifyContent:ct?'center':void 0,borderTopWidth:1,borderTopColor:se.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,qe.jsx)(Ue.DisplayClockButton,{}),(0,qe.jsx)(ge.HoldToEdit,{quiet:!0,onUnlock:()=>{Fs(null),Ns({at:Date.now()})},onHint:()=>Os('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,qe.jsx)(Be.BlockBookingsButton,{rid:mt,r:jt,now:vt,by:Lt,quiet:!0,display:!0,day:al}),Nt.areas.some(e=>e.outdoor)?(0,qe.jsx)(Be.CloseGardenButton,{rid:mt,r:jt,now:vt,by:Lt,quiet:!0,short:!0}):null,(0,qe.jsx)(F.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Hs(!0),style:({pressed:e})=>({...Ne.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,qe.jsx)(Y.T,{size:15,weight:"semibold",colour:se.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,qe.jsx)(f.GiftQrButton,{rid:mt,venue:jt.name})]}),qi=qs.length?(0,qe.jsxs)(U.default,{testID:"takeaway-panel",style:[Ne.look.panel,{overflow:'hidden'}],children:[(0,qe.jsxs)(Y.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,qe.jsx)(Y.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,qe.jsxs)(Y.T,{size:12,colour:se.colours.muted,children:[qs.length," live"]})]}),(0,qe.jsx)(U.default,{style:{padding:10},children:(0,qe.jsx)(ot,{list:qs,me:Lt,compact:!0,bookings:It})})]}):null,Yi=(Oe.DueToday,jt.settings.turnMins||90),Qi=rl?ul:(0,S.todaysGuestList)(Us,vt,Yi),Ji=rl?[]:(0,S.todaysFinishedList)(Us,vt,Yi),Xi=rl?cl?`${dl}\u2019s guests`:`Guests ${dl}`:'Today\u2019s guests',Zi=(0,qe.jsxs)(qe.Fragment,{children:[0===Qi.length?(0,qe.jsx)(Y.Muted,{children:rl?al{const t=(0,S.isLeftEarly)(e,vt,Yi),s=(0,le.isSeatedHighlight)(e.status,{otherDay:rl})&&!t,l=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=se.colours.text,n=s?se.colours.goldLight:se.colours.muted,o=se.colours.gold,a=l.depositWarn?se.colours.amber:se.colours.goldLight;return(0,qe.jsxs)(F.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:rl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,le.seatedHighlightStyle)({backgroundColor:e?Qe:Ye,borderColor:se.colours.gold,borderLeftColor:se.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,qe.jsx)(Y.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)(U.default,{style:{paddingTop:2},children:(0,qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:se.colours.amber,ink:se.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,qe.jsx)(Y.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,qe.jsx)(Y.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&re.OCCASION_ICON[l.occasion]?(0,qe.jsx)(Y.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:re.OCCASION_ICON[l.occasion]}):null]}),(0,qe.jsxs)(Y.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,qe.jsx)(Y.T,{size:16,colour:i,children:l.people}),l.deposit?(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,qe.jsx)(Y.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,qe.jsx)(Y.T,{size:16,colour:n,children:" \xb7 "}),(0,qe.jsx)(Y.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,qe.jsx)(Y.T,{size:16,children:" "}):null,l.dog?(0,qe.jsx)(U.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,qe.jsx)(me.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,qe.jsx)(Y.T,{size:15,colour:se.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),Ji.length?(0,qe.jsxs)(U.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:se.colours.hairline,padding:8,gap:4},children:[(0,qe.jsxs)(F.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${Ji.length}${bs?', expanded':', collapsed'}`,accessibilityState:{expanded:bs},onPress:()=>ys(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(Y.T,{size:16,weight:"semibold",colour:se.colours.goldLight,children:["Finished (",Ji.length,")"]}),(0,qe.jsx)(Y.T,{size:16,colour:se.colours.muted,children:bs?'\u25be':'\u25b8'})]}),bs?Ji.map(e=>{const t=(0,xe.guestRowText)(e,{name:e.walkIn?(0,fe.privName)(e,Ot):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,qe.jsxs)(F.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{gs(!1),fs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:se.colours.hairline,backgroundColor:e?se.colours.tilePressed:'transparent'}),children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",colour:se.colours.gold,style:{width:58},children:t.time}),(0,qe.jsx)(Y.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,qe.jsxs)(Y.T,{size:15,colour:se.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,qe.jsx)(U.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,qe.jsx)(v.BookingUndo,{b:e,rid:mt,today:Ht,who:t.name,allowed:wi.ok})})]},e.id)}):null]}):null,(0,qe.jsx)(Ae.CancellationsSection,{items:Hl,dayWord:rl?cl?dl.toLowerCase():`on ${dl}`:'today'})]}),en=(0,qe.jsx)(V.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Zi}),tn=G.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&gs(!1)}}),sn=(0,qe.jsxs)(F.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Xi}, ${Qi.length}`,accessibilityState:{expanded:hs},'aria-expanded':hs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>gs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:hs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?se.colours.tilePressed:hs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,qe.jsx)(Y.T,{size:16,weight:"bold",colour:se.colours.gold,children:Qi.length}),(0,qe.jsx)(U.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(U.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,qe.jsxs)(Y.T,{size:13,weight:"semibold",colour:se.colours.goldLight,numberOfLines:1,children:[Xi," ",hs?'\u2039':'\u203a']})})})]}),ln=Math.min(560,Math.max(320,.44*at))<400,nn=hs?(0,qe.jsxs)(U.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,qe.jsxs)(U.default,{testID:"guests-drawer",...tn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*at)),backgroundColor:se.colours.surface,borderRightWidth:1,borderColor:se.colours.gold,borderRadius:14,...Ne.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,qe.jsxs)(U.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,qe.jsxs)(U.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsxs)(U.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,qe.jsxs)(Y.T,{testID:"guests-heading",size:ln?14:17,weight:"semibold",colour:se.colours.gold,style:{flexShrink:1,minWidth:0},children:[Xi.toUpperCase()," (",Qi.length,")"]}),(0,qe.jsx)(F.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:cs},'aria-expanded':cs,onPress:()=>us(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:ln?8:12,borderRadius:12,borderWidth:1,borderColor:cs?se.colours.gold:se.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?se.colours.tilePressed:cs?se.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,qe.jsxs)(Y.T,{size:14,weight:"semibold",colour:se.colours.goldLight,children:[ln?'Key':'Guest key'," ",cs?'\u25b4':'\u25be']})})]}),(0,qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${Xi}`,onPress:()=>gs(!1),style:{marginRight:-6,flexShrink:0}})]}),zl.count?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,testID:"cancelled-day-tally-guests",children:Pl}):null,cs?(0,qe.jsxs)(U.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:se.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,qe.jsxs)(U.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:se.colours.amber,ink:se.colours.bg}),(0,qe.jsx)(Y.T,{size:14,children:"allergy"})]}),(0,qe.jsxs)(U.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(me.DogIcon,{size:18}),(0,qe.jsx)(Y.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,qe.jsxs)(U.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(Y.T,{size:16,children:e}),(0,qe.jsx)(Y.T,{size:14,children:t})]},t))]}):null]}),en]}),(0,qe.jsx)(F.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Xi}`,accessibilityRole:"button",onPress:()=>gs(!1),style:{flex:1}})]}):null,on=ml?jl:l.IS_KIRKTON&&!Object.values(jt.kitchenHours??{}).some(Boolean)?(0,qe.jsxs)(U.default,{testID:"kirkton-hours-to-confirm",style:[Ne.look.panel,{padding:14,gap:8}],children:[(0,qe.jsx)(Y.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,qe.jsx)(Y.Muted,{children:"No service hours have been set for this venue."})]}):(0,qe.jsx)(We.DayGraph,{busyThreshold:(0,t.venueBusy)(jt,It,vt).busy,todays:ul,open:bl,close:yl,now:vt,turnBase:jt.settings.turnMins,blocks:Ml,pauses:fl,compact:ct,dense:!ct,fit:ht,tight:ht&&dt<=600,height:ht?Si:Di,forecastNote:rl?void 0:Ql,emptyText:wl,past:al{Ds.current=Date.now(),ks(!0)},shortDay:!ct&&at<1100}),dn=(0,qe.jsx)(He.DisplayCalendar,{visible:Is,today:Ht,day:al,bookings:It,restaurant:jt,now:vt,onDay:Ss,onClose:()=>ks(!1)}),cn=()=>{rl?gs(!0):Kt(!0)},un=(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',padding:zi?4:dt<820?8:12,paddingTop:zi?ki?2:4:dt<820?ki?4:6:ki?8:10,gap:zi?8:12,minHeight:0,overflow:'hidden'},children:[Pt?null:sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Pt?null:yi,Pt?(0,qe.jsx)(V.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"})}):gi?hi:ui,bi,nn]}),(0,qe.jsxs)(U.default,{testID:"display-side",style:{width:bt,gap:dt<820?4:8,minHeight:0},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Ii(!1)}),(0,qe.jsx)(U.default,{style:{flexShrink:0},children:ji}),Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",onLayout:Ui,style:ki&&!Ni?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:dt<820,snug:dt<820,tight:dt<800,fill:ki&&!Ni,sound:(0,O.flapSoundOn)(),onPress:cn})}),Pt?null:(0,qe.jsx)(U.default,{ref:Ti,testID:"day-graph-slot",onLayout:Ui,style:{flexGrow:0,flexShrink:ki?0:1,flexBasis:(ct?Di:Si)+(ki?Mi:Hi),height:(ct?Di:Si)+(ki?Mi:Hi),minHeight:dt<=600?90:Math.min((ct?Di:Si)+We.DAY_GRAPH_CHROME,!ct&&dt>=768?140+We.DAY_GRAPH_CHROME:120),overflow:'visible'},children:an}),ki&&!Pt?(0,qe.jsx)(U.default,{ref:$i,testID:"display-side-split",onLayout:Ui,style:{flexShrink:0,alignItems:'center'},children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})}):null,(0,qe.jsxs)(V.default,{testID:"display-side-scroll",style:ki?{flexGrow:0,flexShrink:1,minHeight:Wi&&Oi?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Bi.current&&(Bi.current=s,Li(s),setTimeout(Ui,0))},children:[ki||xi?null:(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),qi,(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt})]})]})]});return(0,qe.jsxs)(q.SafeAreaView,{style:{flex:1,backgroundColor:se.colours.bg},onTouchStart:()=>{Ds.current=Date.now()},onMouseDown:()=>{Ds.current=Date.now()},children:[ct?(0,qe.jsx)(U.default,{style:{flex:1},children:(0,qe.jsxs)(V.default,{ref:yt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,qe.jsxs)(U.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,qe.jsx)(U.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,qe.jsx)(j.ExitButton,{})}),(0,qe.jsx)(X.RestaurantLogo,{rid:mt,size:64}),(0,qe.jsx)(Y.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:jt.name}),(0,qe.jsx)(X.PoweredBy,{}),(0,qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,qe.jsx)(U.default,{accessible:!0,accessibilityLabel:`Current time ${(0,ee.hm)(vt)}`,children:(0,qe.jsx)(Y.T,{center:!0,size:30,weight:"semibold",colour:se.colours.goldLight,children:(0,ee.hm)(vt)})}),(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:"m"}),(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",size:"m"}),Z]}),Fe,k.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:mt}),rn,(0,qe.jsx)(U.default,{testID:"phone-glance",style:{width:'100%'},children:(0,qe.jsx)(it,{phone:!0,split:Ll,items:[{label:`Tables \xb7 ${dl}`,value:Bl.length,testID:'badge-tables'},{label:`Covers \xb7 ${dl}`,value:Wl,testID:'badge-covers'},{label:'Takeaway',value:qs.length,alert:qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ls(!0)}]})}),(0,qe.jsx)(U.default,{testID:"primary-actions",style:{gap:8},children:Ii(!0)}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt}),ji,(0,qe.jsxs)(U.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[gi?hi:ui,bi]}),(0,qe.jsxs)(U.default,{onLayout:e=>{pt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ne.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,qe.jsxs)(Y.T,{center:!0,size:20,weight:"semibold",colour:se.colours.goldLight,accessibilityRole:"header",children:[Xi," (",Qi.length,")"]}),(0,qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:Xi,style:{gap:4},children:Zi})]}),qi,an,(0,qe.jsx)(U.default,{testID:"covers-dock",children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>yt.current?.scrollTo({y:pt.current,animated:!0})})}),(0,qe.jsxs)(U.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,qe.jsx)(Y.T,{center:!0,size:14,colour:Ot?se.colours.muted:se.colours.amber,children:Ot?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,qe.jsx)(Y.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Rs(!0),style:{minHeight:48,alignSelf:'stretch'}}),xi?null:(0,qe.jsx)(Y.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Ki]})}):(0,qe.jsxs)(qe.Fragment,{children:[ki?(0,qe.jsx)(U.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:se.colours.hairline},children:(0,qe.jsx)(U.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)(U.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:at>=1e3?18:14,paddingVertical:zi?2:dt<820?4:8,gap:8,minHeight:zi&&ki?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ne.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,qe.jsxs)(U.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:ki?16:8,minWidth:0,overflow:'hidden',...ki?{justifyContent:'flex-start'}:null},children:[(0,qe.jsx)(U.default,{testID:"display-header-brand",style:ki?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,qe.jsx)(X.RestaurantBrand,{rid:jt.id,size:at<900?32:40,beside:!0,noLogo:ki})}),(0,qe.jsxs)(U.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,qe.jsx)(Y.T,{size:at<900?18:21,weight:"semibold",colour:se.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,ee.hm)(vt)}),at>=900?(0,qe.jsx)(Y.T,{size:13,colour:se.colours.muted,children:(0,ee.niceDate)(vt)}):null]})]}),Pt?(0,qe.jsx)(U.default,{style:{width:220}}):(0,qe.jsx)(U.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:rn}),(0,qe.jsxs)(U.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,qe.jsxs)(U.default,{testID:"display-header-chips",style:{flexDirection:at>=1400||ki?'row':'column',alignItems:at>=1400||ki?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,qe.jsx)(Ge.ShellfishChip,{rid:mt,by:Lt,app:"display",size:at<1240?'xs':at<1280||dt<700?'s':'m'}),Pt?null:(0,qe.jsx)(Ge.SundayRoastChip,{rid:mt,by:Lt,app:"display",slot:ki,size:at<1340?'xs':at<1400||dt<700?'s':'m'})]}),'simulated'===St?(0,qe.jsx)(F.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>Dt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(Y.T,{size:11,colour:se.colours.muted,children:"+15"})}):null,Z,e?null:(0,qe.jsx)(U.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,qe.jsx)(j.ExitButton,{size:44})})]})]}),Fe,k.IS_CAR||!Pt||ki?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(Ie.BookingSaveBanner,{rid:mt,margin:{marginHorizontal:12,marginTop:6}}),Pt||ki?null:(0,qe.jsx)(U.default,{testID:"display-day-stats",style:Xe,children:(0,qe.jsxs)(U.default,{style:Ze,children:[k.IS_CAR?null:(0,qe.jsx)(w.WhosOnShift,{compact:!0}),(0,qe.jsx)(U.default,{style:et,children:(0,qe.jsx)(it,{splitOnly:!0,split:Ll,items:[]})})]})}),ht?un:(hn=(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(U.default,{testID:"front-door-bar",style:{gap:10},children:[(0,qe.jsx)(U.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Ii(!1)}),ji]}),(0,qe.jsx)(Be.BlocksBanner,{rid:mt,now:vt,big:!0,by:Lt}),Pt?(0,qe.jsx)(A.DayView,{rid:mt,day:Pt,today:Ht,app:"display"}):(0,qe.jsx)(qe.Fragment,{children:(0,qe.jsxs)(U.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[sn,(0,qe.jsxs)(U.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[yi,gi?hi:ui,bi,nn]})]})}),qi,Pt?null:(0,qe.jsx)(U.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,qe.jsx)(M.CoversToday,{rid:mt,day:al,sound:(0,O.flapSoundOn)(),onPress:cn})}),Pt?null:(0,qe.jsx)(U.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Di+We.DAY_GRAPH_CHROME},children:an})]}),(0,qe.jsx)(V.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:hn})),Ki]}),(0,qe.jsx)($.SoldOutStrip,{rid:mt,by:zt,onOpen:()=>Hs(!0)}),(0,qe.jsx)(B.SoldOutSheet,{visible:zs,onClose:()=>Hs(!1),rid:mt,by:zt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,qe.jsx)(p.TableOrderCue,{rid:mt}),Mt.elements,is?(0,qe.jsx)(y.EditBookingPicker,{rid:mt,today:Ht,who:Lt,onClose:()=>ns(!1)}):null,os?(0,qe.jsx)(y.EditBookingSheet,{rid:mt,id:os,who:Lt,onClose:()=>as(null)}):null,Qt?(0,qe.jsx)(Se.TableSheet,{rid:mt,name:Qt,view:Xs,plan:Nt,todays:Us,now:vt,privacy:Ot,turnBase:jt.settings.turnMins,onClose:()=>Jt(null),onWalkIn:e=>Mt.openWalkInAt(e),onMove:e=>Zt(e),onDetails:Vs}):null,kl?(()=>{const e=Il[kl],t=e?.dayBookings??[];return(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>{$l(null),Dl(null)},title:`${(0,d.tableNumbersA11y)(kl)} \xb7 ${cl?dl:(0,ze.dayLong)(al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,qe.jsxs)(Y.T,{size:16,center:!0,colour:se.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${cl?dl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${cl?dl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,fe.privName)(e,Ot):tt(e.name);return(0,qe.jsx)(Y.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,ke.tablesWords)((0,ae.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Dl(null),fs(e.id)},style:{minHeight:56}},e.id)}),al>=Ht?(()=>{const t=e?.table.maxSeats??0,s=It.filter(e=>e.date===al&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,ae.tablesOf)(e.table).includes(kl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,qe.jsxs)(U.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,qe.jsxs)(Y.T,{size:17,weight:"semibold",center:!0,colour:se.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(kl)]}),Rl?(0,qe.jsxs)(U.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Rl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:se.colours.amber,backgroundColor:se.colours.amberBg},children:[(0,qe.jsx)(Y.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Rl.ask}),(0,qe.jsxs)(Y.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!wi.ok,accessibilityHint:wi.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=It.find(e=>e.id===Rl.id);if($l(null),!e)return;const s=tt(e.name);Dl(null),await(0,Ie.saveTablesReported)(mt,e,[kl],s,t,Os)}}),(0,qe.jsx)(Y.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>$l(null)})]})]}):null,Rl?null:s.slice(0,12).map(e=>{const s=tt(e.name),l=e.partySize>t;return(0,qe.jsx)(Y.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:!wi.ok,accessibilityHint:wi.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(kl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,Ie.guardBookingChange)(Os,{b:e,tables:[kl]}))return;const l=(0,ke.overCapacityAsk)([kl],t,e.partySize);l?$l({id:e.id,ask:l}):(Dl(null),await(0,Ie.saveTablesReported)(mt,e,[kl],s,t,Os))},style:{minHeight:56}},e.id)})]}):null})():null,(0,qe.jsx)(Y.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{$l(null),Dl(null)},style:{minHeight:56}})]})})():null,ps?(()=>{const e=It.find(e=>e.id===ps);return e?(0,qe.jsx)(je.GuestActionsSheet,{rid:mt,b:e,name:e.walkIn?(0,fe.privName)(e,Ot):tt(e.name),view:Xs,now:vt,otherDay:e.date!==Ht,turnBase:jt.settings.turnMins,onClose:()=>fs(null),onDetails:Vs,onDone:Os,onEdit:e=>{fs(null),as(e.id)},onPickOnPlan:(e,t)=>{gs(!1),Vt('plan'),Yt('all'),ms({id:e.id,tables:t})}}):null})():null,es?(0,qe.jsx)(Se.DetailsPanel,{title:es.title,onClose:()=>ts(null),children:es.body}):null,dn,rs?(0,qe.jsx)(Se.ServiceSummary,{r:jt,todays:Us,orders:wt,waitlistAll:vs,walkInCount:Cs,onClose:()=>ds(!1)}):null,Ts?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Rs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,qe.jsx)(g.FloorLegend,{}),(0,qe.jsxs)(U.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:se.colours.amber,ink:se.colours.bg}),(0,qe.jsx)(Y.T,{size:14,children:"allergy"})]}),(0,qe.jsxs)(U.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,qe.jsx)(me.DogIcon,{size:18}),(0,qe.jsx)(Y.T,{size:14,children:"dog"})]}),(0,qe.jsx)(Y.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Rs(!1)})]}):null,Ws?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,qe.jsx)(F.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Ls(!1),Bs(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,qe.jsx)(Y.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,$s?(0,qe.jsxs)(Y.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,qe.jsx)(Q.ReviewsSection,{rid:mt,mode:"read",venueName:jt.name}),(0,qe.jsx)(Y.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,ss?(0,qe.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>ls(!1),children:[(0,qe.jsx)(Y.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,qe.jsx)(ot,{list:qs,me:Lt,bookings:It})]}):null,Es?(0,qe.jsx)(U.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:se.colours.bg},children:(0,qe.jsx)(he.PlanDesigner,{initial:Nt,venue:jt.name,mode:"display",startStep:"arrange",onActivity:()=>{_s.current=Date.now(),null!==Gs&&Fs(null)},notice:null!==Gs?`Locking again in ${Gs} s \xb7 touch to keep editing`:null,onSave:e=>{ae.useFloor.getState().setPlan(mt,e),Ns(null),Os('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{ae.useFloor.getState().setPlan(mt,e),Os('Live seating plan updated on every screen.')},onCancel:()=>{Ns(null),Os('No changes kept. Editing is locked again.')}},Es.at)}):null,e?null:(0,qe.jsx)(ye.Screensaver,{rid:mt,idleMins:At.idleMins,pinOn:At.pinOn,wake:At,tonightCards:At.tonightCards,cfg:Et}),e?null:(0,qe.jsx)(Ce.PrintHost,{rid:mt}),e?null:(0,qe.jsx)(ve.AlertHost,{variant:"display",rid:mt,skipTakeaway:!0}),e?null:(0,qe.jsx)(E.SeatAllergenReminder,{rid:mt}),e?null:(0,qe.jsx)(Te.TakeawayTakeover,{rid:mt,me:Lt})]});var hn}function rt({rid:e,id:t,turnBase:s}){const l=(0,te.useBookings)(e).find(e=>e.id===t);return l?(0,qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1330,[1051,779,805,806,1331,813,1332,1092,843,1138,1333,1334,1335,1089,1120,1336,1337,1342,1343,1200,1344,856,1349,1350,1351,1113,1111,920,1352,1150,891,1102,1353,17,1070,1176,1016,1085,1354,378,363,385,278,85,409,19,777,1227,1231,857,845,863,858,804,1088,876,1096,1055,996,1074,1107,1355,1106,1356,1363,1365,1368,1373,1367,1374,1377,1378,1115,1093,1094,862,1383,1216,1384,1226,1218,993,1389,1394,1395,1052,1050,1117,1397,1398,1399,1069,1169,1400,1168,1159,853,1345,1401,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},1333,[]); @@ -1431,7 +1431,7 @@ __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule', __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pitchClock=function(t,c){return}},1348,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.displayActionBy=function(t){if(t.isCar)return'Car';if(t.isDisplayApp)return'Display';return(t.personName??'').trim()||'Duty Manager'}},1349,[]); __d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"finishClearPatch",{enumerable:!0,get:function(){return s.finishClearPatch}}),Object.defineProperty(e,"DEFAULT_TURN_MINS",{enumerable:!0,get:function(){return a}}),e.bookingEndAt=u,e.isLeftEarly=o,e.todaysGuestList=function(t,n,s=a){return t.filter(t=>'confirmed'===t.status||'seated'===t.status||o(t,n,s)).sort((t,n)=>t.time.localeCompare(n.time))},e.todaysFinishedList=function(t,n,s=a){return t.filter(t=>'finished'===t.status&&!o(t,n,s)).sort((t,n)=>t.time.localeCompare(n.time))};var t=r(d[0]),n=r(d[1]),s=r(d[2]);const a=90;function u(s,u=a){if(!s.date||!s.time)return null;const o=(0,n.atTime)((0,n.parseYmd)(s.date),s.time),f=u>0?u:a,c=s.durationMins&&s.durationMins>=15?s.durationMins:(0,t.turnFor)(s.partySize??2,f);return new Date(o.getTime()+6e4*c)}function o(t,s,o=a){if('finished'!==t.status||!t.date||!t.time||!t.finishedAt)return!1;const f=(0,n.atTime)((0,n.parseYmd)(t.date),t.time);if(new Date(t.finishedAt).getTime()>=f.getTime())return!1;const c=u(t,o);return!!c&&(s??new Date).getTime()1?'are':'is'} free again`:'',"."]}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${$}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>I(t,e,{stage:void 0,dirty:!1})),j(!1)}}),(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${$} seated`,onPress:()=>j(!1)})]})]}):(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${$}: ${e.walkIn?'removes the walk-in':'back to booked'}${v?`, frees ${v}`:''}`,onPress:()=>j(!0)});const L='undo-finished'===x?'seated':'confirmed';return(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===x?`Undo finished: ${$} back to seated${v?` at ${v}`:''}`:`Undo no-show: ${$} back to booked`,onPress:async()=>{'undo-finished'!==x?await n.repo.bookings.setStatus(e.id,L):await(0,b.undoFinishedNow)(t,e)}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),h=r(d[7]),f=r(d[8]);function k(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1351,[17,85,858,996,777,804,1112,1111,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=k,_e.BookingUndo=function({b:e,rid:t,today:w,who:$,allowed:y=!0}){const[p,j]=(0,s.useState)(!1),x=k(e,w);if(!x||!y)return null;const U=(0,h.tableForUndo)(e),v=(0,l.tableCardLabel)(U),I=l.useFloor.getState().setLive;if('unseat'===x)return p?(0,f.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,f.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",$,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',v?` and ${v} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${$}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>I(t,e,{stage:void 0,dirty:!1})),j(!1)}}),(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${$} seated`,onPress:()=>j(!1)})]})]}):(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${$}: ${e.walkIn?'removes the walk-in':'back to booked'}${v?`, frees ${v}`:''}`,onPress:()=>j(!0)});const L='undo-finished'===x?'seated':'confirmed';return(0,f.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===x?`Undo finished: ${$} back to seated${v?` at ${v}`:''}`:`Undo no-show: ${$} back to booked`,onPress:async()=>{'undo-finished'!==x?await n.repo.bookings.setStatus(e.id,L):await(0,b.undoFinishedNow)(t,e)}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),h=r(d[7]),f=r(d[8]);function k(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1351,[17,85,858,996,777,804,1113,1111,8]); __d(function(g,r,i,a,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},1352,[813,812,17,219,385,278,85,777,1150,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])},1353,[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])},1354,[17,85,780,804,8]); @@ -1454,16 +1454,16 @@ __d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?global __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||'')}},1371,[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},1373,[17,831,928,899,1372]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=$,e.guestRowText=function(n,p){const l=n.partySize,b=Math.max(0,Math.min(l-1,Math.round(Number(n.children)||0))),f=`${l} ${1===l?'person':'people'}${b?` (${b} ${1===b?'child':'children'})`:''}`,h=(0,o.tablesOf)(n.table??void 0),c=h.length?`${p.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',w=p.leftEarly?"Left early"+(c?` \xb7 ${c}`:''):p.finished?"Finished"+(c?` \xb7 ${c}`:''):p.seated?"Seated"+(c?` \xb7 ${c}`:''):c||'No table yet',x=$(n),y=h.length?`table${h.length>1?'s':''} ${u(h.map(t.plainTableNumber))}`:p.finished?'finished':'no table yet',D=!!n.dog,m=(0,s.allergyLine)(n),k=(0,d.guestChangeLine)(n),v=[n.time,p.name,m?`allergy noted: ${m}`:'',f,p.leftEarly?'left early':p.finished?'finished':p.seated?'seated':'',x?.spoken??'',y,D?'dog':''].filter(Boolean).join(', ')+'.'+(k?` ${k}`:'');return{time:n.time,name:p.name,people:f,deposit:x?.text??null,depositWarn:!!x?.warn,table:w,dog:D,allergy:m,guestChange:k,a11y:v}};var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),s=r(_d[3]),d=r(_d[4]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,l=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 o=(0,n.depositBadge)(t,p);if(!o)return null;const s=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||d>0&&u>d&&!o.label.startsWith('Deposit paid')){const t=d||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${l(t).replace(' pounds','')} of ${l(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(o.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const $=o.label.match(/\xa3[\d.,]+/);if(o.label.startsWith('Deposit paid')){const t=/about/.test(o.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(o.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(o.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}}},1374,[843,841,996,1375,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}}},1374,[843,841,996,1375,1376]); __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])},1375,[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}},1376,[]); __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])},1377,[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'},1378,[1379,843,1093,996,17,85,777,1096,858,1113,1374,1094,863,1091,1114,1115,1116,804,1334,1381,1382,1112,1351,1111,8]); +__d(function(_g,r,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'},1378,[1379,843,1093,996,17,85,777,1096,858,1114,1374,1094,863,1091,1115,1116,1117,804,1334,1381,1382,1113,1351,1111,8]); __d(function(g,r,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])},1379,[17,362,385,85,858,920,876,994,1380,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')}`}},1380,[]); __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},1383,[1169,1379,813,1093,812,843,1138,1089,1114,863,17,1076,219,385,278,85,777,1096,1367,858,996,845,1087,1074,1312,804,1334,1381,1382,1112,1111,8]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"Card",{enumerable:!0,get:function(){return M}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const l=e.filter(e=>'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},1383,[1169,1379,813,1093,812,843,1138,1089,1115,863,17,1076,219,385,278,85,777,1096,1367,858,996,845,1087,1074,1312,804,1334,1381,1382,1113,1111,8]); __d(function(g,_r,_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.']}]},1384,[812,17,219,385,85,777,858,996,1385,804,1386,1388,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))},1385,[]); __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)}},1386,[831,858,996,1385,1387,1388]); @@ -1505,7 +1505,7 @@ __d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModu __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1422,[]); __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}},1423,[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]},1424,[17,85,777,804,914,1020,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])},1425,[805,1422,1093,1258,1426,812,822,1114,1115,1089,1119,1427,1120,1116,1397,1398,1055,1334,994,1117,1087,841,1376,1123,1429,1227,1430,1389,1076,1053,1088,17,85,777,1354,858,845,851,863,1312,804,1175,1096,1112,996,1351,1060,1159,1431,1218,899,1177,1394,862,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1425,[805,1422,1093,1258,1426,812,822,1115,1116,1089,1120,1427,1112,1117,1397,1398,1055,1334,994,1118,1087,841,1376,1123,1429,1227,1430,1389,1076,1053,1088,17,85,777,1354,858,845,851,863,1312,804,1175,1096,1113,996,1351,1060,1159,1431,1218,899,1177,1394,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])},1426,[806,17,85,777,899,1262,8]); __d(function(g,r,_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])},1427,[17,385,85,1428,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},1428,[]); @@ -1528,7 +1528,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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])},1445,[17,278,85,777,857,804,1446,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(' ')},1446,[]); __d(function(g,_r,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]})}},1447,[888,813,17,1067,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])},1448,[1176,1070,1114,1087,17,385,85,777,876,863,804,1088,1168,1165,1055,1117,1173,1436,1159,860,1177,853,1175,884,1351,996,843,1112,1190,1197,1069,8]); +__d(function(g,_r,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])},1448,[1176,1070,1115,1087,17,385,85,777,876,863,804,1088,1168,1165,1055,1118,1173,1436,1159,860,1177,853,1175,884,1351,996,843,1113,1190,1197,1069,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]})}},1449,[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(()=>{})},1450,[1451,899,778,1403,1453,993,13,1480,479,17,368,319,219,24,85,805,857,1063,856,1482,19,858,996,876,804,1443,920,986,1485,1486,1026,1102,880,1006,914,1487,1373,8,1488,1489,1490,1491]); __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.'}},1451,[880,812,17,219,366,85,777,1452,899,804,1179,920,876,909,8]); diff --git a/staff-app/admin.html b/staff-app/admin.html index 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 99728858da85f50ad47f4ff68797056e0dd8a090..3a618c09522dba2c597ac0fb97463d23973e7110 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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 5b77652c4144b176537ec374198218b6e20c8ccb..2adb1f360bb1f86116d16156a9754b1e9f44b759 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-2b71d9a9ea"; +const V = "cc-staff-39d65a2758"; 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=2b71d9a9ea2370ab67c7b8e6af82807eb0a2d3a3178865578db745fecd41fd55"]; +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=39d65a27588a367e3724c196f509ad010cc876e697c7100bee4d4fd19cb29f3e"]; // 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 5f7936adf91924ec42d35aae4e9533565668c9b6..e94adc00d0339147e3eae99931be75308343ba0e 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); })(); - +