diff --git a/CHECKSUMS.txt b/CHECKSUMS.txt index ae86be2ee88233c2c05276b0422fee352506c71b..93a6d7275a701bdf6b8b67b70d927ed0ba838594 100644 --- a/CHECKSUMS.txt +++ b/CHECKSUMS.txt @@ -1,28 +1,28 @@ -Cover Charge v0.3.12.155: 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.155. +Cover Charge v0.3.12.156: 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.156. SHA-256 of each web app's start page, service worker, manifest and logo: -0da4ae671df63de16f946797b837f9d3da08117768efea4b6d85cf8cfb06256f owner-app/index.html -e8aeb704145da7b20911282e78092d57c9ac408aba589b72657ad4fececf4a41 owner-app/sw.js +e9bd34e3e117886dbede67a7f4c7dc306f6264b145b550afac3ec4c63afb9a79 owner-app/index.html +453d77bbd9b7ae4a8dce35401ca7e6a76bd1d4e21203dfb335ecbf4d813d065d owner-app/sw.js e305c44d11a9c25f37372f3fa4d329d4ffb04df2edee6e7b4b9ac91f3875ac67 owner-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 owner-app/brand-logo.png -d09bbd83f0e79f14baaa373f25fee7a9cdac19b1789d480cdeb2279dca9b6342 staff-app/index.html -3377ce9588ffe6d8ab2337e1be4693ef1046ba1274a798334350d3c90f1e419c staff-app/sw.js +73960f434e8cee234e3b7f65dde0c5311575dc3c216626d6e09103c41c3f09e2 staff-app/index.html +085b355ae3d2d8e3907413f01a20a4d0348607e5cda1e0c91604ed3fa2742c2b staff-app/sw.js bd1d310ebf8e2a80808e100c41fb7fe1c4369d3026478f3ad8eececaeadaf4ac staff-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 staff-app/brand-logo.png -4546e4d380cb6ca02cf52e509ef287847c02aab4c305c6e4604b7b353d835562 customer-app/index.html -ce264b687d8370a95f0c4f98681c7cfddc890520a1a8506980c5bd65783c3420 customer-app/sw.js +625358f9b739bac362041976c2374378fb15156c5608280595d0f5c4d9f0c5a0 customer-app/index.html +572b012ec6582ec88f9777c3e1e6559203f07706f5119e5e4aa673965b01edce customer-app/sw.js 3bfb1fd10cc13f09ca6be65c461e1f6b5750ae51a3ece12e079750b2a066052e customer-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 customer-app/brand-logo.png -e73c22485ae87b731c6bc020b044cd45458c75f2183cde7d63a4a2e859ee22e7 display-app/index.html -ec7fdac01f1d82d7f02c5602ba5803416e42f3bb8cc3e0919f945dfac400ef87 display-app/sw.js +2a206b01a3acadc64753c06893ce4f71d2f35b51a918346f5c909a3541bff09b display-app/index.html +1e6d9e7d423a6b78bf2568fda7025cffa9ba34d1b35fb6b417548f691472dcdc display-app/sw.js 35e2721b86eb1ae1605e55bee64177adcee72f4e53a24ac417d19ea2873434a1 display-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 display-app/brand-logo.png -2e996713afd3b3d00f1a3df3239c0d1bdda6622268b5020c508b36123372ef2a chef-app/index.html -a82bc74ab2ed101b0e299c6c0f3d75d7b325fc7b1d116d6ca499e6f030ac651e chef-app/sw.js +ea7033ca9ccf68b6c5fa4f1e1f7fee8ffa038af5933f0114545506e3a73c77a6 chef-app/index.html +9ad693fcd1d4df1a5539cec4e23fd7e48f54818def9d68c012ca3b5d722c6f06 chef-app/sw.js 97ed43decde8a888e22b7411e13a2122c6f8b9944cf38b2e28e8f62ef2e25397 chef-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 chef-app/brand-logo.png -79500b1e2a7f6d8ca348e0b7b67a349b6625906b2516291b3c93caa00b175914 car-app/index.html -eebc3e1c57318b8e926ef01410b3130fe79db3e9fd56fad0751c8820231339e6 car-app/sw.js +5835163546a84e1f781ffbd928ccf0a08673d6d8dab37828f750148ac49d0b17 car-app/index.html +01463ced21d302df44f83e2f75134f065e8025e4893d1c275f07cbadbcd73c33 car-app/sw.js 091b9f96d36153d270b44dbf458aa99e4fd5e2f127769d030436fcd1d51e724a car-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 car-app/brand-logo.png fb1f73283c30e03612191eb339980b1b4922f3929cc60fa4780340c53d6434f1 car.html diff --git a/car-app/_expo/static/js/web/bundle.js b/car-app/_expo/static/js/web/bundle.js index 819e4047b13da223cab4c45d1520ab9dab70d7bc..028cb0720e5927cec2dc04963f203853bfd39ffb 100644 --- a/car-app/_expo/static/js/web/bundle.js +++ b/car-app/_expo/static/js/web/bundle.js @@ -1095,7 +1095,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()})},1012,[34,1013]); __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},1013,[1010,978,1014]); __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'}},1014,[1010]); -__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.155'},1015,[]); +__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.156'},1015,[]); __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});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:h}=await r.select();c&&s(c,h);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},h='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,h.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),h}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),h={...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:h})}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}}},1016,[1017,1018,934,978,1013]); __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())}}}},1018,[978]); @@ -1196,9 +1196,9 @@ __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,"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'},1113,[821]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},1114,[34,102,1115,821,1116,794,25]); __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 b={...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)(b)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(b,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}});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})},1115,[860,1100]); -__d(function(_g,r,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=$,_e.TablePicker=function({rid:e,booking:u,name:p,turnBase:k=90,onClose:v,onSaved:w,onPickOnPlan:T}){const C=(0,b.usePlan)(e),L=(0,c.useBookings)(e),[S,W]=(0,t.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),P=(0,t.useMemo)(()=>(0,h.pickGroups)(C),[C]),z=L.filter(e=>e.date===u.date),O=(0,h.seatsOf)(C,S),D=(0,h.seatLine)(O.total,u.partySize),I=(0,h.pickClashes)(u,S,z,k),B=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,M=(0,h.tableKey)(S)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),N=(0,f.useBlocks)(e=>e.blocks),R=(0,f.blockAt)(N,e,u.date,u.time),_=e=>W(s=>(0,h.toggleTable)(s,e)),Y=async s=>{try{await $(e,u,s),w?.((0,h.savedWords)(p,u.partySize,s,(0,h.seatsOf)(C,s).total)),v()}catch(e){w?.(`Couldn\u2019t save tables for ${p}: ${String(e?.message??e).slice(0,120)}`)}},G=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(S)} picked. ${D.text}.`,children:[(0,x.jsx)(y.T,{size:18,weight:"semibold",colour:g.colours.goldLight,children:(0,h.tablesWords)(S)}),(0,x.jsx)(y.T,{size:17,colour:g.colours.text,children:D.text})]}),R?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${R.from} to ${R.to}${R.reason?` (${R.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.goldMuted},children:(0,x.jsxs)(y.T,{size:16,colour:g.colours.goldLight,children:["New bookings paused ",R.from,"\u2013",R.to,R.reason?` \xb7 ${R.reason}`:'',". You can still save tables for this booking."]})}):null,I.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(I)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.gold},children:(0,x.jsxs)(y.T,{size:16,weight:"semibold",colour:g.colours.goldLight,children:[(0,h.clashWords)(I)," You can still save."]})}):null,(0,x.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(y.Button,{testID:"table-pick-save",label:I.length?'Save anyway':'Save tables',disabled:!M||!S.length,accessibilityLabel:`${I.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(S)} for ${p}. ${D.text}.${I.length?` ${(0,h.clashWords)(I)}`:''}`,onPress:()=>Y(S),style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(y.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${p}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(y.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:v,style:j})]})]});return(0,x.jsxs)(y.Sheet,{visible:!0,onClose:v,title:`Tables \xb7 ${u.time} ${p} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:G,children:[(0,x.jsx)(s.TableNumberWarning,{plan:C}),(0,x.jsx)(y.T,{size:16,colour:g.colours.text,children:"Tap one table, or several to join them. Tap again to take one off."}),T?(0,x.jsx)(y.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${p}`,onPress:()=>T(S),style:j}):null,P.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(y.T,{size:15,weight:"semibold",colour:g.colours.gold,children:e.area}),(0,x.jsx)(y.Row,{gap:8,wrap:!0,children:e.tables.map(e=>{const s=S.includes(e.name),t=B(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:s},'aria-checked':s,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,s,t),onPress:()=>_(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:s?2:1,borderColor:s?g.colours.gold:t?g.colours.goldMuted:g.colours.hairline,borderStyle:t&&!s?'dashed':'solid',backgroundColor:s?g.colours.gold:e?g.colours.tilePressed:g.colours.tile}),children:[(0,x.jsx)(y.T,{size:18,weight:"semibold",colour:s?g.colours.onGold:g.colours.text,children:(0,l.tableNumbers)(e.name)}),(0,x.jsxs)(y.T,{size:14,colour:s?g.colours.onGold:g.colours.muted,children:[e.seats," seats",t?' \xb7 booked':'']})]},e.name)})})]},e.area)),P.length?null:(0,x.jsx)(y.Muted,{children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var s=r(d[0]),l=r(d[1]),t=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),g=r(d[9]),p=r(d[10]),y=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function $(e,s,l){const t=(0,h.tableKey)(l),o=(0,b.tablesOf)(s.table);await c.repo.bookings.update(s.id,(0,u.tablePatch)(t||null)),'seated'===s.status&&s.date===(0,p.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(t).includes(e)).forEach(s=>b.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0})),t&&(0,k.resetTableLive)(e,t))}},1116,[1117,860,34,402,102,874,1025,1115,1118,821,858,794,1119,1022,25]); +__d(function(_g,r,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=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.amber,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(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?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.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=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1116,[1117,860,34,402,102,874,1025,1115,1118,821,858,794,1119,1022,25]); __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])},1117,[34,859,821,794,25]); -__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1118,[860,1100]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.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=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1118,[860,1100]); __d(function(g,_r,_i,_a,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 O}}),_e.useTableNames=N,_e.resetTableLive=M,_e.seatBookingNow=L,_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=F,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return R}}),_e.TablePicker=W,_e.WalkInSheet=E,_e.WalkInMatchPrompt=H,_e.AssignTableSheet=_,_e.undoNotice=Y,_e.NewBookingSheet=U,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[i,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,B.jsxs)(B.Fragment,{children:[s?(0,B.jsx)(E,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,B.jsx)(U,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,i?(0,B.jsx)(_,{booking:i.b,combine:i.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),i=_r(_d[5]),n=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),z=_r(_d[27]),B=_r(_d[28]);const O=Array.from({length:12},(e,t)=>String(t+1));function N(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function M(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}async function L(e,t){await f.repo.bookings.setStatus(t.id,'seated'),M(e,t.table)}function F(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=N(e),a=(0,S.useFloor)(t=>t.live[e])??{},i=(0,S.usePlan)(e),n=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(n,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(i.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,S.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,x.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const R=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function W({use:e,value:t,onPick:s,big:o,best:a,dense:i,bestSet:n,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=i?6:8,y=i?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(n??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,B.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],n=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!n,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,B.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?n?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:n,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:i?58:64,borderRadius:12,borderWidth:n||u?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:n||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:n?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||n?1:.55},children:[(0,B.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,B.jsx)(T.T,{weight:"bold",size:22,colour:n?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,B.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,B.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,B.jsx)(T.T,{size:i?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const A=[1,2,3,4,5,6,7,8];function E({onClose:e,onSeated:a,wide:i,initialTable:y}){const{rid:w,r:C,now:D}=(0,p.useCtx)(15e3),I=F(w,D),[$,P]=(0,r.useState)(2),[O,N]=(0,r.useState)(!1),[R,E]=(0,r.useState)(y??null),_=(0,S.usePlan)(w),Y=(0,f.useBookings)(w),U=(0,v.useBlocks)(e=>e.blocks),q=(0,v.closedAreasAt)(U,w,(0,x.ymd)(D),(0,x.hm)(D)),Q=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(I).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(_,Y.filter(e=>e.date===(0,x.ymd)(D)),e,$,D,(0,k.turnFor)($,C.settings.turnMins),90,void 0,{closed:q})?.table??null},[_,Y,I,$,q.size,D.getTime()]);(0,r.useEffect)(()=>{R&&(0,S.tablesOf)(R).some(e=>'Closed'===I[e]?.label)&&E(null)},[R,q.size]);const[V,G]=(0,r.useState)(!1),[K,X]=(0,r.useState)(''),J=(e,t=String(e),s=()=>{N(!1),P(e)})=>{const o='9+'===t?O:!O&&$===e;return(0,B.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:i?58:60,height:i?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,B.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},Z=(0,B.jsx)(s.PartySizeInput,{value:$,onChange:P,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),ee=(0,B.jsxs)(b.default,{style:{gap:8,width:i?256:void 0},children:[(0,B.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,B.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[A.map(e=>J(e)),J(9,'9+',()=>{N(!0),P(e=>e>=9?e:9)})]}),O?Z:null]}),[te,se]=(0,r.useState)(!1),[oe,le]=(0,r.useState)(null),ae=async(t=R,s=!1)=>{if(!te){if(!s){const e=(0,z.bookingsNearWalkIn)(Y,D,$);if(e.length)return void le({at:t,list:e})}se(!0);try{const s=await f.repo.bookings.seatWalkIn(w,$,t??void 0,K);M(w,t??void 0),a(s),e()}finally{se(!1)}}},ie=async(t,s)=>{if(!te){se(!0);try{const o=s??t.table??null;o&&o!==t.table&&await f.repo.bookings.assignTable(t.id,o),await L(w,{...t,table:o??void 0}),(0,n.notify)({id:`seated:${t.id}`,testID:'walkin-match-toast',timeoutMs:5e3,icon:'\u2713',title:`${t.name} seated \xb7 ${t.partySize} \xb7 ${o?(0,l.tableNumbers)(o):'table to assign'} (booking ${t.ref})`}),le(null),e()}finally{se(!1)}}},ne=(0,B.jsxs)(b.default,{style:{gap:8,flex:i?1:void 0,minWidth:0},children:[(0,B.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,B.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),R?(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>E(null)}):null]}),(0,B.jsx)(W,{use:I,value:R,onPick:e=>{I[e]&&!I[e].busy?ae(e):E(R===e?null:e)},big:i,dense:i,best:Q,bestSet:(0,u.bestTables)(_)}),(0,B.jsxs)(T.Muted,{children:["Tap a free table to seat them there",Q&&!R?` (suggested for ${$}: ${(0,l.tableNumbers)(Q)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(D)}`,maxWidth:i?1100:void 0,testID:"walkin-sheet",children:[(0,B.jsx)(T.Button,{label:`Seat walk-in \xb7 ${$} ${1===$?'person':'people'}${R?` \xb7 ${(0,l.tableNumbers)(R)}`:''}`,disabled:te,onPress:()=>{ae()},testID:"seat-walkin",style:{minHeight:52}}),i?(0,B.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[ee,ne]}):(0,B.jsxs)(B.Fragment,{children:[ee,ne]}),(0,B.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[V?(0,B.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:K,onChangeText:X,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,B.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,B.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]}),oe?(0,B.jsx)(H,{list:oe.list,busy:te,onYes:e=>{ie(e,oe.at)},onNo:()=>{const e=oe.at;le(null),ae(e,!0)},onClose:()=>le(null)}):null]})}function H({list:e,busy:t,onYes:s,onNo:o,onClose:a}){return(0,B.jsx)(T.Sheet,{visible:!0,onClose:a,title:"Booked party?",maxWidth:720,testID:"walkin-match",children:(0,B.jsxs)(b.default,{style:{gap:14},children:[e.map((e,o)=>(0,B.jsxs)(b.default,{testID:`walkin-match-${o}`,style:{gap:12,padding:16,borderRadius:16,borderWidth:2,borderColor:j.colours.gold,backgroundColor:'#15130F'},children:[(0,B.jsx)(b.default,{accessibilityRole:"header",accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:26,weight:"bold",colour:j.colours.goldLight,testID:"walkin-match-question",children:(0,z.walkInMatchQuestion)(e)})}),e.table?(0,B.jsxs)(T.T,{size:17,colour:j.colours.text,children:["Booked table ",(0,l.tableNumbers)(e.table)," \xb7 ",e.ref]}):(0,B.jsx)(T.T,{size:17,colour:j.colours.text,children:e.ref}),(0,B.jsx)(T.Button,{label:"Yes, seat booking",testID:"walkin-match-yes",disabled:t,accessibilityLabel:`Yes, seat ${e.name}'s booking, ${e.partySize} people`,onPress:()=>s(e),style:{minHeight:64}})]},e.id)),(0,B.jsx)(T.Button,{kind:"secondary",label:"No, new walk-in",testID:"walkin-match-no",disabled:t,onPress:o,style:{minHeight:64}})]})})}function _({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:i}=(0,p.useCtx)(15e3),n=F(o,i),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[n,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(i)),t,e.partySize,i,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,i.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),O=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&M(o,l),t()},L=C?(0,B.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,B.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,B.jsx)(b.default,{testID:"combine-short",children:(0,B.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,B.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,B.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>N(I)}),(0,B.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,B.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${R(e)}`,testID:"assign-table-sheet",footer:L,children:[v&&!C?(0,B.jsx)(b.default,{testID:"assign-suggested",children:(0,B.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,B.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,B.jsx)(W,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await N([e])}})]})}function Y(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${R(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function U({date:e,onClose:t,wide:n,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:O}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,L]=(0,r.useState)(ee.blocks),[W,A]=(0,r.useState)(!1),[E,H]=(0,r.useState)(''),[_,Y]=(0,r.useState)(2),[U,q]=(0,r.useState)(null),[Q,V]=(0,r.useState)(''),[G,K]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ie=(0,S.usePlan)(u),ne=(0,P.dogSetUp)(ie),re=!0===te.dog&&ne,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(_,c.settings.turnMins),be=F.filter(e=>e.date===M),he=e=>(0,k.freeTablesAt)(ie,be,_,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(R,u,M,e)}),ge=re&&U?he(U):[];(0,r.useEffect)(()=>{ae(null)},[re,U,_]);const pe=(0,y.bookingSlots)(c,ue,e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),_,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0),e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),me=(0,w.ukPhone)(G),[fe,ye]=(0,r.useState)(!1),ke=U?pe.find(e=>e.time===U):void 0,xe=ke&&ke.left<_?{left:Math.max(0,ke.left),time:ke.time}:null,je=ke&&null!=ke.partiesLeft&&ke.partiesLeft<1?{time:ke.time,cap:ke.partiesCap??0}:null,we=xe||je,Te=U?(0,v.blockAt)(R,u,M,U):void 0,Se='staff'!==z,ve=!!U&&!(0,D.dogTimeOk)(c,F,M,U,de),Ce=!oe.length&&E.trim().length>=2&&!!U&&(!we||fe)&&(0,o.validParty)(_)&&me.ok&&(0,w.emailOk)(X)&&(!Te||Se&&W)&&(!re||ge.length>0)&&!ve,De=te.wheelchair>0||te.stepFree;return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,B.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:_,audience:"staff"}),te.dog&&!ne?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,B.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(L(e),q(null),A(!1))}}),(0,B.jsxs)(T.Row,{gap:6,children:[(0,B.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,B.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,B.jsx)(T.Field,{label:"Name",value:E,onChangeText:H,placeholder:"e.g. Reid",testID:"nb-name"}),(0,B.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&G?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,B.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,B.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(T.T,{center:!0,children:"Covers"}),(0,B.jsx)(s.PartySizeInput,{value:_,onChange:e=>{Y(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!he(e.time).length||!(0,D.dogTimeOk)(c,F,M,e.time,de);return(0,B.jsx)(T.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,v.blockAt)(R,u,M,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:U===e.time,onPress:()=>{q(e.time),A(!1),ye(!1)}},e.time)})}),we?(0,B.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[xe?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(_,xe.left,xe.time)}):null,je?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overPartiesNote)(je.time,je.cap)}):null,(0,B.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&U?(0,B.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,B.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,B.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ie.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),ge.length?(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:ge.slice(0,10).map((e,t)=>(0,B.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${De&&(0,P.accessibleSetUp)(ie)&&!(0,P.isAccessible)(ie,e.table)?' \xb7 not step-free':''}`,selected:(le??ge[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",_," at ",U,". Try another time."]})]}):null,Te?(0,B.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,B.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",Te.from,"\u2013",Te.to,Te.reason?` (${Te.reason})`:'']}),Se?(0,B.jsx)(T.Chip,{label:W?'Manager override on':'Override and book anyway',selected:W,onPress:()=>A(e=>!e)}):(0,B.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,B.jsx)(b.default,{testID:"nb-closed",children:(0,B.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,B.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:_,date:M,time:U,today:(0,x.ymd)(h),bookings:F,audience:"staff",showTables:!1!==c.settings.tableRequests}),De&&!(0,P.accessibleSetUp)(ie)?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,B.jsx)(T.Field,{label:"Notes (optional)",value:Q,onChangeText:V,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,i.depositDue)((0,i.depositOf)(c.settings),_)?(0,B.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,i.depositDue)((0,i.depositOf)(c.settings),_))," (",(0,a.gbp)((0,i.depositOf)(c.settings).perPersonPence)," per person for ",(0,i.depositOf)(c.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,B.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),ve?(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",U,". Try another time: dogs are very welcome then."]}):null,(0,B.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Ce,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||ge.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:_,date:M,time:U,notes:Q.trim(),security:(0,i.depositDue)((0,i.depositOf)(c.settings),_)?'deposit':'none',depositPaid:0,...(0,i.depositDue)((0,i.depositOf)(c.settings),_)?{depositDue:(0,i.depositDue)((0,i.depositOf)(c.settings),_),depositPolicy:(0,i.depositWords)((0,i.depositOf)(c.settings),_,c.name).join(' '),depositRefundable:(0,i.depositOf)(c.settings).refundable,depositCutoffHours:(0,i.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===U)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??ge[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,O)).catch(()=>{}),d?.({date:M,time:U,name:E.trim()}),t()}})]})}},1119,[827,1120,1121,860,867,14,1122,34,859,402,102,872,1084,874,1123,1100,858,821,864,794,1025,1022,1124,1125,1130,1102,1096,1131,25]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,$]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{$(String(e))},[e]);const w=e=>p((0,s.clampParty)(e,b,y)),I=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>w(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:c.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(u.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:c.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?I(-10,'\u221210',"10 fewer people"):null,I(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{$(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&w((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);$(String(e)),w(e)},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:c.colours.border,color:c.colours.text,backgroundColor:c.colours.surface,textAlign:'center',fontSize:20,fontFamily:c.fonts.semibold}}),I(1,'+','One more person'),y-b>=20?I(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),c=r(_d[5]),u=r(_d[6]),d=r(_d[7])},1120,[34,402,412,102,1121,821,794,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return 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.`},1121,[]); @@ -1210,12 +1210,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}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"fitLabel",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"BIG_LABEL_MIN",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"OCC_LABEL_MIN",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"occupiedLabel",{enumerable:!0,get:function(){return S}}),_e.areaBounds=I,_e.minReadableScale=function(e,t){return Math.max(0,...e.tables.filter(e=>e.areaId===t).map(e=>{const t='round'===e.shape?.85:1,o=(7.4399999999999995*Math.max(1,(0,g.tableNumber)(e).length)+6)/(e.w*t),n=22/Math.min(e.w,e.h);return Math.max(o,n)}))},_e.seatSpots=R,_e.FixtureShape=T,_e.FloorCanvas=function(e){const[$,L]=(0,r.useState)({w:0,h:0}),z=e.plan.tables.filter(t=>t.areaId===e.areaId),E=e.crop&&z.length?I(e.plan,e.areaId):{x:0,y:0,w:l.PLAN_W,h:l.PLAN_H},F='live'===e.mode?[...new Map(z.flatMap(t=>{const o=e.view?.[t.name];if(!o?.group||o.group.length<2)return[];const n=[...o.group].sort().join('+');return[[n,{key:n,members:o.group,view:o}]]})).values()]:[],O=28*F.length,D={x:E.x,y:E.y,r:E.x+E.w,b:E.y+E.h},_=$.w?'width'===e.fit?Math.min($.w/l.PLAN_W,e.maxH?e.maxH/l.PLAN_H:9):Math.min($.w/E.w,Math.max(1,$.h-O)/E.h):0,B=e.fill&&'contain'===e.fit&&_>0&&$.h>0,N=B?($.w/_-E.w)/2:0,P=B?(($.h-O)/_-E.h)/2:0,W={x:D.x-N,y:D.y-P,r:D.r+N,b:D.b+P},H=W.r-W.x,G=W.b-W.y,[Y,X]=(0,r.useState)(null),U=(0,r.useRef)(null),[q,J]=(0,r.useState)(null),K=(0,r.useRef)(null);K.current=q,i.default.useEffect(()=>{if(!q)return;const e=setTimeout(()=>J(null),n.ARM_MS);return()=>clearTimeout(e)},[q]);const V='live'===e.mode&&!!e.onDrop,Q=e=>!V||(0,n.isArmed)(K.current,e.id,Date.now()),Z=t=>e.plan.sections.find(e=>e.id===t.sectionId),ee=t=>e.plan.joins.find(e=>e.tables.includes(t.name)),te=i.default.useMemo(()=>(0,g.numberClashes)(e.plan.tables).sameArea,[e.plan.tables]),oe=(t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>Q(t),onResponderTerminationRequest:()=>!Q(t),onResponderGrant:e=>{U.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,id:t.id,kind:o}},onResponderMove:n=>{const r=U.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,a=n.nativeEvent.pageY-r.y;Math.abs(i)+Math.abs(a)<6&&!Y||Q(t)&&('live'!==e.mode||e.onDrop&&e.view&&['seated','mains','dessert','bill'].includes(e.view[t.name]?.status)&&e.view[t.name]?.booking)&&X({id:t.id,dx:i,dy:a,kind:o})},onResponderRelease:r=>{const i=U.current;U.current=null;const s=r.nativeEvent.pageX-(i?.x??0),u=r.nativeEvent.pageY-(i?.y??0);if(X(null),Math.abs(s)+Math.abs(u)<6||!_){if('move'===o){if(V){const e=(0,n.releaseOn)(K.current,t.id,!1,Date.now());if(J(e.arm),'select'===e.action)try{a.default.announceForAccessibility(n.SELECTED_A11Y)}catch{}}e.onTap?.(t)}return}if(V){const e=(0,n.releaseOn)(K.current,t.id,!0,Date.now());if(J(e.arm),'move'!==e.action)return}const h=s/_,c=u/_;if('edit'===e.mode&&'move'===o)e.onMove?.(t,w(v(t.x+h,e.snapOn),0,l.PLAN_W-t.w),w(v(t.y+c,e.snapOn),0,l.PLAN_H-t.h));else if('edit'===e.mode&&'resize'===o)e.onResize?.(t,w(v(t.w+h,e.snapOn),50,400),w(v(t.h+c,e.snapOn),50,300));else if('live'===e.mode&&e.onDrop){const o=t.x+t.w/2+h,n=t.y+t.h/2+c,r=z.find(e=>e.id!==t.id&&o>=e.x-10&&o<=e.x+e.w+10&&n>=e.y-10&&n<=e.y+e.h+10);r&&e.onDrop(t,r)}}}),ne=e=>e*_,re=e=>ne(e-W.x),ie=e=>ne(e-W.y),ae='width'===e.fit?l.PLAN_H*_+O||200:void 0;return(0,x.jsxs)(s.default,{testID:"floor-canvas",onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),style:[{width:'100%',borderRadius:16,overflow:'hidden'},'contain'===e.fit?{flex:1}:{height:ae}],children:[F.map(e=>{const o=z.filter(t=>e.members.includes(t.name)),n=o.length?(Math.min(...o.map(e=>e.x))+Math.max(...o.map(e=>e.x+e.w)))/2:W.x+H/2,r=e.view.booking?.time??e.view.next?.time,i=`${A(e.members)}${r?` \xb7 ${'seated'===e.view.status?'Seated':'Booked'} ${r}`:''}`,a=Math.min(Math.max(0,$.w-8),260);return(0,x.jsx)(s.default,{testID:`joined-label-${e.key}`,accessible:!0,accessibilityLabel:`Joined tables ${i}`,pointerEvents:"none",style:{height:28,width:a,marginLeft:w(ne(n-W.x)-a/2,4,Math.max(4,$.w-a-4)),alignItems:'center',justifyContent:'center',overflow:'hidden',borderRadius:8,borderWidth:1,borderColor:h.colours.gold,backgroundColor:(0,t.soutersSurface)('#0B0B0B')},children:(0,x.jsx)(c.T,{size:16,weight:"bold",colour:h.colours.goldLight,center:!0,numberOfLines:1,children:i})},e.key)}),_?(0,x.jsx)(s.default,{style:{width:ne(H),height:ne(G),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0F0E0C'),borderRadius:16,borderWidth:1,borderColor:h.colours.border,overflow:'hidden'},children:(0,x.jsxs)(s.default,{style:{position:'absolute',left:0,top:0,width:ne(H),height:ne(G)},children:['edit'===e.mode?Array.from({length:l.PLAN_W/(2*l.GRID)},(e,o)=>(0,x.jsx)(s.default,{style:{position:'absolute',left:re(o*l.GRID*2),top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`v${o}`)):null,'edit'===e.mode?Array.from({length:l.PLAN_H/(2*l.GRID)},(e,o)=>(0,x.jsx)(s.default,{style:{position:'absolute',top:ie(o*l.GRID*2),left:0,right:0,height:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`h${o}`)):null,(e.plan.fixtures??[]).filter(t=>t.areaId===e.areaId).map(t=>(0,x.jsx)(T,{f:{...t,x:t.x-W.x,y:t.y-W.y},S:ne,live:'live'===e.mode},t.id)),e.plan.joins.map(e=>{const t=z.filter(t=>e.tables.includes(t.name));if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,x.jsx)(s.default,{testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:re((r+a)/2-u/2),top:ie((i+l)/2)-3,width:ne(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.55)',transform:[{rotate:`${h}rad`}]}},e.id)}),z.map(n=>{const r=e.view?.[n.name],a=r?u.STATUS[r.status]:u.STATUS.free,v=Y?.id===n.id,w=v&&'resize'===Y.kind?Math.max(50,n.w+Y.dx/_):n.w,$=v&&'resize'===Y.kind?Math.max(50,n.h+Y.dy/_):n.h,I=v&&'move'===Y.kind?n.x+Y.dx/_:n.x,T=v&&'move'===Y.kind?n.y+Y.dy/_:n.y,A=e.selected===n.id||e.highlight?.includes(n.name)||q?.id===n.id,L=Z(n),z='edit'===e.mode?'#2A2419':a.colour,E='edit'===e.mode?h.colours.text:a.fg,F='round'===n.shape?ne(Math.min(w,$))/2:ne(10),O='live'===e.mode?(0,g.liveTableLabel)(n,te):(0,l.tableLabel)(n),D=ne(Math.min(w,$))<64,B=r?r.covers>0?r.covers:'soon'===r.status?(r.next??r.dayBookings?.[0])?.partySize??0:0:0,N=e.big&&'live'===e.mode&&r&&!(r.group&&r.group.length>1)&&k.has(r.status)&&B>0,P=N?S(O,B):O,W=M(e.big?Math.max(13,Math.min(34,ne(Math.min(w,$))/3)):Math.max(11,Math.min(22,ne(Math.min(w,$))/4)),P,ne(w)*('round'===n.shape?.85:1),N?C:e.big?j:9),H=ne(w)*('round'===n.shape?.85:1),G=e=>e.length*W*.62+6,X=N&&G(P)>H,U=X&&Math.max(G(O),G(`(${B})`))<=H&&1.2*W*2<=ne($)-4,J=X&&!U,K=Math.max(e.big?11:12,Math.round(.62*W)),V=(ne($)-6-1.4*W)/(1.4*K),Q=V>=2&&ne(w)>=5*K?2:V>=1?1:0,ae=r?.booking&&void 0!==r.seatedMins?r.booking.time:void 0,se='soon'===r?.status?r.next?.time??r.dayBookings?.[0]?.time:void 0,le='edit'===e.mode?`Table ${(0,o.tableNumbers)(O)}, ${(0,l.shapeLabel)(n.shape).toLowerCase()}, ${n.minSeats}\u2013${n.maxSeats} seats${n.online?', bookable online':''}`:'soon'===r?.status?`Table ${(0,o.tableNumbers)(O)}, booked later${se?`, ${se}`:''}${r.group?`, combined with ${r.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`:`Table ${(0,o.tableNumbers)(O)}, ${a.label}${void 0!==r?.seatedMins?`, seated ${r.seatedMins} min`:''}${r?.covers?`, ${r.covers} Covers`:''}${r?.dayBookings?.length?`, booked: ${r.dayBookings.map(e=>`${e.time}, ${e.partySize} Covers`).join('; ')}`:''}${r?.group?`, combined with ${r.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`,de=void 0!==r?.seatedMins&&r.booking?Math.min(1.2,r.seatedMins/(r.booking.durationMins??(0,u.turnFor)(r.booking.partySize,e.turnBase))):null;return(0,x.jsxs)(i.default.Fragment,{children:[R({...n,w:w,h:$}).map((t,o)=>(0,x.jsx)(s.default,{pointerEvents:"none",style:[{position:'absolute',left:re(I+t.x)-Math.max(4,ne(8)),top:ie(T+t.y)-Math.max(4,ne(8)),width:Math.max(8,ne(16)),height:Math.max(8,ne(16)),borderRadius:99,backgroundColor:'edit'===e.mode?'#5A4C33':'rgba(255,255,255,0.16)',borderWidth:1,borderColor:'edit'===e.mode?h.colours.gold:'rgba(255,255,255,0.25)'},y()]},o)),'live'===e.mode&&(ne(w)<44||ne($)<44)?(0,x.jsx)(s.default,{accessible:!1,importantForAccessibility:"no-hide-descendants",'aria-hidden':!0,...oe(n,'move'),style:{position:'absolute',left:re(I+w/2)-Math.max(44,ne(w))/2,top:ie(T+$/2)-Math.max(44,ne($))/2,width:Math.max(44,ne(w)),height:Math.max(44,ne($)),zIndex:2}}):null,(0,x.jsxs)(s.default,{testID:`table-${n.name}`,accessibilityRole:"button",accessibilityLabel:le,onAccessibilityTap:()=>e.onTap?.(n),onKeyDown:t=>{'Enter'!==t?.key&&' '!==t?.key||e.onTap?.(n)},tabIndex:0,...oe(n,'move'),style:[{position:'absolute',left:re(I),top:ie(T),width:ne(w),height:ne($),borderRadius:F,backgroundColor:z,alignItems:'center',justifyContent:'center',padding:2,overflow:J?'visible':'hidden',borderWidth:A?3:e.sectionColours&&L?2.5:1.5,borderColor:A?'#FFFFFF':e.sectionColours&&L?(0,h.brandColour)(L.colour):'edit'===e.mode?h.colours.gold:'rgba(0,0,0,0.35)',transform:[{scale:v?1.06:1}],zIndex:v?50:J?4:3,opacity:v&&'live'===e.mode?.85:1,shadowColor:'#000',shadowOpacity:v?.6:.3,shadowRadius:v?14:6,cursor:'edit'===e.mode?'grab':'pointer',touchAction:'none'},v?null:y()],children:[(0,x.jsxs)(s.default,{style:J?{alignItems:'center',justifyContent:'center',overflow:'visible'}:{alignItems:'center',justifyContent:'center',maxWidth:'100%',maxHeight:'100%',overflow:'hidden'},pointerEvents:"none",children:[N?(0,x.jsx)(c.T,{testID:`table-label-${n.name}`,style:U?{flexShrink:0,lineHeight:Math.round(1.2*W),maxWidth:Math.max(20,H-4)}:J?{...p,whiteSpace:'nowrap',textShadowColor:'rgba(0,0,0,0.9)',textShadowRadius:3,textShadowOffset:{width:0,height:0}}:p,weight:"bold",size:W,colour:J?'#FFFFFF':E,center:!0,numberOfLines:U?2:1,children:P}):(0,x.jsx)(c.T,{style:p,weight:"bold",size:W,colour:E,center:!0,numberOfLines:1,children:O}),'live'===e.mode&&'blocked'===r?.status?(0,x.jsx)(c.T,{style:f,size:Math.max(10,Math.round(.5*W)),weight:"semibold",colour:E,center:!0,numberOfLines:1,children:"Blocked"}):null,N||'live'===e.mode&&r?.group&&r.group.length>1?null:e.big&&'live'===e.mode&&r&&1===Q?'free'!==r.status&&'soon'!==r.status&&(r.covers||ae)?(0,x.jsx)(c.T,{style:f,size:K,weight:"bold",colour:E,center:!0,numberOfLines:1,children:[r.covers?`${r.covers}`:'',ae??''].filter(Boolean).join(' \xb7 ')}):null:e.big&&'live'===e.mode&&r&&2===Q?(0,x.jsxs)(x.Fragment,{children:['soon'!==r.status&&r.covers?(0,x.jsxs)(c.T,{style:f,size:K,weight:"semibold",colour:E,center:!0,children:[r.covers," ",1===r.covers?'Cover':'Covers']}):'free'!==r.status||D?null:(0,x.jsxs)(c.T,{style:f,size:K,colour:E,center:!0,children:[n.minSeats,"\u2013",n.maxSeats]}),'free'!==r.status&&'soon'!==r.status&&ae?(0,x.jsx)(c.T,{style:f,size:K,weight:"bold",colour:E,center:!0,children:ae}):'dirty'===r.status?(0,x.jsx)(c.T,{style:f,size:K,colour:E,center:!0,children:"Clear"}):null]}):e.big&&'live'===e.mode?null:'edit'===e.mode?D?null:(0,x.jsxs)(c.T,{style:f,size:11,colour:h.colours.muted,center:!0,children:[n.minSeats,"\u2013",n.maxSeats,n.online?' \xb7 online':'']}):r?(0,x.jsxs)(x.Fragment,{children:['free'!==r.status||D?null:(0,x.jsxs)(c.T,{style:f,size:11,colour:E,center:!0,children:[n.minSeats,"\u2013",n.maxSeats," seats"]}),void 0!==r.seatedMins?(0,x.jsxs)(c.T,{style:f,size:12,weight:"semibold",colour:E,center:!0,children:[r.seatedMins,"m \xb7 ",r.covers,"\ud83d\udc65"]}):r.orderOnly?(0,x.jsx)(c.T,{style:f,size:11,colour:E,center:!0,children:"Open order"}):null,'dirty'!==r.status||D?null:(0,x.jsx)(c.T,{style:f,size:11,colour:E,center:!0,children:"Clear"}),!D||r.allergy||r.vip?(0,x.jsxs)(c.T,{style:f,size:11,colour:E,center:!0,children:[r.allergy?'\u26a0':'',r.vip?'VIP'===r.vip?'\u2605':'\u2665':'',r.occasion?u.OCCASION_ICON[r.occasion]:'',r.note?'\u270e':'']}):null]}):null]}),null,'live'===e.mode&&r&&!D&&(r.booking??r.next)&&(0,b.needsIcons)(r.booking??r.next).replace('\u26a0\ufe0f','').trim()?(0,x.jsx)(s.default,{pointerEvents:"none",testID:`needs-${n.name}`,style:{position:'absolute',bottom:e.big?-Math.max(9,.55*K):2,right:e.big?-6:4,backgroundColor:(0,t.soutersSurface)('rgba(11,11,11,0.85)'),borderRadius:8,paddingHorizontal:4,borderWidth:1,borderColor:'rgba(255,255,255,0.15)'},children:(0,x.jsx)(c.T,{size:e.big?Math.max(11,.75*K):10,children:(0,b.needsIcons)(r.booking??r.next).replace('\u26a0\ufe0f','').trim()})}):null,L&&'live'===e.mode&&e.sectionColours&&!D&&!e.big?(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:3,right:6,backgroundColor:(0,h.brandColour)(L.colour),borderRadius:6,paddingHorizontal:3},children:(0,x.jsx)(c.T,{size:9,weight:"bold",colour:"#0B0B0B",children:L.server})}):null,null===de||D?null:(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:'15%',right:'15%',bottom:5,height:4,borderRadius:2,backgroundColor:'rgba(0,0,0,0.25)'},children:(0,x.jsx)(s.default,{style:{width:`${Math.min(100,100*de)}%`,height:4,borderRadius:2,backgroundColor:de>=1?'#B3261E':'rgba(0,0,0,0.6)'}})}),ee(n)&&'edit'===e.mode?(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',bottom:2,left:4},children:(0,x.jsx)(c.T,{size:10,colour:h.colours.gold,children:"\u26d3"})}):null]}),'edit'===e.mode&&e.selected===n.id?(0,x.jsx)(s.default,{testID:"resize-handle",accessibilityLabel:"Resize table",...oe(n,'resize'),style:{position:'absolute',left:re(I+w)-14,top:ie(T+$)-14,width:28,height:28,borderRadius:14,backgroundColor:h.colours.gold,borderWidth:2,borderColor:'#fff',zIndex:60,cursor:'nwse-resize',touchAction:'none'}}):null]},n.id)}),0===z.length?(0,x.jsx)(s.default,{style:{position:'absolute',left:0,right:0,top:'45%'},children:(0,x.jsxs)(c.T,{center:!0,colour:h.colours.muted,children:["No tables in this area yet",'edit'===e.mode?' \u2014 add some in Tables':'',"."]})}):null]})}):null]})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),i=e(r),a=e(_r(d[4]));_r(d[5]);var s=e(_r(d[6])),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),c=_r(d[10]),b=_r(d[11]),g=_r(d[12]),x=_r(d[13]);const f={flexShrink:0},p={flexShrink:0,maxWidth:'none'},y=(e=250)=>({transitionProperty:'background-color, border-color, transform, left, top, width, height',transitionDuration:`${e}ms`}),v=(e,t=!0)=>t?Math.round(e/l.GRID)*l.GRID:Math.round(e),w=(e,t,o)=>Math.max(t,Math.min(o,e)),M=(e,t,o,n=9)=>Math.max(n,Math.min(e,(o-6)/(.62*Math.max(1,t.length)))),j=12,C=11,k=new Set(['soon','seated','mains','dessert','bill']),S=(e,t)=>`${e} (${t})`,$=46;function I(e,t){const o=e.tables.filter(e=>e.areaId===t);if(!o.length)return{x:0,y:0,w:l.PLAN_W,h:l.PLAN_H};const n=Math.max(0,Math.min(...o.map(e=>e.x))-$),r=Math.max(0,Math.min(...o.map(e=>e.y))-$);return{x:n,y:r,w:Math.min(l.PLAN_W,Math.max(...o.map(e=>e.x+e.w))+$)-n,h:Math.min(l.PLAN_H,Math.max(...o.map(e=>e.y+e.h))+$)-r}}function R(e){const t=Math.max(1,e.maxSeats),o=[];if('round'===e.shape){const n=e.w/2+9.6,r=e.h/2+9.6;for(let i=0;ie.w,r=Math.ceil(t/2),i=t-r;if(n){for(let t=0;te.w,a=n?{borderColor:'#FFFFFF',borderWidth:2}:null;return'bar'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#2A2216':'#3A2E1C',borderRadius:8,borderWidth:1.5,borderColor:o?'#5A4A30':h.colours.gold},a],children:(0,x.jsx)(c.T,{size:Math.max(9,Math.min(14,t(e.h)/2.4)),weight:"semibold",colour:h.colours.goldLight,children:"BAR"})}):'wall'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#3A3631':'#5C574F',borderRadius:2},a]}):'window'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:'rgba(226,196,137,0.16)',borderColor:'rgba(226,196,137,0.6)',borderWidth:1,borderRadius:2},a],children:!o&&t(i?e.h:e.w)>60?(0,x.jsx)(c.T,{size:9,colour:"#BFDDFF",style:i?{transform:[{rotate:'90deg'}]}:void 0,children:"WINDOW"}):null}):(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{borderColor:o?'#7A6440':h.colours.gold,borderWidth:1.5,borderStyle:'dashed',borderRadius:3,backgroundColor:'rgba(207,164,95,0.08)'},a],children:t(i?e.h:e.w)>40?(0,x.jsx)(c.T,{size:9,colour:h.colours.goldLight,style:i?{transform:[{rotate:'90deg'}]}:void 0,children:"DOOR"}):null})}function A(e){return(0,l.tablesLabel)(e.join('+')).replace(/^Tables? /,'').replace(/ \+ /g,'+')}},1127,[828,860,1128,34,281,236,102,1025,1100,821,794,1102,859,25]); __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])},1129,[34,402,102,874,861,863,821,794,25]); -__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 a}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return o}}),_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 d}}),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 l}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return f}}),_e.changedFields=P,_e.historyText=O,_e.editPatch=function(t,a,s,o=(new Date).toISOString()){const n=P(t,a);if(!n.length)return{};const d={};for(const c of n)switch(c){case'partySize':d.partySize=(0,e.clampParty)(Number(a.partySize));break;case'phone':case'email':case'table':d[c]=String(a[c]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[c]=String(a[c]??'').trim();break;case'area':d.area=(a.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(a.dogs??0)),d.dog=Number(a.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(a.highChairs??0))||void 0;break;case'wheelchair':d.access={...t.access??{},wheelchair:Math.max(0,Number(a.wheelchair??0))||void 0};break;case'occasion':d.occasion=a.occasion||void 0;break;case'allergies':d.allergies=[...a.allergies??[]],d.allergyNone=!!a.allergyNone&&!(a.allergies??[]).length,d.allergyNote=(a.allergyNote??'').trim()||void 0,(a.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(a.vegan??0)||void 0,vegetarian:Number(a.vegetarian??0)||void 0};break;case'deposit':if(!a.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(a.depositDue??0))),a.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(a.depositDate??'')?a.depositDate:o.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(a.depositAmount??0))),depositPaidBy:s.by.slice(0,80),depositPaidAt:e===o.slice(0,10)?o:`${e}T12:00:00.000Z`,depositMethod:a.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=a.status,'seated'!==a.status||t.seatedAt||(d.seatedAt=o),'finished'!==a.status||t.finishedAt||(d.finishedAt=o),'confirmed'!==a.status&&'pending'!==a.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=a.source||void 0;break;case'tags':d.tags=[...(t.tags??[]).filter(e=>!p.includes(e)),...a.tags??[]];break;case'duration':d.durationMins=Number(a.duration??0)>=15?Number(a.duration):void 0}n.includes('table')&&(d.tableSetHere=!0);const c=t;return d.locallyEdited=!0,d.editedFields=[...new Set([...c.editedFields??[],...n])],d.editLog=[...c.editLog??[],{at:o,by:s.by.slice(0,80),app:s.app,fields:n,text:O(t,a,n,s.by.slice(0,80),o)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>b[e]??e).join(', ')} changed by ${e.by} ${N(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,a,s,o,n=90,d){const c=[];if(!P(e,a).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return c;const u={...e,date:a.date,time:a.time,partySize:a.partySize,...Number(a.duration??0)>=15?{durationMins:Number(a.duration)}:{}};if(a.table){const e=(0,t.tableOverlaps)(u,a.table,s.filter(e=>e.date===a.date),n);if(e.length&&c.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),d){const e=a.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>d.tables.find(t=>t.name===e)).filter(Boolean),t=e.reduce((e,t)=>e+t.maxSeats,0);e.length&&td.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(a.dogs??0)>0&&s.length&&c.push(`Dogs aren\u2019t allowed in ${s[0].name}. Pick a dog-friendly table.`)}}o&&c.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return c},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return k}}),_e.bookingExtras=function(e){const t=e,a=e.dogs??(e.dog?1:0),s=[];a&&s.push(w(a,'dog','dogs'));t.highChairs&&s.push(w(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&s.push(w(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&s.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&s.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&s.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&s.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&s.push(`Deposit by ${t.depositMethod}`);return s.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]);const a='For example: birthday, high chair, dog, window seat',s='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.',o=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')},d=['date','time','partySize','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration'],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'}],l=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],h=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],p=['VIP','Regular'],b={date:'date',time:'time',partySize:'covers',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'},f=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:(a=e.depositPaidAt,a?a.slice(0,10):''),depositDue:e.depositDue??0,status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>p.includes(e)).sort(),duration:e.durationMins??0};var a},y=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),$=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'']:[!1]);function v(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return y(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return $(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':return Number(t[e]??0);default:return String(t[e]??'').trim()}}function P(e,t){const a=f(e);return d.filter(e=>v(e,a)!==v(e,t))}const S=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,N=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},w=(e,t,a)=>`${e} ${1===e?t:a}`;function O(e,t,a,s,o){const n=f(e),d=[];for(const e of[...a].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))'deposit'===e?t.depositOn?t.depositPaid&&!n.depositPaid?d.push(`deposit marked paid (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&n.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${S(Number(t.depositDue??0))}`):d.push('deposit taken off'):'dogs'===e?d.push(!n.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?w(Number(t.dogs),'dog','dogs'):'no dog now'):'highChairs'===e?d.push(t.highChairs?w(Number(t.highChairs),'high chair','high chairs'):'no high chair now'):'wheelchair'===e?d.push(t.wheelchair?w(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now'):'partySize'===e?d.push(`covers ${n.partySize} to ${t.partySize}`):'time'===e?d.push(`time ${n.time} to ${t.time}`):'date'===e?d.push(`date ${n.date} to ${t.date}`):'table'===e?d.push(t.table?`table ${t.table}`:'table taken off'):'status'===e?d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`):'occasion'===e?d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off'):'area'===e?d.push(t.area?`area ${t.area}`:'any area'):'duration'===e?d.push(t.duration?`table time ${t.duration} min`:'table time as usual'):d.push(`${b[e]} changed`);const c=d.join(', ');return`${c.charAt(0).toUpperCase()}${c.slice(1)} by ${s} ${N(o)}`}const k=e=>e.map(e=>b[e]).join(', ')},1130,[1121,1115]); +__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 n}}),_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 d}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return l}}),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}}),_e.changedFields=N,_e.historyText=k,_e.editPatch=function(t,a,s,o=(new Date).toISOString()){const n=N(t,a);if(!n.length)return{};const d={};for(const c of n)switch(c){case'partySize':d.partySize=(0,e.clampParty)(Number(a.partySize));break;case'phone':case'email':case'table':d[c]=String(a[c]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[c]=String(a[c]??'').trim();break;case'area':d.area=(a.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(a.dogs??0)),d.dog=Number(a.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(a.highChairs??0))||void 0;break;case'wheelchair':d.access={...t.access??{},wheelchair:Math.max(0,Number(a.wheelchair??0))||void 0};break;case'occasion':d.occasion=a.occasion||void 0;break;case'allergies':d.allergies=[...a.allergies??[]],d.allergyNone=!!a.allergyNone&&!(a.allergies??[]).length,d.allergyNote=(a.allergyNote??'').trim()||void 0,(a.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(a.vegan??0)||void 0,vegetarian:Number(a.vegetarian??0)||void 0};break;case'deposit':if(!a.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(a.depositDue??0))),a.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(a.depositDate??'')?a.depositDate:o.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(a.depositAmount??0))),depositPaidBy:s.by.slice(0,80),depositPaidAt:e===o.slice(0,10)?o:`${e}T12:00:00.000Z`,depositMethod:a.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=a.status,'seated'!==a.status||t.seatedAt||(d.seatedAt=o),'finished'!==a.status||t.finishedAt||(d.finishedAt=o),'confirmed'!==a.status&&'pending'!==a.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=a.source||void 0;break;case'tags':d.tags=[...(t.tags??[]).filter(e=>!b.includes(e)),...a.tags??[]];break;case'duration':d.durationMins=Number(a.duration??0)>=15?Number(a.duration):void 0}n.includes('table')&&(d.tableSetHere=!0);const c=t;return d.locallyEdited=!0,d.editedFields=[...new Set([...c.editedFields??[],...n])],d.editLog=[...c.editLog??[],{at:o,by:s.by.slice(0,80),app:s.app,fields:n,text:k(t,a,n,s.by.slice(0,80),o)}].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} ${w(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,s,o,n,d=90,c){const u=[];if(!N(e,s).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return u;const l={...e,date:s.date,time:s.time,partySize:s.partySize,...Number(s.duration??0)>=15?{durationMins:Number(s.duration)}:{}};if(s.table){const e=(0,t.tableOverlaps)(l,s.table,o.filter(e=>e.date===s.date),d);if(e.length&&u.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),c){const e=s.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>c.tables.find(t=>t.name===e)).filter(Boolean),t=e.reduce((e,t)=>e+t.maxSeats,0),o=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),t,s.partySize):null;o&&u.push(o);const n=e.map(e=>c.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(s.dogs??0)>0&&n.length&&u.push(`Dogs aren\u2019t allowed in ${n[0].name}. Pick a dog-friendly table.`)}}n&&u.push(`Bookings are paused ${n.from} to ${n.to}${n.reason?` (${n.reason})`:''}.`);return u},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return M}}),_e.bookingExtras=function(e){const t=e,a=e.dogs??(e.dog?1:0),s=[];a&&s.push(O(a,'dog','dogs'));t.highChairs&&s.push(O(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&s.push(O(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&s.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&s.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&s.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&s.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&s.push(`Deposit by ${t.depositMethod}`);return s.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),a=r(_d[2]);const s='For example: birthday, high chair, dog, window seat',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.',n=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const d=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},c=['date','time','partySize','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration'],u=['card','cash','bank transfer','website','other'],l=[{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',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'},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:(a=e.depositPaidAt,a?a.slice(0,10):''),depositDue:e.depositDue??0,status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0};var a},v=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),$=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'']:[!1]);function P(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return v(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return $(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':return Number(t[e]??0);default:return String(t[e]??'').trim()}}function N(e,t){const a=y(e);return c.filter(e=>P(e,a)!==P(e,t))}const S=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},O=(e,t,a)=>`${e} ${1===e?t:a}`;function k(e,t,a,s,o){const n=y(e),d=[];for(const e of[...a].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))'deposit'===e?t.depositOn?t.depositPaid&&!n.depositPaid?d.push(`deposit marked paid (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&n.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${S(Number(t.depositDue??0))}`):d.push('deposit taken off'):'dogs'===e?d.push(!n.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?O(Number(t.dogs),'dog','dogs'):'no dog now'):'highChairs'===e?d.push(t.highChairs?O(Number(t.highChairs),'high chair','high chairs'):'no high chair now'):'wheelchair'===e?d.push(t.wheelchair?O(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now'):'partySize'===e?d.push(`covers ${n.partySize} to ${t.partySize}`):'time'===e?d.push(`time ${n.time} to ${t.time}`):'date'===e?d.push(`date ${n.date} to ${t.date}`):'table'===e?d.push(t.table?`table ${t.table}`:'table taken off'):'status'===e?d.push(`status ${l.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`):'occasion'===e?d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off'):'area'===e?d.push(t.area?`area ${t.area}`:'any area'):'duration'===e?d.push(t.duration?`table time ${t.duration} min`:'table time as usual'):d.push(`${f[e]} changed`);const c=d.join(', ');return`${c.charAt(0).toUpperCase()}${c.slice(1)} by ${s} ${w(o)}`}const M=e=>e.map(e=>f[e]).join(', ')},1130,[1121,1115,1118]); __d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WALKIN_MATCH_MINS",{enumerable:!0,get:function(){return t}}),e.bookingsNearWalkIn=function(s,o,u,d=3){const c=n(o);return s.filter(t=>t.date===c&&!t.walkIn&&('confirmed'===t.status||'pending'===t.status)&&/^\d{2}:\d{2}/.test(t.time||'')).map(t=>({b:t,d:Math.abs((new Date(`${t.date}T${t.time.slice(0,5)}:00`).getTime()-o.getTime())/6e4)})).filter(n=>n.d<=t).sort((t,n)=>(u?Number(n.b.partySize===u)-Number(t.b.partySize===u):0)||t.d-n.d).slice(0,d).map(t=>t.b)},e.walkInMatchQuestion=function(t){return`Is this ${t.name}, ${t.time.slice(0,5)}, ${t.partySize} ${1===t.partySize?'person':'people'}?`};const t=45,n=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1131,[]); __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 y}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return h}}),_e.cancelWalkInWords=x,_e.reinstateWalkInWords=p,_e.cancelWalkInNow=$,_e.reinstateWalkInNow=I,_e.CancelWalkInButton=function({rid:e,b:t,onDone:l,small:s,big:o}){const[c,u]=(0,n.useState)(!1);return y(t)?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(f.Button,{kind:"secondary",small:s,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>u(!0),style:o?{minHeight:64}:s?{minHeight:44}:w}),c?(0,k.jsx)(j,{rid:e,b:t,onClose:()=>u(!1),onDone:l}):null]}):null},_e.CancelWalkInConfirm=j,_e.ReinstateWalkInButton=function({rid:e,b:t,today:l,onDone:o,small:c}){const[u,y]=(0,n.useState)(!1);if(!h(t,l))return null;const x=p(t);if(!u)return(0,k.jsx)(f.Button,{kind:"ghost",small:c,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>y(!0),style:c?{minHeight:44}:w});return(0,k.jsxs)(f.Sheet,{visible:!0,onClose:()=>y(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,k.jsx)(s.default,{accessible:!0,accessibilityLabel:x,children:(0,k.jsx)(f.T,{size:18,colour:b.colours.text,children:x})}),(0,k.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(f.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[w,{flexGrow:1}],onPress:async()=>{await I(e,t),y(!1),o?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,k.jsx)(f.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>y(!1),style:w})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=(e=l)&&e.__esModule?e:{default:e},o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]);const w={minHeight:56},y=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),h=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function x(e){const t=(0,c.tablesOf)(e.table),n=(0,u.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 p(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 $(e,n){await o.repo.bookings.setStatus(n.id,'cancelled'),await o.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,c.tablesOf)(n.table).forEach(t=>c.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function I(e,t){await o.repo.bookings.setStatus(t.id,'seated'),(0,c.tablesOf)(t.table).forEach(t=>c.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function j({rid:e,b:t,onClose:n,onDone:l}){const o=x(t);return(0,k.jsxs)(f.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,k.jsx)(s.default,{accessible:!0,accessibilityLabel:o,children:(0,k.jsx)(f.T,{size:18,colour:b.colours.text,children:o})}),(0,k.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(f.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[w,{flexGrow:1}],onPress:async()=>{await $(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,c.tablesOf)(t.table).length?` ${(0,u.tablesWords)((0,c.tablesOf)(t.table))} free.`:''}`)}}),(0,k.jsx)(f.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:w})]})]})}},1132,[1133,34,102,874,1025,1118,821,794,25]); __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})]})]})}},1133,[34,102,874,1025,1115,1134,1118,821,1003,892,872,794,25]); __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))}},1134,[]); -__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:a,inStaffApp:n,shiftManager:l,big:o,testID:d}){const[r,u]=(0,t.useState)(!1),x=(0,p.useSession)(e=>e.meId),j=(0,b.useOwner)(e=>e.staff.find(e=>e.id===x&&e.active));return s.walkIn||!(0,h.canEditBooking)({variant:c.APP_VARIANT,inStaffApp:n,role:a,shiftManager:l})||x&&!(0,m.canChangeBookings)(j)?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.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}}),r?(0,T.jsx)(B,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:a,hidePrivate:n}){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,60);return o?(0,T.jsx)(B,{rid:e,id:o,who:i,hidePrivate:n,onClose:a}):(0,T.jsxs)(f.Sheet,{visible:!0,onClose:a,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,T.jsx)(f.T,{size:16,colour:j.colours.text,children:"Tip: tap the booking you want to change."}),r.length?r.map(e=>(0,T.jsx)(f.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${e.date===s?'Today':e.date} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${e.date===s?'today':e.date}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56,alignItems:'flex-start'}},e.id)):(0,T.jsx)(f.Muted,{children:"No bookings to edit from today on."}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:a,style:{minHeight:44}})]})},_e.EditBookingSheet=B;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),a=_r(_d[3]),n=(e=a)&&e.__esModule?e:{default:e},l=_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]),j=_r(_d[15]),y=_r(_d[16]),D=_r(_d[17]),C=_r(_d[18]),I=_r(_d[19]),f=_r(_d[20]),T=_r(_d[21]);const v=/^([01]\d|2[0-3]):[0-5]\d$/,w=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const k=e=>e?(e/100).toFixed(e%100?2:0):'',S=e=>{const t=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(t)&&t>=0?Math.round(100*t):NaN},P=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',$=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')}`:''},N=e=>e.charAt(0).toUpperCase()+e.slice(1);function E({title:e,children:t,testID:s}){return(0,T.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,T.jsx)(f.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const z=({label:e,value:t,onChange:s,max:i=20,testID:a})=>(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:e}),(0,T.jsx)(f.Stepper,{testID:a,value:t,min:0,max:i,onChange:s,label:e})]});function B({rid:e,id:a,who:p,onClose:b,hidePrivate:m='display'===c.APP_VARIANT}){const B=(0,l.useBookings)(e),A=B.find(e=>e.id===a),O=(0,r.useRestaurant)(e),R=(0,o.usePlan)(e),L=(0,d.useBlocks)(e=>e.blocks),[F,W]=(0,t.useState)(A?(0,h.draftOf)(A):null),[M,_]=(0,t.useState)(null),[H,V]=(0,t.useState)(null),[Y,G]=(0,t.useState)(k(A?(0,h.draftOf)(A).depositDue:0)),[U,X]=(0,t.useState)(k(A?(0,h.draftOf)(A).depositAmount:0)),[q,J]=(0,t.useState)(P(A?(0,h.draftOf)(A).depositDate:''));if(!A||!F||!O)return null;const K=e=>{_(null),V(null),W({...F,...e})},Q=w(F.time),Z=v.test(Q),ee=F.area?R.areas.filter(e=>e.name===F.area).map(e=>e.id):null,te=e=>!ee||e.split('+').every(e=>ee.includes(R.tables.find(t=>t.name===e)?.areaId??'')),se=(0,x.tableOptions)(R,B.filter(e=>e.date===F.date),F.table).filter(e=>te(e)||e===F.table),ie=!(F.depositOn&&(Number.isNaN(S(Y||'0'))||F.depositPaid&&(Number.isNaN(S(U||'0'))||q.trim()&&!$(q)))),ae={...F,time:Q,depositDue:S(Y||'0')||0,depositAmount:S(U||'0')||0,depositDate:$(q)},ne=(0,h.changedFields)(A,ae),le=O.settings.turnMins??90,oe=async()=>{const t=(0,h.editPatch)(A,ae,{by:p||'Team member',app:c.APP_VARIANT});if(Object.keys(t).length&&await l.repo.bookings.update(A.id,t),'seated'===A.status&&'table'in t&&t.table!==A.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(A.table),a=s(t.table),n=o.useFloor.getState(),l=i.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!a.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),a.forEach(t=>n.setLive(e,t,{stage:l,dirty:!1}))}V(`Saved. Changed: ${(0,h.editedWords)(ne)}.`),_(null),b()},de=F.allergies??[],re=e=>K({allergyNone:!1,allergies:de.some(t=>t.allergen===e)?de.filter(t=>t.allergen!==e):[...de,{allergen:e,severity:'allergy'}]}),ce=(0,h.historyLines)(A);return(0,T.jsxs)(f.Sheet,{visible:!0,onClose:b,title:`Edit booking \xb7 ${A.name} \xb7 ${A.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,T.jsx)(n.default,{style:{alignItems:'center'},children:(0,T.jsx)(C.DepositChip,{b:A,money:!0,big:!0,testID:"edit-deposit"})}),(0,h.isWixBooking)(A)?(0,T.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:h.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:h.WIX_EDIT_NOTE})}):null,(0,T.jsx)(f.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,T.jsxs)(E,{title:"Deposit",testID:"edit-section-deposit",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No deposit",selected:!F.depositOn,testID:"edit-deposit-none",onPress:()=>K({depositOn:!1,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit due",selected:!!F.depositOn&&!F.depositPaid,testID:"edit-deposit-due",onPress:()=>K({depositOn:!0,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit paid",selected:!!F.depositOn&&!!F.depositPaid,testID:"edit-deposit-paid",onPress:()=>{U||X(Y),q||J(P((0,y.ymd)(new Date))),K({depositOn:!0,depositPaid:!0})}})]}),F.depositOn?(0,T.jsx)(f.Field,{label:"Deposit due (\xa3)",value:Y,onChangeText:e=>{G(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,F.depositOn&&F.depositPaid?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Amount paid (\xa3)",value:U,onChangeText:e=>{X(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"How was it paid?"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.DEPOSIT_METHODS.map(e=>(0,T.jsx)(f.Chip,{label:N(e),selected:F.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>K({depositMethod:e})},e))}),(0,T.jsx)(f.Field,{label:"Date paid (DD/MM/YYYY)",value:q,onChangeText:e=>{J((0,s.slashDate)(e,q)),K({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),q.trim()&&!$(q)?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,ie?null:(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,T.jsx)(f.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,T.jsxs)(E,{title:"When",testID:"edit-section-when",children:[(0,T.jsx)(D.BookingDatePicker,{r:O,today:new Date,value:F.date,onChange:e=>K({date:e})}),(0,T.jsx)(f.Field,{label:"Time (24-hour, for example 19:15)",value:F.time,onChangeText:e=>K({time:e}),testID:"edit-time"}),Z?null:(0,T.jsx)(f.T,{size:15,colour:j.colours.amber,children:"Write the time like 19:15."}),(0,T.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,T.jsx)(f.T,{size:18,center:!0,children:"Covers"}),(0,T.jsx)(i.PartySizeInput,{value:F.partySize,onChange:e=>K({partySize:e}),label:"Covers",testID:"edit-covers"})]}),(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:"Table time"}),(0,T.jsx)(f.Stepper,{testID:"edit-duration",value:F.duration||0,min:0,max:360,step:15,onChange:e=>K({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,T.jsxs)(E,{title:"Where",testID:"edit-section-where",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"Any area",selected:!F.area,testID:"edit-area-any",onPress:()=>K({area:''})}),R.areas.map(e=>(0,T.jsx)(f.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:F.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>K({area:e.name})},e.id))]}),(0,T.jsx)(f.T,{size:18,weight:"semibold",center:!0,children:(0,x.tableButtonLabel)(F.table)}),(0,T.jsxs)(f.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Button,{kind:F.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(F.table?'':', chosen'),onPress:()=>K({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),se.map(e=>(0,T.jsx)(f.Button,{kind:e===F.table?'primary':'secondary',label:(0,x.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,x.tableButtonLabel)(e)}${e===F.table?', chosen':''}`,onPress:()=>K({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,T.jsxs)(E,{title:"Guest",testID:"edit-section-guest",children:[(0,T.jsx)(f.Field,{label:"Name",value:F.name,onChangeText:e=>K({name:e}),testID:"edit-name"}),m?(0,T.jsx)(f.Muted,{center:!0,children:"Phone and email can be changed in the Managers app. Use Show number on the booking to see the number."}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Phone",value:F.phone,onChangeText:e=>K({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,T.jsx)(f.Field,{label:"Email",value:F.email,onChangeText:e=>K({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Booked by"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.SOURCES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>K({source:e.id})},e.id))}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.TAGS.map(e=>{const t=(F.tags??[]).includes(e);return(0,T.jsx)(f.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>K({tags:t?(F.tags??[]).filter(t=>t!==e):[...F.tags??[],e].sort()})},e)})})]}),(0,T.jsxs)(E,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,T.jsx)(z,{label:"Dogs",value:F.dogs??0,max:6,onChange:e=>K({dogs:e}),testID:"edit-dogs"}),(0,T.jsx)(z,{label:"High chairs",value:F.highChairs??0,max:10,onChange:e=>K({highChairs:e}),testID:"edit-high-chairs"}),(0,T.jsx)(z,{label:"Wheelchair users",value:F.wheelchair??0,max:10,onChange:e=>K({wheelchair:e}),testID:"edit-wheelchair"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Occasion"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.OCCASIONS.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:(F.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>K({occasion:e.id})},e.id||'none'))})]}),(0,T.jsxs)(E,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No allergies",selected:!!F.allergyNone&&!de.length,testID:"edit-allergy-none",onPress:()=>K({allergyNone:!0,allergies:[]})}),u.ALLERGENS.map(e=>(0,T.jsx)(f.Chip,{label:e.short,selected:de.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>re(e.id)},e.id))]}),de.map(e=>(0,T.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,T.jsxs)(f.T,{size:15,center:!0,children:[u.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:u.SEVERITIES.map(t=>(0,T.jsx)(f.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>K({allergies:de.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,T.jsx)(f.Field,{label:"Anything else about allergies",value:F.allergyNote,onChangeText:e=>K({allergyNote:e}),testID:"edit-allergy-note"}),ne.includes('allergies')&&de.length?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,T.jsx)(z,{label:"Vegan",value:F.vegan??0,max:F.partySize,onChange:e=>K({vegan:e}),testID:"edit-vegan"}),(0,T.jsx)(z,{label:"Vegetarian",value:F.vegetarian??0,max:F.partySize,onChange:e=>K({vegetarian:e}),testID:"edit-vegetarian"})]}),'cancelled'!==A.status?(0,T.jsxs)(E,{title:"Status",testID:"edit-section-status",children:[(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.EDIT_STATUSES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>K({status:e.id})},e.id))}),(0,T.jsx)(f.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,T.jsx)(E,{title:"Notes",testID:"edit-section-notes",children:(0,T.jsx)(f.Field,{label:"Notes",value:F.notes,onChangeText:e=>K({notes:e}),placeholder:h.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),M?(0,T.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:[M.map(e=>(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,H?(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:H}):null,(0,T.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,T.jsx)(f.Button,{label:M?'Save anyway':'Save changes',testID:"edit-save",disabled:!Z||!ie||F.name.trim().length<1||!ne.length,onPress:()=>{const t=Z?(0,d.blockAt)(L,e,F.date,Q):void 0,s=(0,h.editWarnings)(A,ae,B,t,le,R);!s.length||M?oe():_(s)},style:{minHeight:56,flex:1}}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:b,style:{minHeight:56}})]}),ce.length?(0,T.jsx)(E,{title:"Changes",testID:"edit-history",children:ce.slice(0,12).map((e,t)=>(0,T.jsx)(f.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,T.jsx)(I.CancelBookingButton,{rid:e,b:A,name:A.name,big:!0,onDone:()=>b()}),(0,T.jsx)(I.ReinstateBookingButton,{b:A,name:A.name,today:(0,y.ymd)(new Date),onDone:()=>b()})]})}},1135,[34,1059,1120,102,874,1025,1022,876,872,1130,861,1003,892,1023,1115,821,858,1124,1112,1133,794,25]); +__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:a,inStaffApp:n,shiftManager:l,big:o,testID:r}){const[d,u]=(0,t.useState)(!1),x=(0,p.useSession)(e=>e.meId),j=(0,b.useOwner)(e=>e.staff.find(e=>e.id===x&&e.active));return s.walkIn||!(0,h.canEditBooking)({variant:c.APP_VARIANT,inStaffApp:n,role:a,shiftManager:l})||x&&!(0,m.canChangeBookings)(j)?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:r??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),d?(0,T.jsx)(B,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:a,hidePrivate:n}){const[o,r]=(0,t.useState)(null),d=(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,T.jsx)(B,{rid:e,id:o,who:i,hidePrivate:n,onClose:a}):(0,T.jsxs)(f.Sheet,{visible:!0,onClose:a,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),d.length?d.map(e=>(0,T.jsx)(f.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${k(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}, ${k(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>r(e.id),style:{minHeight:56}},e.id)):(0,T.jsx)(f.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:a,style:{minHeight:44}})]})},_e.EditBookingSheet=B;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),a=_r(_d[3]),n=(e=a)&&e.__esModule?e:{default:e},l=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),j=_r(_d[15]),y=_r(_d[16]),D=_r(_d[17]),C=_r(_d[18]),I=_r(_d[19]),f=_r(_d[20]),T=_r(_d[21]);const v=/^([01]\d|2[0-3]):[0-5]\d$/,w=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const k=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,y.ymd)(s)?'Tomorrow':$(e)};const S=e=>e?(e/100).toFixed(e%100?2:0):'',P=e=>{const t=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(t)&&t>=0?Math.round(100*t):NaN},$=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',N=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=>e.charAt(0).toUpperCase()+e.slice(1);function z({title:e,children:t,testID:s}){return(0,T.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,T.jsx)(f.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const A=({label:e,value:t,onChange:s,max:i=20,testID:a})=>(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:e}),(0,T.jsx)(f.Stepper,{testID:a,value:t,min:0,max:i,onChange:s,label:e})]});function B({rid:e,id:a,who:p,onClose:b,hidePrivate:m='display'===c.APP_VARIANT}){const k=(0,l.useBookings)(e),B=k.find(e=>e.id===a),O=(0,d.useRestaurant)(e),R=(0,o.usePlan)(e),L=(0,r.useBlocks)(e=>e.blocks),[F,W]=(0,t.useState)(B?(0,h.draftOf)(B):null),[M,_]=(0,t.useState)(null),[H,V]=(0,t.useState)(null),[Y,G]=(0,t.useState)(S(B?(0,h.draftOf)(B).depositDue:0)),[U,X]=(0,t.useState)(S(B?(0,h.draftOf)(B).depositAmount:0)),[q,J]=(0,t.useState)($(B?(0,h.draftOf)(B).depositDate:''));if(!B||!F||!O)return null;const K=e=>{_(null),V(null),W({...F,...e})},Q=w(F.time),Z=v.test(Q),ee=F.area?R.areas.filter(e=>e.name===F.area).map(e=>e.id):null,te=e=>!ee||e.split('+').every(e=>ee.includes(R.tables.find(t=>t.name===e)?.areaId??'')),se=(0,x.tableOptions)(R,k.filter(e=>e.date===F.date),F.table).filter(e=>te(e)||e===F.table),ie=!(F.depositOn&&(Number.isNaN(P(Y||'0'))||F.depositPaid&&(Number.isNaN(P(U||'0'))||q.trim()&&!N(q)))),ae={...F,time:Q,depositDue:P(Y||'0')||0,depositAmount:P(U||'0')||0,depositDate:N(q)},ne=(0,h.changedFields)(B,ae),le=O.settings.turnMins??90,oe=async()=>{const t=(0,h.editPatch)(B,ae,{by:p||'Team member',app:c.APP_VARIANT});if(Object.keys(t).length&&await l.repo.bookings.update(B.id,t),'seated'===B.status&&'table'in t&&t.table!==B.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(B.table),a=s(t.table),n=o.useFloor.getState(),l=i.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!a.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),a.forEach(t=>n.setLive(e,t,{stage:l,dirty:!1}))}V(`Saved. Changed: ${(0,h.editedWords)(ne)}.`),_(null),b()},re=F.allergies??[],de=e=>K({allergyNone:!1,allergies:re.some(t=>t.allergen===e)?re.filter(t=>t.allergen!==e):[...re,{allergen:e,severity:'allergy'}]}),ce=(0,h.historyLines)(B);return(0,T.jsxs)(f.Sheet,{visible:!0,onClose:b,title:`Edit booking \xb7 ${B.name} \xb7 ${B.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,T.jsx)(n.default,{style:{alignItems:'center'},children:(0,T.jsx)(C.DepositChip,{b:B,money:!0,big:!0,testID:"edit-deposit"})}),(0,h.isWixBooking)(B)?(0,T.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:h.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:h.WIX_EDIT_NOTE})}):null,(0,T.jsx)(f.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,T.jsxs)(z,{title:"Deposit",testID:"edit-section-deposit",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No deposit",selected:!F.depositOn,testID:"edit-deposit-none",onPress:()=>K({depositOn:!1,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit due",selected:!!F.depositOn&&!F.depositPaid,testID:"edit-deposit-due",onPress:()=>K({depositOn:!0,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit paid",selected:!!F.depositOn&&!!F.depositPaid,testID:"edit-deposit-paid",onPress:()=>{U||X(Y),q||J($((0,y.ymd)(new Date))),K({depositOn:!0,depositPaid:!0})}})]}),F.depositOn?(0,T.jsx)(f.Field,{label:"Deposit due (\xa3)",value:Y,onChangeText:e=>{G(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,F.depositOn&&F.depositPaid?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Amount paid (\xa3)",value:U,onChangeText:e=>{X(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"How was it paid?"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.DEPOSIT_METHODS.map(e=>(0,T.jsx)(f.Chip,{label:E(e),selected:F.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>K({depositMethod:e})},e))}),(0,T.jsx)(f.Field,{label:"Date paid (DD/MM/YYYY)",value:q,onChangeText:e=>{J((0,s.slashDate)(e,q)),K({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),q.trim()&&!N(q)?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,ie?null:(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,T.jsx)(f.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,T.jsxs)(z,{title:"When",testID:"edit-section-when",children:[(0,T.jsx)(D.BookingDatePicker,{r:O,today:new Date,value:F.date,onChange:e=>K({date:e})}),(0,T.jsx)(f.Field,{label:"Time (24-hour, for example 19:15)",value:F.time,onChangeText:e=>K({time:e}),testID:"edit-time"}),Z?null:(0,T.jsx)(f.T,{size:15,colour:j.colours.amber,children:"Write the time like 19:15."}),(0,T.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,T.jsx)(f.T,{size:18,center:!0,children:"Covers"}),(0,T.jsx)(i.PartySizeInput,{value:F.partySize,onChange:e=>K({partySize:e}),label:"Covers",testID:"edit-covers"})]}),(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:"Table time"}),(0,T.jsx)(f.Stepper,{testID:"edit-duration",value:F.duration||0,min:0,max:360,step:15,onChange:e=>K({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,T.jsxs)(z,{title:"Where",testID:"edit-section-where",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"Any area",selected:!F.area,testID:"edit-area-any",onPress:()=>K({area:''})}),R.areas.map(e=>(0,T.jsx)(f.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:F.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>K({area:e.name})},e.id))]}),(0,T.jsx)(f.T,{size:18,weight:"semibold",center:!0,children:(0,x.tableButtonLabel)(F.table)}),(0,T.jsxs)(f.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Button,{kind:F.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(F.table?'':', chosen'),onPress:()=>K({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),se.map(e=>(0,T.jsx)(f.Button,{kind:e===F.table?'primary':'secondary',label:(0,x.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,x.tableButtonLabel)(e)}${e===F.table?', chosen':''}`,onPress:()=>K({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,T.jsxs)(z,{title:"Guest",testID:"edit-section-guest",children:[(0,T.jsx)(f.Field,{label:"Name",value:F.name,onChangeText:e=>K({name:e}),testID:"edit-name"}),m?(0,T.jsx)(f.Muted,{center:!0,children:"Phone and email can be changed in the Managers app. Use Show number on the booking to see the number."}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Phone",value:F.phone,onChangeText:e=>K({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,T.jsx)(f.Field,{label:"Email",value:F.email,onChangeText:e=>K({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Booked by"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.SOURCES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>K({source:e.id})},e.id))}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.TAGS.map(e=>{const t=(F.tags??[]).includes(e);return(0,T.jsx)(f.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>K({tags:t?(F.tags??[]).filter(t=>t!==e):[...F.tags??[],e].sort()})},e)})})]}),(0,T.jsxs)(z,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,T.jsx)(A,{label:"Dogs",value:F.dogs??0,max:6,onChange:e=>K({dogs:e}),testID:"edit-dogs"}),(0,T.jsx)(A,{label:"High chairs",value:F.highChairs??0,max:10,onChange:e=>K({highChairs:e}),testID:"edit-high-chairs"}),(0,T.jsx)(A,{label:"Wheelchair users",value:F.wheelchair??0,max:10,onChange:e=>K({wheelchair:e}),testID:"edit-wheelchair"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Occasion"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.OCCASIONS.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:(F.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>K({occasion:e.id})},e.id||'none'))})]}),(0,T.jsxs)(z,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No allergies",selected:!!F.allergyNone&&!re.length,testID:"edit-allergy-none",onPress:()=>K({allergyNone:!0,allergies:[]})}),u.ALLERGENS.map(e=>(0,T.jsx)(f.Chip,{label:e.short,selected:re.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>de(e.id)},e.id))]}),re.map(e=>(0,T.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,T.jsxs)(f.T,{size:15,center:!0,children:[u.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:u.SEVERITIES.map(t=>(0,T.jsx)(f.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>K({allergies:re.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,T.jsx)(f.Field,{label:"Anything else about allergies",value:F.allergyNote,onChangeText:e=>K({allergyNote:e}),testID:"edit-allergy-note"}),ne.includes('allergies')&&re.length?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,T.jsx)(A,{label:"Vegan",value:F.vegan??0,max:F.partySize,onChange:e=>K({vegan:e}),testID:"edit-vegan"}),(0,T.jsx)(A,{label:"Vegetarian",value:F.vegetarian??0,max:F.partySize,onChange:e=>K({vegetarian:e}),testID:"edit-vegetarian"})]}),'cancelled'!==B.status?(0,T.jsxs)(z,{title:"Status",testID:"edit-section-status",children:[(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.EDIT_STATUSES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>K({status:e.id})},e.id))}),(0,T.jsx)(f.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,T.jsx)(z,{title:"Notes",testID:"edit-section-notes",children:(0,T.jsx)(f.Field,{label:"Notes",value:F.notes,onChangeText:e=>K({notes:e}),placeholder:h.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),M?(0,T.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:[M.map(e=>(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,H?(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:H}):null,(0,T.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,T.jsx)(f.Button,{label:M?'Save anyway':'Save changes',testID:"edit-save",disabled:!Z||!ie||F.name.trim().length<1||!ne.length,onPress:()=>{const t=Z?(0,r.blockAt)(L,e,F.date,Q):void 0,s=(0,h.editWarnings)(B,ae,k,t,le,R);!s.length||M?oe():_(s)},style:{minHeight:56,flex:1}}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:b,style:{minHeight:56}})]}),ce.length?(0,T.jsx)(z,{title:"Changes",testID:"edit-history",children:ce.slice(0,12).map((e,t)=>(0,T.jsx)(f.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,T.jsx)(I.CancelBookingButton,{rid:e,b:B,name:B.name,big:!0,onDone:()=>b()}),(0,T.jsx)(I.ReinstateBookingButton,{b:B,name:B.name,today:(0,y.ymd)(new Date),onDone:()=>b()})]})}},1135,[34,1059,1120,102,874,1025,1022,876,872,1130,861,1003,892,1023,1115,821,858,1124,1112,1133,794,25]); __d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceSlot",{enumerable:!0,get:function(){return w}}),_e.voiceAppFor=h,_e.useVoiceTarget=p,_e.VoiceSlot=function({size:e=56,layer:t=0}){const u=p(),c=(0,n.useRef)(null),l=(0,n.useRef)(y++).current,{width:f,height:h,fontScale:v}=(0,o.default)(),A=()=>{if(t{if(c.current!==e||!s||tu+.5?w.getState().owner===l&&w.setState({rect:null,owner:0}):w.setState({rect:{x:n,y:o,size:s},owner:l})})},W=(0,n.useRef)(A);return W.current=A,(0,n.useLayoutEffect)(()=>{if(u?.on)return S.set(l,{layer:t,measure:()=>W.current()}),()=>{S.delete(l),w.getState().owner===l&&w.setState({rect:null,owner:0}),requestAnimationFrame(b)}},[u?.on,t]),(0,n.useLayoutEffect)(()=>{A();const e=requestAnimationFrame(A);return()=>cancelAnimationFrame(e)},[f,h,v,u?.on]),(0,n.useEffect)(()=>{const e=c.current;if(!u?.on||'undefined'==typeof ResizeObserver||!e?.parentElement)return;const t=new ResizeObserver(A);return t.observe(e.parentElement),e.parentElement.parentElement&&t.observe(e.parentElement.parentElement),()=>t.disconnect()},[u?.on]),(0,n.useEffect)(()=>()=>{w.getState().owner===l&&w.setState({rect:null,owner:0})},[]),(0,n.useEffect)(()=>{u?.on||w.getState().owner!==l||w.setState({rect:null,owner:0})},[u?.on]),u?.on?(0,m.jsx)(s.default,{ref:c,testID:"voice-slot",onLayout:A,style:{width:e,height:e,flexShrink:0}}):null};var t=r(d[0]),n=r(d[1]),o=e(r(d[2])),s=e(r(d[3])),u=r(d[4]),c=r(d[5]),l=r(d[6]),f=r(d[7]),m=r(d[8]);const w=(0,u.create)(()=>({rect:null,owner:0}));function h(e){return'customer'===c.APP_VARIANT||/^\/(customer|table|demo)/.test(e)?null:e.startsWith('/owner')||e.startsWith('/admin')?'owner':e.startsWith('/team')?'staff':e.startsWith('/kitchen')?'chef':e.startsWith('/display')?'display':null}function p(){const e=(0,t.usePathname)()||'/',n=(0,l.useCtx)(6e4),o=(0,f.useVoiceSettings)(e=>e.enabled),s=h(e);if(!s)return null;const u='owner'===s?'owner'===n.role?'owner':'manager'===n.role?'manager':'staff':s;return{app:s,role:u,actions:'staff'===u?'staff':s,on:(0,f.voiceOn)(o,n.rid,u)}}let y=1;const S=new Map,E=()=>{let e=-1;return S.forEach(t=>{t.layer>e&&(e=t.layer)}),e};function b(){const e=E();S.forEach(t=>{t.layer===e&&t.measure()})}},1136,[30,34,426,102,846,872,1084,1137,25]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_ROLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"VOICE_ROLE_LABEL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useVoiceSettings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"voiceOn",{enumerable:!0,get:function(){return f}}),_e.micExplainedFor=function(e){try{if('1'===b()?.getItem(s(e)))return!0}catch{}return u.getState().micExplained},_e.setMicExplainedFor=function(e){try{b()?.setItem(s(e),'1')}catch{}u.getState().setMicExplained(!0)};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},c=r(d[1]),l=r(d[2]);const o=['owner','manager','staff','chef','display'],p={owner:'Owner (Managers app)',manager:'Managers (Managers app)',staff:'Staff app (full voice assistant, no money or HR)',chef:'Head Chef app',display:'Main Display'},u=(0,c.create)()((0,l.persist)(e=>({enabled:{},micExplained:!1,setEnabled:(n,t,c)=>e(e=>({enabled:{...e.enabled,[n]:{...e.enabled[n]??{},[t]:c}}})),setMicExplained:n=>e({micExplained:n})}),{name:'covercharge-voice-v1',version:4,storage:(0,l.createJSONStorage)(()=>t.default),migrate:(e,n)=>({enabled:n<2?{}:e?.enabled??{},micExplained:!!e?.micExplained}),merge:(e,n)=>({...n,enabled:e?.enabled??n.enabled,micExplained:e?.micExplained??n.micExplained}),partialize:e=>({enabled:e.enabled,micExplained:e.micExplained})})),f=(e,n,t)=>!1!==e[n]?.[t],s=e=>`cc-voice-mic-explained-${e}`,b=()=>{try{return'undefined'!=typeof window?window.localStorage:void 0}catch{return}}},1137,[839,846,849]); __d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VAT",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return n}}),e.dishCost=i,Object.defineProperty(e,"gpPct",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"priceForTarget",{enumerable:!0,get:function(){return c}}),e.costings=function(r,c,s,u){const d=(0,t.dishStats)(r);return c.map(t=>{const c=r.find(r=>r.id===t.dishId);if(!c||null==c.price)return null;const p=i(t,s),l=n(c.price),f=o(p,c.price),b=d.find(t=>t.item.id===c.id)?.sold??0;return{item:c,recipe:t,cost:p,priceInc:c.price,priceEx:l,gp:f,cashGp:l-p,below:ft.prevCost&&t.prevCost!==t.cost).map(s=>{const u=(s.cost-(s.prevCost??s.cost))/(s.prevCost??1)*100,d=r.filter(t=>t.lines.some(t=>t.ing===s.id)).map(r=>{const u=t.find(t=>t.id===r.dishId);if(!u||null==u.price)return null;const d=o(i(r,n,{ing:s.id,cost:s.prevCost}),u.price),p=o(i(r,n),u.price);return{item:u,before:d,after:p,dropped:d>=c&&pt.dropped),below:d.filter(t=>t.below)}})},e.weekGp=function(t,r,n){const i=t.reduce((t,r)=>t+r.priceEx*r.soldWeek,0),o=t.reduce((t,r)=>t+r.cost*r.soldWeek,0),c=o+r+Math.max(0,n);return{sales:i,theoCost:o,actualCost:c,theo:i?(i-o)/i*100:0,actual:i?(i-c)/i*100:0}},Object.defineProperty(e,"fmtQty",{enumerable:!0,get:function(){return s}});var t=_r(_d[0]);const r=.2,n=t=>Math.round(t/1.2);function i(t,r,n){return Math.round(t.lines.reduce((t,i)=>{const o=r.find(t=>t.id===i.ing);return t+(n&&n.ing===i.ing?n.cost:o?.cost??0)*i.qty},0))}const o=(t,r)=>{const i=n(r);return i>0?(i-t)/i*100:0},c=(t,r)=>50*Math.ceil(t/(1-r/100)*1.2/50);const s=(t,r)=>`${Number.isInteger(t)?t:t.toFixed(t<1?3:2).replace(/0+$/,'').replace(/\.$/,'')} ${'each'===r?'':r}`.trim()},1138,[1139]); @@ -1395,7 +1395,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}},1312,[827,860,34,102,794,861,867,1154,1313,874,821,25]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1313,[934,988,1154]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1314,[30,34,872,1315,1379,25]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ge}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:b,headerExtra:K,subHeader:He,noVoice:Pe=!1}={}){const Ue=(0,N.default)(),Je=b??Ue.width,Xe=Ue.height,Ze=Je<700,et=Je>=Xe,tt=!Ze&&et&&Je>=600,lt=tt,st=Math.round(Math.min(520,Math.max(Je>=1e3?448:280,.3*Je))),it=$.default.useRef(null),ot=$.default.useRef(0),[nt,at]=(0,T.useState)({w:0,h:0}),rt=(0,X.useOwner)(e=>e.site),dt=(0,Y.useRestaurant)(rt);(0,Ie.useAlertWatcher)(rt,{enabled:!e});const ct=(0,Y.useOrders)(rt),ut=(0,Y.useBookings)(rt),ht=(0,Y.useEvents)(rt),gt=(0,Y.useStore)(e=>e.skipMinutes),bt=(0,Y.useStore)(e=>e.clock.mode),yt=(0,Y.useNow)(5e3),pt=(0,X.useOwner)(e=>e.staff),ft=(0,X.useOwner)(e=>e.attendance),xt=(0,X.useOwner)(e=>e.shifts);$.default.useEffect(()=>{(0,ee.ensureAttendance)((0,q.ymd)(yt),yt)},[(0,q.ymd)(yt)]);const mt=ft.filter(e=>e.in&&!e.out&&yt.getTime()-new Date(e.in).getTime()<72e6&&yt.getTime()>=new Date(e.in).getTime()),jt=Ve(pt.find(e=>e.id===mt[0]?.staffId)?.name)||'Duty Manager',wt=k.IS_CAR?'Car':'Display';(0,v.useSoldOutLink)(!1,e?void 0:wt,!0);const kt=(0,q.ymd)(yt),It=(0,R.useTravelDay)('display',kt),Dt=(0,Z.useFrontDoor)(kt,et),vt=(0,te.useDisplaySettings)(rt),St=vt.privacy,Ct=(0,ce.useSaverSync)(),Tt=(0,te.usePlan)(rt),$t=(0,te.useFloor)(e=>e.live[rt]),Bt=(0,De.useBlocks)(e=>e.blocks),[Rt,Lt]=(0,T.useState)('plan'),[Wt,zt]=(0,T.useState)(!1),[Mt,Ht]=(0,T.useState)('all'),[Pt,Et]=(0,T.useState)(null),[Ot,At]=(0,T.useState)(null),[Nt,_t]=(0,T.useState)(null),[Gt,Vt]=(0,T.useState)(!1),[Ft,Ut]=(0,T.useState)(!1),[Kt,qt]=(0,T.useState)(null),[Yt,Qt]=(0,T.useState)(!1),[Jt,Xt]=(0,T.useState)(!1),[Zt,el]=(0,T.useState)(null),[tl,ll]=(0,T.useState)(null),[sl,il]=(0,T.useState)(null),ol=$.default.useRef(0),nl=e=>{ol.current=Date.now(),il(e)};$.default.useEffect(()=>{if(!sl)return;const e=setInterval(()=>{Date.now()-ol.current>=Te.DAY_IDLE_MS&&il(null)},5e3);return()=>clearInterval(e)},[sl]);const al=(0,Y.useWaitlist)(rt),rl=(0,Y.useStore)(e=>e.walkIns[rt]??0),[dl,cl]=(0,T.useState)(!1),[ul,hl]=(0,T.useState)(!1),[gl,bl]=(0,T.useState)(!1);(0,F.useReviewAlerts)(rt);const[yl,pl]=(0,T.useState)({view:0,content:0}),[fl,xl]=(0,T.useState)(null);$.default.useEffect(()=>{fl&&((0,S.notify)({id:`floor-note:${Date.now()}`,title:fl,timeoutMs:4500,big:!0,testID:'floor-toast'}),xl(null))},[fl]),$.default.useEffect(()=>{if(!e)return(0,L.setDisplaySilent)(!0),()=>(0,L.setDisplaySilent)(!1)},[e]);const[ml,jl]=(0,T.useState)(null),wl=$.default.useRef(0),[kl,Il]=(0,T.useState)(null);$.default.useEffect(()=>{if(!ml)return;wl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-wl.current;if(e>=Ge)return jl(null),void xl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Il(e>=105e3?Math.ceil((Ge-e)/1e3):null)},1e3);return()=>clearInterval(e)},[ml]);const Dl=e=>e.date!==kt?_t({title:`Guest details \xb7 ${(0,Te.dayWord)(e.date,kt)} ${e.time}`,body:(0,Ae.jsx)(Ae.Fragment,{children:(0,me.bookingDetails)(e)})}):_t({title:`Guest details \xb7 ${e.time}`,body:(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(Qe,{rid:rt,id:e.id,turnBase:dt.settings.turnMins}),e.walkIn?null:(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ae.jsx)(ye.CancelWalkInButton,{rid:rt,b:e,big:!0,onDone:e=>{_t(null),xl(e)}}):null,e.walkIn?(0,Ae.jsx)(ye.ReinstateWalkInButton,{rid:rt,b:e,today:kt,onDone:e=>{_t(null),xl(e)}}):null,(0,me.bookingDetails)(e)]})}),vl=ut.filter(e=>e.date===kt).sort((e,t)=>e.time.localeCompare(t.time)),Sl=vl.filter(e=>!['cancelled','noshow'].includes(e.status)),Cl=ct.filter(Fe).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Tl=(0,T.useMemo)(()=>(0,c.forecastToday)(dt,ut,ct,ht,yt),[dt,ut,ct,ht,yt.getTime()/6e4|0]),$l=(0,De.closedAreasAt)(Bt,rt,kt,(0,q.hm)(yt)),Bl=[...$l].join(','),Rl=(0,T.useMemo)(()=>(0,le.floorView)(Tt,ut,ct,$t??{},yt,dt.settings.turnMins,$l),[Tt,ut,ct,$t,yt.getTime(),Bl]),Ll=(0,xe.hoursFor)(dt,yt),Wl=Ll?.open??new Date(`${kt}T12:00:00`),zl=Ll?.close??new Date(`${kt}T21:00:00`),Ml=(0,q.addMins)(Wl,-Wl.getMinutes()),Hl=(0,q.addMins)(zl,30),Pl=e=>new Date(`${kt}T${e}:00`),El=(0,De.blocksOn)(Bt,rt,kt).map(e=>({from:Pl(e.from),to:Pl(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(dt,yt,kt)),Ol=Object.keys(Rl).filter(e=>'blocked'===Rl[e]?.status),Al=sl&&sl!==kt?sl:kt,Nl=Al!==kt,_l=(0,Te.dayWord)(Al,kt),Gl=/^(Today|Yesterday|Tomorrow)$/.test(_l),Vl=Nl?(0,Te.bookingsForDay)(ut,Al,kt).sort((e,t)=>e.time.localeCompare(t.time)):vl,Fl=(0,q.parseYmd)(Al);Fl.setHours(12);const Ul=Nl?(0,xe.hoursFor)(dt,Fl):Ll,Kl=Ul?.open??new Date(`${Al}T12:00:00`),ql=Ul?.close??new Date(`${Al}T21:00:00`),Yl=e=>new Date(`${Al}T${e}:00`),Ql=[...Nl?(0,De.blocksOn)(Bt,rt,Al).map(e=>({from:Yl(e.from),to:Yl(e.to),label:e.reason??'Paused'})):El,...Nl?(0,o.queuedServicePauses)(dt,Fl,Al):[]],Jl=(0,o.queuedServiceSessions)(dt,Fl),Xl=s.IS_QUEUED_VENUE&&(void 0===Jl||!Jl.length),Zl=(0,Ae.jsxs)(A.default,{testID:"queued-hours-gate",style:[We.look.panel,{padding:14,gap:8}],children:[(0,Ae.jsx)(G.T,{weight:"semibold",children:void 0===Jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ae.jsx)(G.Muted,{children:i.queuedVenues[rt]?.hours.note})]}),es=Nl?Ul||Vl.length?AlNl?(0,le.dayFloorView)(Tt,Vl,Al):Rl,[Nl,Tt,Vl,Al,Rl]),[ls,ss]=(0,T.useState)(null),is=Nl?Vl.filter(e=>!['cancelled','noshow'].includes(e.status)):Sl,os=is.reduce((e,t)=>e+t.partySize,0),ns=(0,u.coversSplit)(is,Al),as=(0,$e.cancelledDayTally)(ut,Al),rs=(0,Be.cancellationsFor)(ut,Al,e=>e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)','')),ds=(0,$e.cancelledTallyWords)(as,Gl?_l.toLowerCase():Nl?`on ${_l}`:'today'),cs=Bt.filter(e=>e.rid===rt&&e.date===Al&&!e.removedAt),us=(0,Ce.chartBands)(cs,60*Kl.getHours()+Kl.getMinutes(),60*ql.getHours()+ql.getMinutes()),hs=new Set((0,Ce.blockedHours)(us)),gs=yt.getHours()+(yt.getMinutes()>=30?1:0),bs=Tl.hours.filter(e=>e.hour>=gs&&!hs.has(e.hour)),ys=bs.reduce((e,t)=>e+t.coversHigh,0),ps=bs.reduce((e,t)=>e+t.coversLow,0),fs=Math.round((ps+ys)/2),xs=!Tl.example&&Tl.open&&Tl.enough&&ys>0?`Usually ${(0,c.coversRange)(fs,fs)} more`:void 0,ms=async(e,t)=>{const l=Rl[e]?.booking;if(!l||e===t)return;const s=Rl[t]?.status;if(s&&!['free','soon'].includes(s))return void xl('dirty'===s?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${le.STATUS[s].label.toLowerCase()}. Pick a free table.`);await Y.repo.bookings.update(l.id,{table:t});const i=$t?.[e]?.stage;te.useFloor.getState().setLive(rt,t,{stage:i??'seated',dirty:!1}),te.useFloor.getState().setLive(rt,e,{stage:void 0,dirty:!0}),xl(`${(0,ue.privName)(l,St)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`)},js=tl?ut.find(e=>e.id===tl.id):void 0,ws=tl&&js?(()=>{const e=js.walkIn?(0,ue.privName)(js,St):Ve(js.name),t=(0,fe.seatsOf)(Tt,tl.tables).total,l=(0,fe.seatLine)(t,js.partySize),s=(0,fe.pickClashes)(js,tl.tables,ut.filter(e=>e.date===js.date),dt.settings.turnMins),i=(0,fe.tableKey)(tl.tables)!==(0,fe.tableKey)((0,te.tablesOf)(js.table));return(0,Ae.jsxs)(A.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:Q.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:Q.colours.gold,padding:10},children:[(0,Ae.jsxs)(A.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Te.dayWord)(js.date,kt)} ${js.time}. Tap tables on the plan to add or take them off. ${(0,fe.tablesWords)(tl.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,Ae.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Te.dayWord)(js.date,kt)," ",js.time]}),(0,Ae.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[(0,fe.tablesWords)(tl.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,Ae.jsxs)(G.Row,{gap:8,wrap:!0,children:[(0,Ae.jsx)(G.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,fe.tablesWords)(tl.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(js){try{await(0,pe.saveBookingTables)(rt,js,tl.tables),xl((0,fe.savedWords)(e,js.partySize,tl.tables,t))}catch(t){xl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}ll(null)}else ll(null)}}),(0,Ae.jsx)(G.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>ll(null)})]})]})})():null,ks=Tt.areas.filter(e=>Tt.tables.some(t=>t.areaId===e.id)),Is=e=>{const t=Tt.tables.filter(t=>t.areaId===e);return Nl?`${t.filter(e=>!ts[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Rl[e.name]?.status??'free')).length}/${t.length} free`},Ds='all'===Mt||ks.some(e=>e.id===Mt)?Mt:'all',vs=e=>(0,Ae.jsx)(se.FloorCanvas,{plan:Tt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:tt,big:!0,view:ts,privacy:St,turnBase:dt.settings.turnMins,highlight:tl?tl.tables:Ot?[Ot]:void 0,onTap:e=>{return t=e.name,void(tl?ll(e=>e?{...e,tables:(0,fe.toggleTable)(e.tables,t)}:e):Nl?ss(t):Ot?(t!==Ot&&ms(Ot,t),At(null)):Et(t));var t},onDrop:(e,t)=>tl||Nl?void 0:ms(e.name,t.name)}),Ss=Ze?1:et||ks.length>2?2:1,Cs=e=>{const t=Tt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},Ts=[];for(let e=0;e{const t=(0,se.areaBounds)(Tt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,se.minReadableScale)(Tt,e.id)}}),nt.w,nt.h):null,Bs=e=>(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between',height:ie.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,children:Is(e.id)})]}),Rs=(0,Ae.jsx)(A.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-nt.w)>1||Math.abs(l-nt.h)>1)&&at({w:t,h:l})},children:$s?(0,Ae.jsx)(O.default,{style:{flex:1},scrollEnabled:$s.scroll,showsVerticalScrollIndicator:$s.scroll,contentContainerStyle:{gap:ie.GRID_GAP},children:$s.rows.map((e,t)=>(0,Ae.jsx)(A.default,{style:{height:$s.rowHeights[t],flexDirection:'row',gap:ie.GRID_GAP},children:e.map(e=>{const t=ks.find(t=>t.id===e);return(0,Ae.jsxs)(A.default,{testID:`area-cell-${e}`,style:{width:$s.cellW,gap:2},children:[Bs(t),(0,Ae.jsx)(A.default,{style:{flex:1},children:vs(e)})]},e)})},t))}):null}),Ls=(0,Ae.jsxs)(A.default,{testID:"venue-plan",style:{flex:Ze?void 0:1,gap:10,minWidth:0},children:[(0,Ae.jsx)(r.TableNumberWarning,{plan:Tt}),Tt.tables.length?null:(0,Ae.jsxs)(A.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ae.jsx)(G.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ae.jsx)(G.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS?(0,Ae.jsx)(G.Muted,{center:!0,testID:"display-venue-hours",children:(s.IS_WILDINGS?a.WILDINGS_GUIDE:s.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ae.jsx)(qe,{chipId:"all",compact:!Ze,label:"Whole venue",selected:'all'===Ds,onPress:()=>Ht('all')},"__all"),...ks.map(e=>(0,Ae.jsx)(qe,{chipId:e.id,compact:!Ze,label:`${e.name}${(0,oe.areaMarks)(e)}`,colour:(0,Q.brandColour)(e.colour),sub:Ze?$l.has(e.id)?'closed':Ds===e.id?Is(e.id):void 0:void 0,selected:Ds===e.id,onPress:()=>Ht(e.id)},e.id))];return Ze?(0,Ae.jsx)(A.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ae.jsx)(O.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;pl(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>pl(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:yl.view>0&&yl.content>0&&yl.content<=yl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:yl.view>0&&yl.content<=yl.view+1?'100%':void 0},children:e})})(),(0,Ae.jsx)(g.FloorLegend,{}),ws,Ot?(0,Ae.jsxs)(G.Row,{gap:8,style:{backgroundColor:Q.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ae.jsxs)(G.T,{weight:"semibold",colour:Q.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Ot),": tap the new table."]}),(0,Ae.jsx)(G.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>At(null)})]}):null,'all'===Ds&&tt?Rs:'all'===Ds?(0,Ae.jsx)(A.default,{style:{flex:Ze?void 0:1,gap:12,minHeight:lt?void 0:360},children:Ts.map((e,t)=>(0,Ae.jsxs)(A.default,{style:{flex:Ze?void 0:Math.max(.3,...e.map(e=>Cs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ae.jsxs)(A.default,{style:{flex:1,gap:2},children:[Ze?(0,Ae.jsxs)(A.default,{style:{alignItems:'center',gap:4},children:[(0,Ae.jsxs)(G.T,{center:!0,size:18,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{center:!0,size:14,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.Muted,{center:!0,children:Is(e.id)})]}):(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.Muted,{children:Is(e.id)})]}),(0,Ae.jsx)(A.default,{style:Ze?{height:Math.max(280,Math.round((Je-40)*Cs(e.id)))}:{flex:1},children:vs(e.id)})]},e.id)),e.length{if(Nl)return void el(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rl[t]?Et(t):Dl(e)}},Al)}),zs='timeline'===Rt,Ms=Wt?(0,Ae.jsx)(H.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>zt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ae.jsxs)(A.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:Q.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ae.jsx)(E.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>zt(!1),style:{minHeight:64,minWidth:Je<600?120:180,paddingHorizontal:Je<600?14:22,borderRadius:16,borderWidth:2,borderColor:Q.colours.goldLight,backgroundColor:Q.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(G.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ae.jsx)(A.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ae.jsx)(G.T,{size:22,weight:"semibold",colour:Q.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${Nl?(0,Te.dayLong)(Al):'Today'}`})}),Je<600?null:(0,Ae.jsx)(A.default,{style:{minWidth:180}})]}),Xl?Zl:(0,Ae.jsx)(A.default,{style:{flex:1,minHeight:0},children:(0,Ae.jsx)(re.Timeline,{hideNow:!0,fit:!0,plan:Tt,bookings:Nl?Vl:vl,now:Nl?Kl:yt,privacy:St,turnBase:dt.settings.turnMins,t0:Nl?(0,q.addMins)(Kl,-Kl.getMinutes()):Ml,t1:Nl?(0,q.addMins)(ql,30):Hl,pauses:Nl?Ql:El,blockedTables:Nl?[]:Ol,onOpen:e=>{if(zt(!1),Nl)return void el(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rl[t]?Et(t):Dl(e)}},`full-${Al}`)})]})}):null,Hs=Nl?(0,Ae.jsxs)(A.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:Q.colours.gold,backgroundColor:Q.colours.goldTint},children:[(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:Gl?`Showing ${_l} \xb7 ${(0,q.niceDate)((0,q.parseYmd)(Al))}`:`Showing ${(0,Te.dayWord)(Al,kt)}`}),(0,Ae.jsx)(A.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${ds}. Showing ${(0,Te.dayLong)(Al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ae.jsx)(G.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ll(null),nl(null)},style:{minHeight:44}})]}):null,Ps=(0,Ae.jsx)(A.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:Ze?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,l])=>{const i='timeline'===e===(zs||Wt);return(0,Ae.jsx)(E.default,{testID:l,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Lt('plan'),zt(!0)):(zt(!1),Lt('plan'))},style:{flex:Ze?1:void 0,minHeight:Ze?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?Q.colours.gold:'transparent',...We.look.web(i?{backgroundImage:s.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:s.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Ae.jsx)(G.T,{size:Ze?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Es='display'!==k.APP_VARIANT||e?Ps:(0,Ae.jsxs)(A.default,{testID:"display-view-row",style:{flexDirection:Ze?'column':'row',flexWrap:Ze?'nowrap':'wrap',gap:6,alignItems:Ze?'stretch':'center'},children:[Ps,(0,Ae.jsx)(w.DisplayRotaKitchenButtons,{phone:Ze,shifts:xt,staff:pt,today:kt})]}),Os=(0,h.useBookingWrite)(),As=e=>(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"Walk-in",onPress:Dt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint}),(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"New booking",onPress:Dt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint}),(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Ut(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint})]});(0,Oe.useDisplayNotices)(rt,!e);const Ns=Ze?180:168,[_s,Gs]=(0,T.useState)(Ns),Vs=$.default.useRef(Ns),Fs=$.default.useRef(null),Us=$.default.useRef(null),Ks=()=>{const e=Fs.current,t=Us.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Xe<820?8:12,o=44+(Xe<820?4:8),n=i>Vs.current?Math.ceil(i-Vs.current):Se.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Ns,Math.floor(t-s-l)-n-o));Math.abs(Vs.current-a)>=2&&(Vs.current=a,Gs(a))})})};$.default.useEffect(()=>{const e=setTimeout(Ks,60);return()=>clearTimeout(e)},[Je,Xe]);const qs=(0,Ae.jsxs)(A.default,{ref:Us,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ks()},style:{flexDirection:'row',flexWrap:Je>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ze?12:6,justifyContent:Ze?'center':void 0,borderTopWidth:1,borderTopColor:Q.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ae.jsx)(Ee.DisplayClockButton,{}),(0,Ae.jsx)(ae.HoldToEdit,{quiet:!0,onUnlock:()=>{Il(null),jl({at:Date.now()})},onHint:()=>xl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ae.jsx)(ve.BlockBookingsButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,display:!0,day:Al}),Tt.areas.some(e=>e.outdoor)?(0,Ae.jsx)(ve.CloseGardenButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,short:!0}):null,(0,Ae.jsx)(E.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>bl(!0),style:({pressed:e})=>({...We.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR?null:(0,Ae.jsx)(f.GiftQrButton,{rid:rt,venue:dt.name})]}),Ys=Cl.length?(0,Ae.jsxs)(A.default,{testID:"takeaway-panel",style:[We.look.panel,{overflow:'hidden'}],children:[(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ae.jsx)(G.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ae.jsxs)(G.T,{size:12,colour:Q.colours.muted,children:[Cl.length," live"]})]}),(0,Ae.jsx)(A.default,{style:{padding:10},children:(0,Ae.jsx)(Ye,{list:Cl,me:jt,compact:!0,bookings:ut})})]}):null,Qs=(Le.DueToday,Nl?Vl:vl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Js=Nl?Gl?`${_l}\u2019s guests`:`Guests ${_l}`:'Today\u2019s guests',Xs=(0,Ae.jsxs)(Ae.Fragment,{children:[0===Qs.length?(0,Ae.jsx)(G.Muted,{children:Nl?Al{const t=(0,J.isSeatedHighlight)(e.status,{otherDay:Nl}),l=(0,he.guestRowText)(e,{name:e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)',''),seated:t}),s=Q.colours.text,i=t?Q.colours.goldLight:Q.colours.muted,o=Q.colours.gold,n=l.depositWarn?Q.colours.amber:Q.colours.goldLight;return(0,Ae.jsxs)(E.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Nl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Xt(!1),el(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,J.seatedHighlightStyle)({backgroundColor:e?_e:Ne,borderColor:Q.colours.gold,borderLeftColor:Q.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:Q.colours.hairline,backgroundColor:e?Q.colours.tilePressed:'transparent'},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ae.jsx)(G.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Ae.jsx)(G.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Ae.jsx)(A.default,{style:{paddingTop:2},children:(0,Ae.jsx)(M.AllergyIcon,{text:l.allergy,size:22,colour:Q.colours.amber,ink:Q.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Ae.jsxs)(G.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ae.jsx)(G.T,{size:16,colour:s,children:l.people}),l.deposit?(0,Ae.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,Ae.jsx)(G.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Ae.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}),(0,Ae.jsx)(G.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,Ae.jsx)(G.T,{size:16,children:" "}):null,l.dog?(0,Ae.jsx)(A.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ae.jsx)(ge.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,Ae.jsx)(Re.CancellationsSection,{items:rs,dayWord:Nl?Gl?_l.toLowerCase():`on ${_l}`:'today'})]}),Zs=(0,Ae.jsx)(O.default,{testID:"display-guest-list",accessibilityLabel:Js,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Xs}),ei=P.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Xt(!1)}}),ti=(0,Ae.jsxs)(E.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Js}, ${Qs.length}`,accessibilityState:{expanded:Jt},'aria-expanded':Jt,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Xt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:Jt?Q.colours.gold:Q.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?Q.colours.tilePressed:Jt?Q.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ae.jsx)(G.T,{size:16,weight:"bold",colour:Q.colours.gold,children:Qs.length}),(0,Ae.jsx)(A.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(A.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ae.jsxs)(G.T,{size:13,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,children:[Js," ",Jt?'\u2039':'\u203a']})})})]}),li=Jt?(0,Ae.jsxs)(A.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ae.jsxs)(A.default,{testID:"guests-drawer",...ei.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Je)),backgroundColor:Q.colours.surface,borderRightWidth:1,borderColor:Q.colours.gold,borderRadius:14,...We.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ae.jsxs)(A.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Ae.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Js.toUpperCase()," (",Qs.length,")"]}),(0,Ae.jsx)(l.GoldClose,{testID:"guests-close",label:`Close ${Js}`,onPress:()=>Xt(!1),style:{marginRight:-6}})]}),as.count?(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,testID:"cancelled-day-tally-guests",children:ds}):null]}),Zs]}),(0,Ae.jsx)(E.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Js}`,accessibilityRole:"button",onPress:()=>Xt(!1),style:{flex:1}})]}):null,si=Xl?Zl:s.IS_KIRKTON&&!Object.values(dt.kitchenHours??{}).some(Boolean)?(0,Ae.jsxs)(A.default,{testID:"kirkton-hours-to-confirm",style:[We.look.panel,{padding:14,gap:8}],children:[(0,Ae.jsx)(G.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ae.jsx)(G.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ae.jsx)(Se.DayGraph,{busyThreshold:(0,t.venueBusy)(dt,ut,yt).busy,todays:Vl,open:Kl,close:ql,now:yt,turnBase:dt.settings.turnMins,blocks:cs,pauses:Ql,compact:Ze,dense:!Ze,fit:tt,tight:tt&&Xe<600,height:Ns,forecastNote:Nl?void 0:xs,emptyText:es,past:Al{Nl?Xt(!0):zt(!0)},ai=(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',padding:Xe<820?8:12,paddingTop:Xe<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[It?null:ti,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[It?null:Hs,It?(0,Ae.jsx)(O.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ae.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"})}):zs?Ws:Ls,Ms,li]}),(0,Ae.jsxs)(A.default,{testID:"display-side",style:{width:st,gap:Xe<820?4:8,minHeight:0},children:[(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:As(!1)}),(0,Ae.jsx)(A.default,{style:{flexShrink:0},children:Es}),It?null:(0,Ae.jsx)(A.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,compact:Xe<820,snug:Xe<820,tight:Xe<700,sound:(0,L.flapSoundOn)(),onPress:ni})}),It?null:(0,Ae.jsx)(A.default,{ref:Fs,testID:"day-graph-slot",onLayout:Ks,style:{flexGrow:0,flexShrink:1,flexBasis:Ns+52,minHeight:Xe<600?90:120,overflow:'visible'},children:ii}),(0,Ae.jsxs)(O.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Ae.jsx)(E.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>hl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ae.jsx)(G.T,{center:!0,weight:"semibold",children:"Reviews"})}),Ys,(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt})]})]})]});return(0,Ae.jsxs)(_.SafeAreaView,{style:{flex:1,backgroundColor:Q.colours.bg},onTouchStart:()=>{ol.current=Date.now()},onMouseDown:()=>{ol.current=Date.now()},children:[Ze?(0,Ae.jsxs)(A.default,{style:{flex:1},children:[(0,Ae.jsxs)(O.default,{ref:it,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ae.jsxs)(A.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ae.jsx)(A.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ae.jsx)(j.ExitButton,{})}),(0,Ae.jsx)(U.RestaurantLogo,{rid:rt,size:64}),(0,Ae.jsx)(G.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:dt.name}),(0,Ae.jsx)(U.PoweredBy,{}),(0,Ae.jsx)(C.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ae.jsx)(A.default,{accessible:!0,accessibilityLabel:`Current time ${(0,q.hm)(yt)}`,children:(0,Ae.jsx)(G.T,{center:!0,size:30,weight:"semibold",colour:Q.colours.goldLight,children:(0,q.hm)(yt)})}),(0,Ae.jsx)(Me.ShellfishChip,{rid:rt,by:jt,app:"display",size:"m"}),(0,Ae.jsx)(Me.SundayRoastChip,{rid:rt,by:jt,app:"display",size:"m"}),K]}),He,oi,(0,Ae.jsx)(A.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ae.jsx)(Ke,{phone:!0,split:ns,items:[{label:`Tables \xb7 ${_l}`,value:is.length,testID:'badge-tables'},{label:`Covers \xb7 ${_l}`,value:os,testID:'badge-covers'},{label:'Takeaway',value:Cl.length,alert:Cl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Vt(!0)}]})}),(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{gap:8},children:As(!0)}),(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),Es,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[zs?Ws:Ls,Ms]}),(0,Ae.jsxs)(A.default,{onLayout:e=>{ot.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[We.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ae.jsxs)(G.T,{center:!0,size:20,weight:"semibold",colour:Q.colours.goldLight,accessibilityRole:"header",children:[Js," (",Qs.length,")"]}),(0,Ae.jsx)(A.default,{testID:"display-guest-list",accessibilityLabel:Js,style:{gap:4},children:Xs})]}),Ys,ii,(0,Ae.jsx)(A.default,{testID:"covers-dock",children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,compact:!0,sound:(0,L.flapSoundOn)(),onPress:()=>it.current?.scrollTo({y:ot.current,animated:!0})})}),(0,Ae.jsxs)(A.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ae.jsx)(G.T,{center:!0,size:14,colour:St?Q.colours.muted:Q.colours.amber,children:St?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ae.jsx)(G.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Ae.jsx)(G.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>hl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),qs]}),e?null:(0,Ae.jsx)(A.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:Q.colours.hairline},children:(0,Ae.jsx)(z.VoiceSlot,{size:56})})]}):(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Je>=1e3?18:14,paddingVertical:Xe<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),...We.look.web({backgroundImage:s.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Ae.jsx)(A.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ae.jsx)(U.RestaurantBrand,{rid:dt.id,size:Je<900?32:40,beside:!0})}),(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ae.jsx)(G.T,{size:Je<900?18:21,weight:"semibold",colour:Q.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,q.hm)(yt)}),Je>=900?(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,children:(0,q.niceDate)(yt)}):null]})]}),It?(0,Ae.jsx)(A.default,{style:{width:220}}):(0,Ae.jsx)(A.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:oi}),(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ae.jsx)(Me.ShellfishChip,{rid:rt,by:jt,app:"display",size:Je<1200?'xs':Je<1280||Xe<700?'s':'m'}),(0,Ae.jsx)(E.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.muted,children:"?"})}),'simulated'===bt?(0,Ae.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>gt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(G.T,{size:11,colour:Q.colours.muted,children:"+15"})}):null,e?null:(0,Ae.jsx)(j.ExitButton,{}),K,Pe?null:(0,Ae.jsx)(z.VoiceSlot,{size:44})]})]}),He,It?null:(0,Ae.jsxs)(A.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,Ae.jsx)(Ke,{splitOnly:!0,split:ns,items:[]}),(0,Ae.jsx)(A.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Je>=1e3?18:14)+(e?0:52)+('simulated'===bt?52:0),zIndex:4},children:(0,Ae.jsx)(Me.SundayRoastChip,{rid:rt,by:jt,app:"display",size:Je<1100||Xe<700?'s':'m'})})]}),tt?ai:(ri=(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:As(!1)}),Es]}),(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),It?(0,Ae.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"}):(0,Ae.jsx)(Ae.Fragment,{children:(0,Ae.jsxs)(A.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[ti,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Hs,zs?Ws:Ls,Ms,li]})]})}),Ys,It?null:(0,Ae.jsx)(A.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,sound:(0,L.flapSoundOn)(),onPress:ni})}),It?null:(0,Ae.jsx)(A.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Ns+Se.DAY_GRAPH_CHROME},children:ii})]}),(0,Ae.jsx)(O.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:ri})),qs]}),(0,Ae.jsx)(I.SoldOutStrip,{rid:rt,by:wt,onOpen:()=>bl(!0)}),(0,Ae.jsx)(D.SoldOutSheet,{visible:gl,onClose:()=>bl(!1),rid:rt,by:wt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ae.jsx)(p.TableOrderCue,{rid:rt}),Dt.elements,Ft?(0,Ae.jsx)(y.EditBookingPicker,{rid:rt,today:kt,who:jt,hidePrivate:!0,onClose:()=>Ut(!1)}):null,Kt?(0,Ae.jsx)(y.EditBookingSheet,{rid:rt,id:Kt,who:jt,hidePrivate:!0,onClose:()=>qt(null)}):null,Pt?(0,Ae.jsx)(me.TableSheet,{rid:rt,name:Pt,view:Rl,plan:Tt,todays:vl,now:yt,privacy:St,turnBase:dt.settings.turnMins,onClose:()=>Et(null),onWalkIn:e=>Dt.openWalkInAt(e),onMove:e=>At(e),onDetails:Dl}):null,ls?(()=>{const e=ts[ls],t=e?.dayBookings??[];return(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>ss(null),title:`${(0,d.tableNumbers)(ls)} \xb7 ${Gl?_l:(0,Te.dayLong)(Al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ae.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${Gl?_l.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${Gl?_l.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ue.privName)(e,St):Ve(e.name);return(0,Ae.jsx)(G.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,fe.tablesWords)((0,te.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ss(null),el(e.id)},style:{minHeight:56}},e.id)}),(0,Ae.jsx)(G.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ss(null),style:{minHeight:56}})]})})():null,Zt?(()=>{const e=ut.find(e=>e.id===Zt);return e?(0,Ae.jsx)(be.GuestActionsSheet,{rid:rt,b:e,name:e.walkIn?(0,ue.privName)(e,St):Ve(e.name),view:Rl,now:yt,otherDay:e.date!==kt,turnBase:dt.settings.turnMins,onClose:()=>el(null),onDetails:Dl,onDone:xl,onPickOnPlan:(e,t)=>{Xt(!1),Lt('plan'),Ht('all'),ll({id:e.id,tables:t})}}):null})():null,Nt?(0,Ae.jsx)(me.DetailsPanel,{title:Nt.title,onClose:()=>_t(null),children:Nt.body}):null,Yt?(0,Ae.jsx)(me.ServiceSummary,{r:dt,todays:vl,orders:ct,waitlistAll:al,walkInCount:rl,onClose:()=>Qt(!1)}):null,dl?(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>cl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ae.jsx)(g.FloorLegend,{}),(0,Ae.jsx)(G.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>cl(!1)})]}):null,ul?(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>hl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ae.jsx)(V.ReviewsSection,{rid:rt,mode:"read",venueName:dt.name}),(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>hl(!1)})]}):null,Gt?(0,Ae.jsxs)(me.DetailsPanel,{title:"Takeaway",onClose:()=>Vt(!1),children:[(0,Ae.jsx)(G.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ae.jsx)(Ye,{list:Cl,me:jt,bookings:ut})]}):null,ml?(0,Ae.jsx)(A.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:Q.colours.bg},children:(0,Ae.jsx)(ne.PlanDesigner,{initial:Tt,venue:dt.name,mode:"display",startStep:"arrange",onActivity:()=>{wl.current=Date.now(),null!==kl&&Il(null)},notice:null!==kl?`Locking again in ${kl} s \xb7 touch to keep editing`:null,onSave:e=>{te.useFloor.getState().setPlan(rt,e),jl(null),xl('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{te.useFloor.getState().setPlan(rt,e),xl('Live seating plan updated on every screen.')},onCancel:()=>{jl(null),xl('No changes kept. Editing is locked again.')}},ml.at)}):null,e?null:(0,Ae.jsx)(de.Screensaver,{rid:rt,idleMins:vt.idleMins,pinOn:vt.pinOn,wake:vt,tonightCards:vt.tonightCards,cfg:Ct}),e?null:(0,Ae.jsx)(we.PrintHost,{rid:rt}),e?null:(0,Ae.jsx)(je.AlertHost,{variant:"display",rid:rt,skipTakeaway:!0}),e?null:(0,Ae.jsx)(W.SeatAllergenReminder,{rid:rt}),e?null:(0,Ae.jsx)(ke.TakeawayTakeover,{rid:rt,me:jt})]});var ri};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=e(T),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=_r(_d[30]),z=_r(_d[31]),M=_r(_d[32]),H=e(_r(_d[33])),P=e(_r(_d[34])),E=e(_r(_d[35])),O=e(_r(_d[36])),A=e(_r(_d[37])),N=e(_r(_d[38])),_=_r(_d[39]),G=_r(_d[40]),V=_r(_d[41]),F=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]),Pe=_r(_d[88]),Ee=_r(_d[89]),Oe=_r(_d[90]),Ae=_r(_d[91]);const Ne='#221C12',_e='#2E2618',Ge=12e4,Ve=e=>(e??'').replace(' (example)',''),Fe=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Ue=e=>e.slotTime?(0,q.hm)(new Date(e.slotTime)):'ASAP';function Ke({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,Ae.jsxs)(A.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Ae.jsx)(A.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,Ae.jsxs)(A.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,Ae.jsx)(G.T,{size:l?24:19,weight:"semibold",colour:e.alert?Q.colours.amber:Q.colours.text,children:e.value}),(0,Ae.jsx)(G.T,{size:l?14:12,colour:Q.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ae.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ae.jsx)($.default.Fragment,{children:i},e.testID)})}),s?(0,Ae.jsx)(A.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,Ae.jsx)(G.T,{size:14,colour:Q.colours.muted,children:"No Covers yet"}):(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ae.jsx)(G.T,{size:i?13:14,weight:"semibold",colour:Q.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,Ae.jsx)(G.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,Ae.jsxs)(A.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:Q.colours.gold},children:[(0,Ae.jsx)(A.default,{style:{width:`${s.walkInPct}%`,backgroundColor:Q.colours.gold}}),(0,Ae.jsx)(A.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function qe({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,Ae.jsxs)(E.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Ae.jsx)(A.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Ae.jsx)(G.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?Q.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,Ae.jsx)(G.T,{size:12,colour:Q.colours.muted,children:l}):null]})}function Ye({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,Pe.statusBlock)(e,t,(0,Pe.linkedBooking)(e,s));return e.length?(0,Ae.jsx)(A.default,{style:{gap:8},children:e.map(e=>(0,Ae.jsxs)(A.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:Q.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?Q.colours.ok:e.allergies.length?Q.colours.red:Q.colours.gold},children:[(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Ae.jsxs)(G.T,{size:l?16:18,weight:"bold",children:[Ue(e)," \xb7 ",Ve(e.customerName)]}),(0,Ae.jsx)(G.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,Ae.jsxs)(G.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,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:Q.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,K.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ae.jsx)(He.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ae.jsxs)(G.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ae.jsx)(G.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>Y.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Ae.jsx)(G.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Ae.jsx)(G.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Ae.jsx)(we.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ae.jsx)(G.Muted,{children:"No takeaway orders right now."})}function Qe({rid:e,id:t,turnBase:l}){const s=(0,Y.useBookings)(e).find(e=>e.id===t);return s?(0,Ae.jsx)(b.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1315,[1141,796,5,6,1316,828,853,1117,860,1140,1317,1318,1319,1114,1135,1320,1321,1326,1327,1328,872,1329,1153,980,1122,1330,34,1094,1178,1044,1110,1136,1331,395,380,402,295,102,426,36,794,1220,1224,873,861,858,874,821,1113,892,1119,1084,1025,1100,1127,1332,1126,1333,1340,1342,1345,1348,1344,1349,1351,1352,1132,1116,1118,878,1356,1209,1357,1219,1211,1022,1362,1370,1371,1097,1134,1373,1374,1375,1166,1376,1165,1159,869,1377,1378,25]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ge}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:b,headerExtra:K,subHeader:Me,noVoice:Pe=!1}={}){const Ue=(0,N.default)(),Je=b??Ue.width,Xe=Ue.height,Ze=Je<700,et=Je>=Xe,tt=!Ze&&et&&Je>=600,st=tt,lt=Math.round(Math.min(520,Math.max(Je>=1e3?448:280,.3*Je))),it=$.default.useRef(null),ot=$.default.useRef(0),[nt,at]=(0,T.useState)({w:0,h:0}),rt=(0,X.useOwner)(e=>e.site),dt=(0,Y.useRestaurant)(rt);(0,Ie.useAlertWatcher)(rt,{enabled:!e});const ct=(0,Y.useOrders)(rt),ut=(0,Y.useBookings)(rt),ht=(0,Y.useEvents)(rt),gt=(0,Y.useStore)(e=>e.skipMinutes),bt=(0,Y.useStore)(e=>e.clock.mode),yt=(0,Y.useNow)(5e3),pt=(0,X.useOwner)(e=>e.staff),ft=(0,X.useOwner)(e=>e.attendance),mt=(0,X.useOwner)(e=>e.shifts);$.default.useEffect(()=>{(0,ee.ensureAttendance)((0,q.ymd)(yt),yt)},[(0,q.ymd)(yt)]);const xt=ft.filter(e=>e.in&&!e.out&&yt.getTime()-new Date(e.in).getTime()<72e6&&yt.getTime()>=new Date(e.in).getTime()),jt=Fe(pt.find(e=>e.id===xt[0]?.staffId)?.name)||'Duty Manager',wt=k.IS_CAR?'Car':'Display';(0,D.useSoldOutLink)(!1,e?void 0:wt,!0);const kt=(0,q.ymd)(yt),It=(0,R.useTravelDay)('display',kt),vt=(0,Z.useFrontDoor)(kt,et),Dt=(0,te.useDisplaySettings)(rt),St=Dt.privacy,Ct=(0,ce.useSaverSync)(),Tt=(0,te.usePlan)(rt),$t=(0,te.useFloor)(e=>e.live[rt]),Bt=(0,ve.useBlocks)(e=>e.blocks),[Rt,Lt]=(0,T.useState)('plan'),[zt,Wt]=(0,T.useState)(!1),[Ht,Mt]=(0,T.useState)('all'),[Pt,Et]=(0,T.useState)(null),[At,Ot]=(0,T.useState)(null),[Nt,_t]=(0,T.useState)(null),[Gt,Ft]=(0,T.useState)(!1),[Vt,Ut]=(0,T.useState)(!1),[Kt,qt]=(0,T.useState)(null),[Yt,Qt]=(0,T.useState)(!1),[Jt,Xt]=(0,T.useState)(!1),[Zt,es]=(0,T.useState)(null),[ts,ss]=(0,T.useState)(null),[ls,is]=(0,T.useState)(null),os=$.default.useRef(0),ns=e=>{os.current=Date.now(),is(e)};$.default.useEffect(()=>{if(!ls)return;const e=setInterval(()=>{Date.now()-os.current>=Te.DAY_IDLE_MS&&is(null)},5e3);return()=>clearInterval(e)},[ls]);const as=(0,Y.useWaitlist)(rt),rs=(0,Y.useStore)(e=>e.walkIns[rt]??0),[ds,cs]=(0,T.useState)(!1),[us,hs]=(0,T.useState)(!1),[gs,bs]=(0,T.useState)(!1);(0,V.useReviewAlerts)(rt);const[ys,ps]=(0,T.useState)({view:0,content:0}),[fs,ms]=(0,T.useState)(null);$.default.useEffect(()=>{fs&&((0,S.notify)({id:`floor-note:${Date.now()}`,title:fs,timeoutMs:4500,big:!0,testID:'floor-toast'}),ms(null))},[fs]),$.default.useEffect(()=>{if(!e)return(0,L.setDisplaySilent)(!0),()=>(0,L.setDisplaySilent)(!1)},[e]);const[xs,js]=(0,T.useState)(null),ws=$.default.useRef(0),[ks,Is]=(0,T.useState)(null);$.default.useEffect(()=>{if(!xs)return;ws.current=Date.now();const e=setInterval(()=>{const e=Date.now()-ws.current;if(e>=Ge)return js(null),void ms('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Is(e>=105e3?Math.ceil((Ge-e)/1e3):null)},1e3);return()=>clearInterval(e)},[xs]);const vs=e=>e.date!==kt?_t({title:`Guest details \xb7 ${(0,Te.dayWord)(e.date,kt)} ${e.time}`,body:(0,Oe.jsxs)(Oe.Fragment,{children:[!e.walkIn&&e.date>kt?(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Te.dayWord)(e.date,kt)}, ${e.time}`,disabled:!Fl.ok,accessibilityHint:Fl.hint,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}):null,(0,xe.bookingDetails)(e)]})}):_t({title:`Guest details \xb7 ${e.time}`,body:(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsx)(Qe,{rid:rt,id:e.id,turnBase:dt.settings.turnMins}),e.walkIn?null:(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}),e.walkIn?(0,Oe.jsx)(ye.CancelWalkInButton,{rid:rt,b:e,big:!0,onDone:e=>{_t(null),ms(e)}}):null,e.walkIn?(0,Oe.jsx)(ye.ReinstateWalkInButton,{rid:rt,b:e,today:kt,onDone:e=>{_t(null),ms(e)}}):null,(0,xe.bookingDetails)(e)]})}),Ds=ut.filter(e=>e.date===kt).sort((e,t)=>e.time.localeCompare(t.time)),Ss=Ds.filter(e=>!['cancelled','noshow'].includes(e.status)),Cs=ct.filter(Ve).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ts=(0,T.useMemo)(()=>(0,c.forecastToday)(dt,ut,ct,ht,yt),[dt,ut,ct,ht,yt.getTime()/6e4|0]),$s=(0,ve.closedAreasAt)(Bt,rt,kt,(0,q.hm)(yt)),Bs=[...$s].join(','),Rs=(0,T.useMemo)(()=>(0,se.floorView)(Tt,ut,ct,$t??{},yt,dt.settings.turnMins,$s),[Tt,ut,ct,$t,yt.getTime(),Bs]),Ls=(0,me.hoursFor)(dt,yt),zs=Ls?.open??new Date(`${kt}T12:00:00`),Ws=Ls?.close??new Date(`${kt}T21:00:00`),Hs=(0,q.addMins)(zs,-zs.getMinutes()),Ms=(0,q.addMins)(Ws,30),Ps=e=>new Date(`${kt}T${e}:00`),Es=(0,ve.blocksOn)(Bt,rt,kt).map(e=>({from:Ps(e.from),to:Ps(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(dt,yt,kt)),As=Object.keys(Rs).filter(e=>'blocked'===Rs[e]?.status),Os=ls&&ls!==kt?ls:kt,Ns=Os!==kt,_s=(0,Te.dayWord)(Os,kt),Gs=/^(Today|Yesterday|Tomorrow)$/.test(_s),Fs=Ns?(0,Te.bookingsForDay)(ut,Os,kt).sort((e,t)=>e.time.localeCompare(t.time)):Ds,Vs=(0,q.parseYmd)(Os);Vs.setHours(12);const Us=Ns?(0,me.hoursFor)(dt,Vs):Ls,Ks=Us?.open??new Date(`${Os}T12:00:00`),qs=Us?.close??new Date(`${Os}T21:00:00`),Ys=e=>new Date(`${Os}T${e}:00`),Qs=[...Ns?(0,ve.blocksOn)(Bt,rt,Os).map(e=>({from:Ys(e.from),to:Ys(e.to),label:e.reason??'Paused'})):Es,...Ns?(0,o.queuedServicePauses)(dt,Vs,Os):[]],Js=(0,o.queuedServiceSessions)(dt,Vs),Xs=l.IS_QUEUED_VENUE&&(void 0===Js||!Js.length),Zs=(0,Oe.jsxs)(O.default,{testID:"queued-hours-gate",style:[ze.look.panel,{padding:14,gap:8}],children:[(0,Oe.jsx)(G.T,{weight:"semibold",children:void 0===Js?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Oe.jsx)(G.Muted,{children:i.queuedVenues[rt]?.hours.note})]}),el=Ns?Us||Fs.length?OsNs?(0,se.dayFloorView)(Tt,Fs,Os):Rs,[Ns,Tt,Fs,Os,Rs]),[sl,ll]=(0,T.useState)(null),[il,ol]=(0,T.useState)(null),[nl,al]=(0,T.useState)(null),rl=Ns?Fs.filter(e=>!['cancelled','noshow'].includes(e.status)):Ss,dl=rl.reduce((e,t)=>e+t.partySize,0),cl=(0,u.coversSplit)(rl,Os),ul=(0,$e.cancelledDayTally)(ut,Os),hl=(0,Be.cancellationsFor)(ut,Os,e=>e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)','')),gl=(0,$e.cancelledTallyWords)(ul,Gs?_s.toLowerCase():Ns?`on ${_s}`:'today'),bl=Bt.filter(e=>e.rid===rt&&e.date===Os&&!e.removedAt),yl=(0,Ce.chartBands)(bl,60*Ks.getHours()+Ks.getMinutes(),60*qs.getHours()+qs.getMinutes()),pl=new Set((0,Ce.blockedHours)(yl)),fl=yt.getHours()+(yt.getMinutes()>=30?1:0),ml=Ts.hours.filter(e=>e.hour>=fl&&!pl.has(e.hour)),xl=ml.reduce((e,t)=>e+t.coversHigh,0),jl=ml.reduce((e,t)=>e+t.coversLow,0),wl=Math.round((jl+xl)/2),kl=!Ts.example&&Ts.open&&Ts.enough&&xl>0?`Usually ${(0,c.coversRange)(wl,wl)} more`:void 0,Il=async(e,t)=>{const s=Rs[e]?.booking;if(!s||e===t)return;const l=Rs[t]?.status;if(l&&!['free','soon'].includes(l))return void ms('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${se.STATUS[l].label.toLowerCase()}. Pick a free table.`);await Y.repo.bookings.update(s.id,{table:t});const i=$t?.[e]?.stage;te.useFloor.getState().setLive(rt,t,{stage:i??'seated',dirty:!1}),te.useFloor.getState().setLive(rt,e,{stage:void 0,dirty:!0}),ms(`${(0,ue.privName)(s,St)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`)},vl=e=>{if(ts)return ol(null),void ss(t=>t?{...t,tables:(0,fe.toggleTable)(t.tables,e)}:t);Ns?ll(e):At?(e!==At&&Il(At,e),Ot(null)):Et(e)},Dl=ts?ut.find(e=>e.id===ts.id):void 0,Sl=ts&&Dl?(()=>{const e=Dl.walkIn?(0,ue.privName)(Dl,St):Fe(Dl.name),t=(0,fe.seatsOf)(Tt,ts.tables).total,s=(0,fe.seatLine)(t,Dl.partySize),l=(0,fe.pickClashes)(Dl,ts.tables,ut.filter(e=>e.date===Dl.date),dt.settings.turnMins),i=(0,fe.tableKey)(ts.tables)!==(0,fe.tableKey)((0,te.tablesOf)(Dl.table));return(0,Oe.jsxs)(O.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:Q.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:Q.colours.gold,padding:10},children:[(0,Oe.jsxs)(O.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Te.dayWord)(Dl.date,kt)} ${Dl.time}. Tap tables on the plan to add or take them off. ${(0,fe.tablesWords)(ts.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Te.dayWord)(Dl.date,kt)," ",Dl.time]}),(0,Oe.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[(0,fe.tablesWords)(ts.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),il?(0,Oe.jsx)(O.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:il,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:Q.colours.amber,backgroundColor:Q.colours.amberBg},children:(0,Oe.jsx)(G.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:il})}):null,(0,Oe.jsxs)(G.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Oe.jsx)(G.Button,{testID:il?'plan-pick-overcap-yes':'plan-pick-save',label:il?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${il?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,fe.tablesWords)(ts.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Dl)return void ss(null);const s=(0,fe.overCapacityAsk)(ts.tables,t,Dl.partySize);if(!s||il){ol(null);try{await(0,pe.saveBookingTables)(rt,Dl,ts.tables),ms((0,fe.savedWords)(e,Dl.partySize,ts.tables,t))}catch(t){ms(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}ss(null)}else ol(s)}}),(0,Oe.jsx)(G.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{ol(null),ss(null)}})]})]})})():null,Cl=Tt.areas.filter(e=>Tt.tables.some(t=>t.areaId===e.id)),Tl=e=>{const t=Tt.tables.filter(t=>t.areaId===e);return Ns?`${t.filter(e=>!tl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Rs[e.name]?.status??'free')).length}/${t.length} free`},$l='all'===Ht||Cl.some(e=>e.id===Ht)?Ht:'all',Bl=e=>(0,Oe.jsx)(le.FloorCanvas,{plan:Tt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:tt,big:!0,view:tl,privacy:St,turnBase:dt.settings.turnMins,highlight:ts?ts.tables:At?[At]:void 0,onTap:e=>vl(e.name),onDrop:(e,t)=>ts||Ns?void 0:Il(e.name,t.name)}),Rl=Ze?1:et||Cl.length>2?2:1,Ll=e=>{const t=Tt.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},zl=[];for(let e=0;e{const t=(0,le.areaBounds)(Tt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,le.minReadableScale)(Tt,e.id)}}),nt.w,nt.h):null,Hl=e=>(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between',height:ie.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,children:Tl(e.id)})]}),Ml=(0,Oe.jsx)(O.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-nt.w)>1||Math.abs(s-nt.h)>1)&&at({w:t,h:s})},children:Wl?(0,Oe.jsx)(A.default,{style:{flex:1},scrollEnabled:Wl.scroll,showsVerticalScrollIndicator:Wl.scroll,contentContainerStyle:{gap:ie.GRID_GAP},children:Wl.rows.map((e,t)=>(0,Oe.jsx)(O.default,{style:{height:Wl.rowHeights[t],flexDirection:'row',gap:ie.GRID_GAP},children:e.map(e=>{const t=Cl.find(t=>t.id===e);return(0,Oe.jsxs)(O.default,{testID:`area-cell-${e}`,style:{width:Wl.cellW,gap:2},children:[Hl(t),(0,Oe.jsx)(O.default,{style:{flex:1},children:Bl(e)})]},e)})},t))}):null}),Pl=(0,Oe.jsxs)(O.default,{testID:"venue-plan",style:{flex:Ze?void 0:1,gap:10,minWidth:0},children:[(0,Oe.jsx)(r.TableNumberWarning,{plan:Tt}),Tt.tables.length?null:(0,Oe.jsxs)(O.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Oe.jsx)(G.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Oe.jsx)(G.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,Oe.jsx)(G.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,Oe.jsx)(qe,{chipId:"all",compact:!Ze,label:"Whole venue",selected:'all'===$l,onPress:()=>Mt('all')},"__all"),...Cl.map(e=>(0,Oe.jsx)(qe,{chipId:e.id,compact:!Ze,label:`${e.name}${(0,oe.areaMarks)(e)}`,colour:(0,Q.brandColour)(e.colour),sub:Ze?$s.has(e.id)?'closed':$l===e.id?Tl(e.id):void 0:void 0,selected:$l===e.id,onPress:()=>Mt(e.id)},e.id))];return Ze?(0,Oe.jsx)(O.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Oe.jsx)(A.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;ps(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>ps(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:ys.view>0&&ys.content>0&&ys.content<=ys.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:ys.view>0&&ys.content<=ys.view+1?'100%':void 0},children:e})})(),(0,Oe.jsx)(g.FloorLegend,{}),Sl,At?(0,Oe.jsxs)(G.Row,{gap:8,style:{backgroundColor:Q.colours.goldTint,borderRadius:10,padding:8},children:[(0,Oe.jsxs)(G.T,{weight:"semibold",colour:Q.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(At),": tap the new table."]}),(0,Oe.jsx)(G.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ot(null)})]}):null,'all'===$l&&tt?Ml:'all'===$l?(0,Oe.jsx)(O.default,{style:{flex:Ze?void 0:1,gap:12,minHeight:st?void 0:360},children:zl.map((e,t)=>(0,Oe.jsxs)(O.default,{style:{flex:Ze?void 0:Math.max(.3,...e.map(e=>Ll(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Oe.jsxs)(O.default,{style:{flex:1,gap:2},children:[Ze?(0,Oe.jsxs)(O.default,{style:{alignItems:'center',gap:4},children:[(0,Oe.jsxs)(G.T,{center:!0,size:18,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{center:!0,size:14,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.Muted,{center:!0,children:Tl(e.id)})]}):(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.Muted,{children:Tl(e.id)})]}),(0,Oe.jsx)(O.default,{style:Ze?{height:Math.max(280,Math.round((Je-40)*Ll(e.id)))}:{flex:1},children:Bl(e.id)})]},e.id)),e.length{if(Ns)return void es(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rs[t]?Et(t):vs(e)}},Os)}),Al='timeline'===Rt,Ol=zt?(0,Oe.jsx)(M.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Wt(!1),supportedOrientations:['landscape','portrait'],children:(0,Oe.jsxs)(O.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:Q.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Oe.jsx)(E.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Wt(!1),style:{minHeight:64,minWidth:Je<600?120:180,paddingHorizontal:Je<600?14:22,borderRadius:16,borderWidth:2,borderColor:Q.colours.goldLight,backgroundColor:Q.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(G.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Oe.jsx)(O.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Oe.jsx)(G.T,{size:22,weight:"semibold",colour:Q.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${Ns?(0,Te.dayLong)(Os):'Today'}`})}),Je<600?null:(0,Oe.jsx)(O.default,{style:{minWidth:180}})]}),Xs?Zs:(0,Oe.jsx)(O.default,{style:{flex:1,minHeight:0},children:(0,Oe.jsx)(re.Timeline,{hideNow:!0,fit:!0,plan:Tt,bookings:Ns?Fs:Ds,now:Ns?Ks:yt,privacy:St,turnBase:dt.settings.turnMins,t0:Ns?(0,q.addMins)(Ks,-Ks.getMinutes()):Hs,t1:Ns?(0,q.addMins)(qs,30):Ms,pauses:Ns?Qs:Es,blockedTables:Ns?[]:As,onOpen:e=>{if(Wt(!1),Ns)return void es(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rs[t]?Et(t):vs(e)}},`full-${Os}`)})]})}):null,Nl=Ns?(0,Oe.jsxs)(O.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:Q.colours.gold,backgroundColor:Q.colours.goldTint},children:[(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:Gs?`Showing ${_s} \xb7 ${(0,q.niceDate)((0,q.parseYmd)(Os))}`:`Showing ${(0,Te.dayWord)(Os,kt)}`}),(0,Oe.jsx)(O.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${gl}. Showing ${(0,Te.dayLong)(Os)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Oe.jsx)(G.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ss(null),ns(null)},style:{minHeight:44}})]}):null,_l=(0,Oe.jsx)(O.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:Ze?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(Al||zt);return(0,Oe.jsx)(E.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?(Lt('plan'),Wt(!0)):(Wt(!1),Lt('plan'))},style:{flex:Ze?1:void 0,minHeight:Ze?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?Q.colours.gold:'transparent',...ze.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,Oe.jsx)(G.T,{size:Ze?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Gl='display'!==k.APP_VARIANT||e?_l:(0,Oe.jsxs)(O.default,{testID:"display-view-row",style:{flexDirection:Ze?'column':'row',flexWrap:Ze?'nowrap':'wrap',gap:6,alignItems:Ze?'stretch':'center'},children:[_l,(0,Oe.jsx)(w.DisplayRotaKitchenButtons,{phone:Ze,shifts:mt,staff:pt,today:kt})]}),Fl=(0,h.useBookingWrite)(),Vl=e=>(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsx)(We.BigAction,{premium:!0,label:"Walk-in",onPress:vt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint}),(0,Oe.jsx)(We.BigAction,{premium:!0,label:"New booking",onPress:vt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint}),(0,Oe.jsx)(We.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Ut(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint})]});(0,Ae.useDisplayNotices)(rt,!e);const Ul=Ze?180:168,[Kl,ql]=(0,T.useState)(Ul),Yl=$.default.useRef(Ul),Ql=$.default.useRef(null),Jl=$.default.useRef(null),Xl=()=>{const e=Ql.current,t=Jl.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,s,l,i)=>{t.measureInWindow((e,t)=>{const l=Xe<820?8:12,o=44+(Xe<820?4:8),n=i>Yl.current?Math.ceil(i-Yl.current):Se.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Ul,Math.floor(t-l-s)-n-o));Math.abs(Yl.current-a)>=2&&(Yl.current=a,ql(a))})})};$.default.useEffect(()=>{const e=setTimeout(Xl,60);return()=>clearTimeout(e)},[Je,Xe]);const Zl=(0,Oe.jsxs)(O.default,{ref:Jl,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xl()},style:{flexDirection:'row',flexWrap:Je>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ze?12:6,justifyContent:Ze?'center':void 0,borderTopWidth:1,borderTopColor:Q.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Oe.jsx)(Ee.DisplayClockButton,{}),(0,Oe.jsx)(ae.HoldToEdit,{quiet:!0,onUnlock:()=>{Is(null),js({at:Date.now()})},onHint:()=>ms('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Oe.jsx)(De.BlockBookingsButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,display:!0,day:Os}),Tt.areas.some(e=>e.outdoor)?(0,Oe.jsx)(De.CloseGardenButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,short:!0}):null,(0,Oe.jsx)(E.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>bs(!0),style:({pressed:e})=>({...ze.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR?null:(0,Oe.jsx)(f.GiftQrButton,{rid:rt,venue:dt.name})]}),ei=Cs.length?(0,Oe.jsxs)(O.default,{testID:"takeaway-panel",style:[ze.look.panel,{overflow:'hidden'}],children:[(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Oe.jsx)(G.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Oe.jsxs)(G.T,{size:12,colour:Q.colours.muted,children:[Cs.length," live"]})]}),(0,Oe.jsx)(O.default,{style:{padding:10},children:(0,Oe.jsx)(Ye,{list:Cs,me:jt,compact:!0,bookings:ut})})]}):null,ti=(Le.DueToday,Ns?Fs:Ds.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),si=Ns?Gs?`${_s}\u2019s guests`:`Guests ${_s}`:'Today\u2019s guests',li=(0,Oe.jsxs)(Oe.Fragment,{children:[0===ti.length?(0,Oe.jsx)(G.Muted,{children:Ns?Os{const t=(0,J.isSeatedHighlight)(e.status,{otherDay:Ns}),s=(0,he.guestRowText)(e,{name:e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)',''),seated:t}),l=Q.colours.text,i=t?Q.colours.goldLight:Q.colours.muted,o=Q.colours.gold,n=s.depositWarn?Q.colours.amber:Q.colours.goldLight;return(0,Oe.jsxs)(E.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:s.a11y,accessibilityHint:Ns?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Xt(!1),es(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,J.seatedHighlightStyle)({backgroundColor:e?_e:Ne,borderColor:Q.colours.gold,borderLeftColor:Q.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:Q.colours.hairline,backgroundColor:e?Q.colours.tilePressed:'transparent'},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Oe.jsx)(G.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:s.time}),(0,Oe.jsx)(G.T,{size:18,weight:"semibold",colour:l,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:s.name}),s.allergy?(0,Oe.jsx)(O.default,{style:{paddingTop:2},children:(0,Oe.jsx)(H.AllergyIcon,{text:s.allergy,size:22,colour:Q.colours.amber,ink:Q.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Oe.jsxs)(G.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Oe.jsx)(G.T,{size:16,colour:l,children:s.people}),s.deposit?(0,Oe.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}):null,s.deposit?(0,Oe.jsx)(G.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:s.deposit}):null,(0,Oe.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}),(0,Oe.jsx)(G.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===s.table?i:l,children:s.table}),s.dog?(0,Oe.jsx)(G.T,{size:16,children:" "}):null,s.dog?(0,Oe.jsx)(O.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Oe.jsx)(ge.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,Oe.jsx)(Re.CancellationsSection,{items:hl,dayWord:Ns?Gs?_s.toLowerCase():`on ${_s}`:'today'})]}),ii=(0,Oe.jsx)(A.default,{testID:"display-guest-list",accessibilityLabel:si,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:li}),oi=P.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Xt(!1)}}),ni=(0,Oe.jsxs)(E.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${si}, ${ti.length}`,accessibilityState:{expanded:Jt},'aria-expanded':Jt,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Xt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:Jt?Q.colours.gold:Q.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?Q.colours.tilePressed:Jt?Q.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Oe.jsx)(G.T,{size:16,weight:"bold",colour:Q.colours.gold,children:ti.length}),(0,Oe.jsx)(O.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(O.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Oe.jsxs)(G.T,{size:13,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,children:[si," ",Jt?'\u2039':'\u203a']})})})]}),ai=Jt?(0,Oe.jsxs)(O.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Oe.jsxs)(O.default,{testID:"guests-drawer",...oi.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Je)),backgroundColor:Q.colours.surface,borderRightWidth:1,borderColor:Q.colours.gold,borderRadius:14,...ze.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Oe.jsxs)(O.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[si.toUpperCase()," (",ti.length,")"]}),(0,Oe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${si}`,onPress:()=>Xt(!1),style:{marginRight:-6}})]}),ul.count?(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,testID:"cancelled-day-tally-guests",children:gl}):null]}),ii]}),(0,Oe.jsx)(E.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${si}`,accessibilityRole:"button",onPress:()=>Xt(!1),style:{flex:1}})]}):null,ri=Xs?Zs:l.IS_KIRKTON&&!Object.values(dt.kitchenHours??{}).some(Boolean)?(0,Oe.jsxs)(O.default,{testID:"kirkton-hours-to-confirm",style:[ze.look.panel,{padding:14,gap:8}],children:[(0,Oe.jsx)(G.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Oe.jsx)(G.Muted,{children:"No service hours have been set for this venue."})]}):(0,Oe.jsx)(Se.DayGraph,{busyThreshold:(0,t.venueBusy)(dt,ut,yt).busy,todays:Fs,open:Ks,close:qs,now:yt,turnBase:dt.settings.turnMins,blocks:bl,pauses:Qs,compact:Ze,dense:!Ze,fit:tt,tight:tt&&Xe<600,height:Ul,forecastNote:Ns?void 0:kl,emptyText:el,past:Os{Ns?Xt(!0):Wt(!0)},hi=(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',padding:Xe<820?8:12,paddingTop:Xe<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[It?null:ni,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[It?null:Nl,It?(0,Oe.jsx)(A.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Oe.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"})}):Al?El:Pl,Ol,ai]}),(0,Oe.jsxs)(O.default,{testID:"display-side",style:{width:lt,gap:Xe<820?4:8,minHeight:0},children:[(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Vl(!1)}),(0,Oe.jsx)(O.default,{style:{flexShrink:0},children:Gl}),It?null:(0,Oe.jsx)(O.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,compact:Xe<820,snug:Xe<820,tight:Xe<700,sound:(0,L.flapSoundOn)(),onPress:ui})}),It?null:(0,Oe.jsx)(O.default,{ref:Ql,testID:"day-graph-slot",onLayout:Xl,style:{flexGrow:0,flexShrink:1,flexBasis:Ul+52,minHeight:Xe<600?90:120,overflow:'visible'},children:di}),(0,Oe.jsxs)(A.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Oe.jsx)(E.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>hs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Oe.jsx)(G.T,{center:!0,weight:"semibold",children:"Reviews"})}),ei,(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt})]})]})]});return(0,Oe.jsxs)(_.SafeAreaView,{style:{flex:1,backgroundColor:Q.colours.bg},onTouchStart:()=>{os.current=Date.now()},onMouseDown:()=>{os.current=Date.now()},children:[Ze?(0,Oe.jsxs)(O.default,{style:{flex:1},children:[(0,Oe.jsxs)(A.default,{ref:it,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Oe.jsxs)(O.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Oe.jsx)(O.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Oe.jsx)(j.ExitButton,{})}),(0,Oe.jsx)(U.RestaurantLogo,{rid:rt,size:64}),(0,Oe.jsx)(G.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:dt.name}),(0,Oe.jsx)(U.PoweredBy,{}),(0,Oe.jsx)(C.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Oe.jsx)(O.default,{accessible:!0,accessibilityLabel:`Current time ${(0,q.hm)(yt)}`,children:(0,Oe.jsx)(G.T,{center:!0,size:30,weight:"semibold",colour:Q.colours.goldLight,children:(0,q.hm)(yt)})}),(0,Oe.jsx)(He.ShellfishChip,{rid:rt,by:jt,app:"display",size:"m"}),(0,Oe.jsx)(He.SundayRoastChip,{rid:rt,by:jt,app:"display",size:"m"}),K]}),Me,ci,(0,Oe.jsx)(O.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Oe.jsx)(Ke,{phone:!0,split:cl,items:[{label:`Tables \xb7 ${_s}`,value:rl.length,testID:'badge-tables'},{label:`Covers \xb7 ${_s}`,value:dl,testID:'badge-covers'},{label:'Takeaway',value:Cs.length,alert:Cs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Ft(!0)}]})}),(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{gap:8},children:Vl(!0)}),(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),Gl,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[Al?El:Pl,Ol]}),(0,Oe.jsxs)(O.default,{onLayout:e=>{ot.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[ze.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Oe.jsxs)(G.T,{center:!0,size:20,weight:"semibold",colour:Q.colours.goldLight,accessibilityRole:"header",children:[si," (",ti.length,")"]}),(0,Oe.jsx)(O.default,{testID:"display-guest-list",accessibilityLabel:si,style:{gap:4},children:li})]}),ei,di,(0,Oe.jsx)(O.default,{testID:"covers-dock",children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,compact:!0,sound:(0,L.flapSoundOn)(),onPress:()=>it.current?.scrollTo({y:ot.current,animated:!0})})}),(0,Oe.jsxs)(O.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Oe.jsx)(G.T,{center:!0,size:14,colour:St?Q.colours.muted:Q.colours.amber,children:St?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Oe.jsx)(G.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cs(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Oe.jsx)(G.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>hs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zl]}),e?null:(0,Oe.jsx)(O.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:Q.colours.hairline},children:(0,Oe.jsx)(W.VoiceSlot,{size:56})})]}):(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Je>=1e3?18:14,paddingVertical:Xe<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),...ze.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Oe.jsx)(O.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Oe.jsx)(U.RestaurantBrand,{rid:dt.id,size:Je<900?32:40,beside:!0})}),(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Oe.jsx)(G.T,{size:Je<900?18:21,weight:"semibold",colour:Q.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,q.hm)(yt)}),Je>=900?(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,children:(0,q.niceDate)(yt)}):null]})]}),It?(0,Oe.jsx)(O.default,{style:{width:220}}):(0,Oe.jsx)(O.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:ci}),(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Oe.jsx)(He.ShellfishChip,{rid:rt,by:jt,app:"display",size:Je<1200?'xs':Je<1280||Xe<700?'s':'m'}),(0,Oe.jsx)(E.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cs(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.muted,children:"?"})}),'simulated'===bt?(0,Oe.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>gt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(G.T,{size:11,colour:Q.colours.muted,children:"+15"})}):null,e?null:(0,Oe.jsx)(j.ExitButton,{}),K,Pe?null:(0,Oe.jsx)(W.VoiceSlot,{size:44})]})]}),Me,It?null:(0,Oe.jsxs)(O.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,Oe.jsx)(Ke,{splitOnly:!0,split:cl,items:[]}),(0,Oe.jsx)(O.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Je>=1e3?18:14)+(e?0:52)+('simulated'===bt?52:0),zIndex:4},children:(0,Oe.jsx)(He.SundayRoastChip,{rid:rt,by:jt,app:"display",size:Je<1100||Xe<700?'s':'m'})})]}),tt?hi:(gi=(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Vl(!1)}),Gl]}),(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),It?(0,Oe.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"}):(0,Oe.jsx)(Oe.Fragment,{children:(0,Oe.jsxs)(O.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[ni,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Nl,Al?El:Pl,Ol,ai]})]})}),ei,It?null:(0,Oe.jsx)(O.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,sound:(0,L.flapSoundOn)(),onPress:ui})}),It?null:(0,Oe.jsx)(O.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Ul+Se.DAY_GRAPH_CHROME},children:di})]}),(0,Oe.jsx)(A.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:gi})),Zl]}),(0,Oe.jsx)(I.SoldOutStrip,{rid:rt,by:wt,onOpen:()=>bs(!0)}),(0,Oe.jsx)(v.SoldOutSheet,{visible:gs,onClose:()=>bs(!1),rid:rt,by:wt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Oe.jsx)(p.TableOrderCue,{rid:rt}),vt.elements,Vt?(0,Oe.jsx)(y.EditBookingPicker,{rid:rt,today:kt,who:jt,hidePrivate:!0,onClose:()=>Ut(!1)}):null,Kt?(0,Oe.jsx)(y.EditBookingSheet,{rid:rt,id:Kt,who:jt,hidePrivate:!0,onClose:()=>qt(null)}):null,Pt?(0,Oe.jsx)(xe.TableSheet,{rid:rt,name:Pt,view:Rs,plan:Tt,todays:Ds,now:yt,privacy:St,turnBase:dt.settings.turnMins,onClose:()=>Et(null),onWalkIn:e=>vt.openWalkInAt(e),onMove:e=>Ot(e),onDetails:vs}):null,sl?(()=>{const e=tl[sl],t=e?.dayBookings??[];return(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>{al(null),ll(null)},title:`${(0,d.tableNumbersA11y)(sl)} \xb7 ${Gs?_s:(0,Te.dayLong)(Os)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Oe.jsxs)(G.T,{size:16,center:!0,colour:Q.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${Gs?_s.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${Gs?_s.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ue.privName)(e,St):Fe(e.name);return(0,Oe.jsx)(G.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,fe.tablesWords)((0,te.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ll(null),es(e.id)},style:{minHeight:56}},e.id)}),Os>=kt?(()=>{const t=e?.table.maxSeats??0,s=ut.filter(e=>e.date===Os&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,te.tablesOf)(e.table).includes(sl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Oe.jsxs)(O.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",center:!0,colour:Q.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(sl)]}),nl?(0,Oe.jsxs)(O.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:nl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:Q.colours.amber,backgroundColor:Q.colours.amberBg},children:[(0,Oe.jsx)(G.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:nl.ask}),(0,Oe.jsxs)(G.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Oe.jsx)(G.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!Fl.ok,accessibilityHint:Fl.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=ut.find(e=>e.id===nl.id);if(al(null),!e)return;const s=Fe(e.name);try{await(0,pe.saveBookingTables)(rt,e,[sl]),ms((0,fe.savedWords)(s,e.partySize,[sl],t))}catch(e){ms(`Couldn\u2019t save tables for ${s}: ${String(e?.message??e).slice(0,120)}`)}ll(null)}}),(0,Oe.jsx)(G.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>al(null)})]})]}):null,nl?null:s.slice(0,12).map(e=>{const s=Fe(e.name),l=e.partySize>t;return(0,Oe.jsx)(G.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:!Fl.ok,accessibilityHint:Fl.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(sl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{const l=(0,fe.overCapacityAsk)([sl],t,e.partySize);if(l)al({id:e.id,ask:l});else{try{await(0,pe.saveBookingTables)(rt,e,[sl]),ms((0,fe.savedWords)(s,e.partySize,[sl],t))}catch(e){ms(`Couldn\u2019t save tables for ${s}: ${String(e?.message??e).slice(0,120)}`)}ll(null)}},style:{minHeight:56}},e.id)})]}):null})():null,(0,Oe.jsx)(G.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{al(null),ll(null)},style:{minHeight:56}})]})})():null,Zt?(()=>{const e=ut.find(e=>e.id===Zt);return e?(0,Oe.jsx)(be.GuestActionsSheet,{rid:rt,b:e,name:e.walkIn?(0,ue.privName)(e,St):Fe(e.name),view:Rs,now:yt,otherDay:e.date!==kt,turnBase:dt.settings.turnMins,onClose:()=>es(null),onDetails:vs,onDone:ms,onEdit:e=>{es(null),qt(e.id)},onPickOnPlan:(e,t)=>{Xt(!1),Lt('plan'),Mt('all'),ss({id:e.id,tables:t})}}):null})():null,Nt?(0,Oe.jsx)(xe.DetailsPanel,{title:Nt.title,onClose:()=>_t(null),children:Nt.body}):null,Yt?(0,Oe.jsx)(xe.ServiceSummary,{r:dt,todays:Ds,orders:ct,waitlistAll:as,walkInCount:rs,onClose:()=>Qt(!1)}):null,ds?(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>cs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Oe.jsx)(g.FloorLegend,{}),(0,Oe.jsx)(G.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>cs(!1)})]}):null,us?(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>hs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Oe.jsx)(F.ReviewsSection,{rid:rt,mode:"read",venueName:dt.name}),(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>hs(!1)})]}):null,Gt?(0,Oe.jsxs)(xe.DetailsPanel,{title:"Takeaway",onClose:()=>Ft(!1),children:[(0,Oe.jsx)(G.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Oe.jsx)(Ye,{list:Cs,me:jt,bookings:ut})]}):null,xs?(0,Oe.jsx)(O.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:Q.colours.bg},children:(0,Oe.jsx)(ne.PlanDesigner,{initial:Tt,venue:dt.name,mode:"display",startStep:"arrange",onActivity:()=>{ws.current=Date.now(),null!==ks&&Is(null)},notice:null!==ks?`Locking again in ${ks} s \xb7 touch to keep editing`:null,onSave:e=>{te.useFloor.getState().setPlan(rt,e),js(null),ms('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{te.useFloor.getState().setPlan(rt,e),ms('Live seating plan updated on every screen.')},onCancel:()=>{js(null),ms('No changes kept. Editing is locked again.')}},xs.at)}):null,e?null:(0,Oe.jsx)(de.Screensaver,{rid:rt,idleMins:Dt.idleMins,pinOn:Dt.pinOn,wake:Dt,tonightCards:Dt.tonightCards,cfg:Ct}),e?null:(0,Oe.jsx)(we.PrintHost,{rid:rt}),e?null:(0,Oe.jsx)(je.AlertHost,{variant:"display",rid:rt,skipTakeaway:!0}),e?null:(0,Oe.jsx)(z.SeatAllergenReminder,{rid:rt}),e?null:(0,Oe.jsx)(ke.TakeawayTakeover,{rid:rt,me:jt})]});var gi};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),D=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=e(T),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),z=_r(_d[30]),W=_r(_d[31]),H=_r(_d[32]),M=e(_r(_d[33])),P=e(_r(_d[34])),E=e(_r(_d[35])),A=e(_r(_d[36])),O=e(_r(_d[37])),N=e(_r(_d[38])),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),me=_r(_d[69]),xe=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),ve=_r(_d[75]),De=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),ze=_r(_d[84]),We=_r(_d[85]),He=_r(_d[86]),Me=_r(_d[87]),Pe=_r(_d[88]),Ee=_r(_d[89]),Ae=_r(_d[90]),Oe=_r(_d[91]);const Ne='#221C12',_e='#2E2618',Ge=12e4,Fe=e=>(e??'').replace(' (example)',''),Ve=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Ue=e=>e.slotTime?(0,q.hm)(new Date(e.slotTime)):'ASAP';function Ke({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:o}){return(0,Oe.jsxs)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Oe.jsx)(O.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,Oe.jsxs)(O.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,Oe.jsx)(G.T,{size:s?24:19,weight:"semibold",colour:e.alert?Q.colours.amber:Q.colours.text,children:e.value}),(0,Oe.jsx)(G.T,{size:s?14:12,colour:Q.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Oe.jsx)(E.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,Oe.jsx)($.default.Fragment,{children:i},e.testID)})}),l?(0,Oe.jsx)(O.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Oe.jsx)(G.T,{size:14,colour:Q.colours.muted,children:"No Covers yet"}):(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Oe.jsx)(G.T,{size:i?13:14,weight:"semibold",colour:Q.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Oe.jsx)(G.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Oe.jsxs)(O.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:Q.colours.gold},children:[(0,Oe.jsx)(O.default,{style:{width:`${l.walkInPct}%`,backgroundColor:Q.colours.gold}}),(0,Oe.jsx)(O.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function qe({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:o,compact:n}){return(0,Oe.jsxs)(E.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Oe.jsx)(O.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Oe.jsx)(G.T,{size:n?12:14,weight:l?'semibold':'medium',colour:l?Q.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Oe.jsx)(G.T,{size:12,colour:Q.colours.muted,children:s}):null]})}function Ye({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Pe.statusBlock)(e,t,(0,Pe.linkedBooking)(e,l));return e.length?(0,Oe.jsx)(O.default,{style:{gap:8},children:e.map(e=>(0,Oe.jsxs)(O.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:Q.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?Q.colours.ok:e.allergies.length?Q.colours.red:Q.colours.gold},children:[(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Oe.jsxs)(G.T,{size:s?16:18,weight:"bold",children:[Ue(e)," \xb7 ",Fe(e.customerName)]}),(0,Oe.jsx)(G.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,Oe.jsxs)(G.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,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:Q.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,K.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Oe.jsx)(Me.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Oe.jsxs)(G.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Oe.jsx)(G.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>Y.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Oe.jsx)(G.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Oe.jsx)(G.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Oe.jsx)(we.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Oe.jsx)(G.Muted,{children:"No takeaway orders right now."})}function Qe({rid:e,id:t,turnBase:s}){const l=(0,Y.useBookings)(e).find(e=>e.id===t);return l?(0,Oe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1315,[1141,796,5,6,1316,828,853,1117,860,1140,1317,1318,1319,1114,1135,1320,1321,1326,1327,1328,872,1329,1153,980,1122,1330,34,1094,1178,1044,1110,1136,1331,395,380,402,295,102,426,36,794,1220,1224,873,861,858,874,821,1113,892,1119,1084,1025,1100,1127,1332,1126,1333,1340,1342,1345,1348,1344,1349,1351,1352,1132,1116,1118,878,1356,1209,1357,1219,1211,1022,1362,1370,1371,1097,1134,1373,1374,1375,1166,1376,1165,1159,869,1377,1378,25]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1317,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1318,[1023,1084]); @@ -1422,7 +1422,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.listSavedPlans=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))},_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const{data:c,error:u}=await(0,n.getSupabase)().from('table_plans').insert({venue_id:a,name:o.name,is_active:!1,areas:t.areas??[],tables:t.tables??[],joins:t.joins??[],sections:t.sections??[],fixtures:t.fixtures??[],updated_by:s()}).select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').single();if(u)throw u;return l(c)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return c(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:c(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}function c(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1339,[1338,1021,872,934,988]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1340,[34,236,402,102,821,794,1166,1341,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},1341,[]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return w}}),_e.Timeline=function({plan:e,bookings:T,now:C,privacy:S,onOpen:v,turnBase:I,t0:D,t1:E,height:z,pauses:L,blockedTables:R,hideNow:$,compact:_=!1,fit:O=!1}){const B=(0,o.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),W=T.filter(e=>!['cancelled','noshow'].includes(e.status)),[N,F]=(0,o.useState)(0),A=O&&!W.some(e=>!e.table)?B.filter(e=>'__none'!==e.key):B,P=O&&N>0?Math.max(w,Math.min(k,Math.floor(N/Math.max(1,A.length)))):k,H=P<44,Y=(0,o.useMemo)(()=>(0,c.clashes)(W,I),[W,I]),V=Math.max(1,Math.ceil((E.getTime()-D.getTime())/9e5)),[U,X]=(0,o.useState)(0),G=Math.max(30,U-M-2),q=Math.min(V,Math.max(1,Math.floor(G/j))),J=U>0?Math.max(j,Math.floor(G/q*100)/100):j,[K,Q]=(0,o.useState)(0),Z=Math.max(0,V-q),ee=Math.max(0,Math.min(Z,K)),te=(0,u.addMins)(D,15*ee),le=(0,u.addMins)(te,15*q),oe=e=>(e.getTime()-te.getTime())/9e5*J,[ie,ne]=(0,o.useState)(null),re=(0,o.useRef)(null);(0,o.useEffect)(()=>{const e=$?0:Math.floor((C.getTime()-D.getTime())/9e5)-Math.floor(q/3);Q(Math.max(0,Math.min(Z,e)))},[D.getTime(),q,Z,$]);const[se,ae]=(0,o.useState)(''),[de,ce]=(0,o.useState)(null),he=(0,o.useRef)(null);he.current=de,(0,o.useEffect)(()=>{if(!de)return;const e=setTimeout(()=>ce(null),s.ARM_MS);return()=>clearTimeout(e)},[de]);const ue=de?W.find(e=>e.id===de.id):void 0,be=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(he.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(he.current,e.id,Date.now()),onResponderGrant:e=>{re.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:l=>{if(!re.current||!(0,s.isArmed)(he.current,e.id,Date.now()))return;const o=l.nativeEvent.pageX-re.current.x,i=l.nativeEvent.pageY-re.current.y;(Math.abs(i)>=6||Math.abs(o)>=6)&&ne({id:e.id,row:t,dy:i})},onResponderRelease:l=>{const o=re.current;re.current=null,ne(null);const n=l.nativeEvent.pageX-(o?.x??0),r=l.nativeEvent.pageY-(o?.y??0),d=(0,s.releaseOn)(he.current,e.id,!(Math.abs(n)<6&&Math.abs(r)<6),Date.now());if(ce(d.arm),'select'===d.action){ae('');try{i.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void ae('');if('none'===d.action)return;ae('');const h=A.findIndex(e=>e.key===t),f=Math.max(0,Math.min(A.length-1,h+Math.round(r/P))),g=(0,b.dragTables)(e.table,t,A[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),ae(`${(0,p.privName)(e,S)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,u.hm)((0,c.startOf)(e))}`)):Math.abs(n)>=6&&Math.abs(r)

=600||se?(0,y.jsx)(r.default,{style:{flex:U>=600?1:void 0,flexBasis:U>=600?void 0:'100%',minWidth:0},children:(0,y.jsx)(x.T,{size:13,center:U<600,colour:g.colours.muted,numberOfLines:U>=600?1:2,testID:"timeline-hint",children:se||s.SELECT_HINT})}):null,L?.length?(0,y.jsxs)(x.Row,{gap:4,children:[(0,y.jsx)(r.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:13,children:"Blocked"})]}):null,(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.goldLight,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(r.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))})}),(0,y.jsx)(r.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})})]}):null]}):(0,y.jsxs)(y.Fragment,{children:[_?(0,y.jsxs)(r.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,y.jsx)(r.default,{style:{alignSelf:'center'},children:(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'})}),(0,y.jsx)(x.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),se?(0,y.jsx)(r.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:se})}):null]}):(0,y.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(x.Row,{gap:8,children:[(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'}),(0,y.jsx)(r.default,{style:{flex:1,minWidth:0},children:(0,y.jsx)(x.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,y.jsx)(r.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{size:13,colour:g.colours.goldLight,children:se})})]}),(0,y.jsxs)(x.T,{center:!0,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})]}):null,L?.length?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(r.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:14,children:"Blocked"})]}):null]}),(0,y.jsxs)(r.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-U)>1&&X(t)},style:{flex:z?void 0:1,height:z,flexShrink:_?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,y.jsxs)(r.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:g.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,y.jsx)(r.default,{testID:"timeline-table-head",style:{width:M,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:(0,y.jsx)(x.T,{size:13,weight:"semibold",colour:g.colours.goldLight,children:"Table"})}),(0,y.jsxs)(r.default,{style:{width:q*J,flexShrink:0},children:[Array.from({length:Math.ceil(q/4)},(e,t)=>(0,y.jsx)(r.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*J,top:26,bottom:0,width:1,backgroundColor:g.colours.border}},t)),Array.from({length:Math.ceil(q/4)},(e,t)=>{const l=4*t*J,o=Math.max(0,Math.min(q*J-56,l-28));return(0,y.jsx)(r.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:o,width:56,top:4,height:22,justifyContent:'center'},children:(0,y.jsx)(x.T,{size:15,weight:"semibold",colour:g.colours.goldLight,center:!0,numberOfLines:1,children:(0,u.hm)((0,u.addMins)(te,60*t))})},`l${t}`)})]})]}),(0,y.jsxs)(n.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-N)>1&&F(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,y.jsx)(r.default,{style:{width:M,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:A.map((e,t,l)=>(0,y.jsx)(r.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:P,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:H?(0,y.jsxs)(r.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,y.jsx)(r.default,{style:{width:q*J,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!he.current,onResponderRelease:()=>{ce(null),ae('')},children:(0,y.jsxs)(r.default,{style:{width:q*J},children:[(L??[]).map((e,t)=>{const l=Math.max(0,oe(e.from)),o=Math.min(q*J,oe(e.to));return o<=l?null:(0,y.jsx)(r.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,u.hm)(e.from)} to ${(0,u.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:o-l,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),A.map((e,o,i)=>{return(0,y.jsxs)(r.default,{testID:`tl-row-${e.key}`,style:{height:P,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:o>0&&i[o-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(q/4)},(e,l)=>(0,y.jsx)(r.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*J,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),R?.includes(e.key)?(0,y.jsx)(r.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,y.jsx)(x.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,W.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)te)).map(t=>{const o=ie?.id===t.id&&ie.row===e.key?ie:null,i=oe((0,c.startOf)(t)),n=Math.max(0,Math.min(q*J-44,i)),a=Math.min(q*J,oe((0,u.addMins)((0,c.startOf)(t),(0,c.durOf)(t,I)))),d=Math.min(q*J-n,Math.max(44,a-Math.max(0,i))),b=Y.has(t.id),j=de?.id===t.id;return(0,y.jsx)(r.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,p.privName)(t,S)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,u.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,I)} min${b?', clash':''}${(0,h.depositView)(t,!0)?`, ${(0,h.depositView)(t,!0).a11y}`:''}${j?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:j},accessibilityHint:j?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:j?'1':'0'},...be(t,e.key),style:[{position:'absolute',left:n,top:(H?2:4)+(o?o.dy:0),width:d,height:P-(H?4:8),borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:j?3:b?2.5:1,borderColor:j?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...j?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:o?40:j?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:j?'ns-resize':'pointer',touchAction:j?'none':'pan-y'},o?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,y.jsx)(x.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:H?1:2,style:{lineHeight:16},children:d<100?H&&d>=70?`${t.partySize} \xb7 ${(0,u.hm)((0,c.startOf)(t))}`:String(t.partySize):(0,y.jsxs)(y.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key||H?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,p.privName)(t,S)," \xb7 ",t.partySize,H?' \xb7 ':'\n',(0,u.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,h.depositView)(t,!0)?d>=150?` \xb7 ${(0,h.depositView)(t,!0).label}`:'Deposit paid'===(0,h.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&me>=0&&me<=q*J?(0,y.jsx)(r.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:me,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,y.jsx)(r.default,{style:{position:'absolute',top:0,left:Math.max(-me,Math.min(-18,q*J-me-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,y.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,u.hm)(C)})})}):null]})})]}),ue?(0,y.jsx)(r.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,y.jsxs)(x.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,y.jsx)(r.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,p.privName)(ue,S)} ${s.SELECTED_A11Y}`,children:(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,p.privName)(ue,S)," \xb7 ",ue.partySize]})}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{ce(null),v(ue)}}),(0,y.jsx)(x.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{ce(null),ae('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=_r(_d[2]),i=e(_r(_d[3]));_r(_d[4]);var n=e(_r(_d[5])),r=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),u=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),x=_r(_d[16]),p=_r(_d[17]),y=_r(_d[18]);const j=30,k=52,w=28,M=120},1342,[828,860,34,281,236,295,102,1128,874,1025,1100,14,858,1118,1343,821,794,1344,25]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return w}}),_e.Timeline=function({plan:e,bookings:T,now:C,privacy:S,onOpen:v,turnBase:I,t0:D,t1:z,height:E,pauses:$,blockedTables:L,hideNow:R,compact:_=!1,fit:O=!1}){const B=(0,o.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),W=T.filter(e=>!['cancelled','noshow'].includes(e.status)),[N,A]=(0,o.useState)(0),F=O&&!W.some(e=>!e.table)?B.filter(e=>'__none'!==e.key):B,P=O&&N>0?Math.max(w,Math.min(k,Math.floor(N/Math.max(1,F.length)))):k,H=P<44,Y=(0,o.useMemo)(()=>(0,c.clashes)(W,I),[W,I]),V=Math.max(1,Math.ceil((z.getTime()-D.getTime())/9e5)),[U,X]=(0,o.useState)(0),G=Math.max(30,U-M-2),q=Math.min(V,Math.max(1,Math.floor(G/j))),J=U>0?Math.max(j,Math.floor(G/q*100)/100):j,[K,Q]=(0,o.useState)(0),Z=Math.max(0,V-q),ee=Math.max(0,Math.min(Z,K)),te=(0,u.addMins)(D,15*ee),le=(0,u.addMins)(te,15*q),oe=e=>(e.getTime()-te.getTime())/9e5*J,[ie,re]=(0,o.useState)(null),ne=(0,o.useRef)(null);(0,o.useEffect)(()=>{const e=R?0:Math.floor((C.getTime()-D.getTime())/9e5)-Math.floor(q/3);Q(Math.max(0,Math.min(Z,e)))},[D.getTime(),q,Z,R]);const[se,ae]=(0,o.useState)(''),[de,ce]=(0,o.useState)(null),he=(0,o.useRef)(null);he.current=de,(0,o.useEffect)(()=>{if(!de)return;const e=setTimeout(()=>ce(null),s.ARM_MS);return()=>clearTimeout(e)},[de]);const ue=de?W.find(e=>e.id===de.id):void 0,be=(t,l)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(he.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(he.current,t.id,Date.now()),onResponderGrant:e=>{ne.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!ne.current||!(0,s.isArmed)(he.current,t.id,Date.now()))return;const o=e.nativeEvent.pageX-ne.current.x,i=e.nativeEvent.pageY-ne.current.y;(Math.abs(i)>=6||Math.abs(o)>=6)&&re({id:t.id,row:l,dy:i})},onResponderRelease:o=>{const r=ne.current;ne.current=null,re(null);const n=o.nativeEvent.pageX-(r?.x??0),d=o.nativeEvent.pageY-(r?.y??0),h=(0,s.releaseOn)(he.current,t.id,!(Math.abs(n)<6&&Math.abs(d)<6),Date.now());if(ce(h.arm),'select'===h.action){ae('');try{i.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void ae('');if('none'===h.action)return;ae('');const f=F.findIndex(e=>e.key===l),g=Math.max(0,Math.min(F.length-1,f+Math.round(d/P))),x=(0,b.dragTables)(t.table,l,F[g].key);if(x){a.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,b.overCapacityAsk)(x.split('+'),(0,b.seatsOf)(e,x.split('+')).total,t.partySize);ae(`${(0,p.privName)(t,S)} \u2192 ${(0,b.tablesWords)(x.split('+'))}, still ${(0,u.hm)((0,c.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`)}else Math.abs(n)>=6&&Math.abs(d)

=600||se?(0,y.jsx)(n.default,{style:{flex:U>=600?1:void 0,flexBasis:U>=600?void 0:'100%',minWidth:0},children:(0,y.jsx)(x.T,{size:13,center:U<600,colour:g.colours.muted,numberOfLines:U>=600?1:2,testID:"timeline-hint",children:se||s.SELECT_HINT})}):null,$?.length?(0,y.jsxs)(x.Row,{gap:4,children:[(0,y.jsx)(n.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:13,children:"Blocked"})]}):null,(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.goldLight,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(n.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))})}),(0,y.jsx)(n.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})})]}):null]}):(0,y.jsxs)(y.Fragment,{children:[_?(0,y.jsxs)(n.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,y.jsx)(n.default,{style:{alignSelf:'center'},children:(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'})}),(0,y.jsx)(x.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),se?(0,y.jsx)(n.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:se})}):null]}):(0,y.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(x.Row,{gap:8,children:[(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'}),(0,y.jsx)(n.default,{style:{flex:1,minWidth:0},children:(0,y.jsx)(x.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,y.jsx)(n.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{size:13,colour:g.colours.goldLight,children:se})})]}),(0,y.jsxs)(x.T,{center:!0,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})]}):null,$?.length?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(n.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:14,children:"Blocked"})]}):null]}),(0,y.jsxs)(n.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-U)>1&&X(t)},style:{flex:E?void 0:1,height:E,flexShrink:_?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,y.jsxs)(n.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:g.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,y.jsx)(n.default,{testID:"timeline-table-head",style:{width:M,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:(0,y.jsx)(x.T,{size:13,weight:"semibold",colour:g.colours.goldLight,children:"Table"})}),(0,y.jsxs)(n.default,{style:{width:q*J,flexShrink:0},children:[Array.from({length:Math.ceil(q/4)},(e,t)=>(0,y.jsx)(n.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*J,top:26,bottom:0,width:1,backgroundColor:g.colours.border}},t)),Array.from({length:Math.ceil(q/4)},(e,t)=>{const l=4*t*J,o=Math.max(0,Math.min(q*J-56,l-28));return(0,y.jsx)(n.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:o,width:56,top:4,height:22,justifyContent:'center'},children:(0,y.jsx)(x.T,{size:15,weight:"semibold",colour:g.colours.goldLight,center:!0,numberOfLines:1,children:(0,u.hm)((0,u.addMins)(te,60*t))})},`l${t}`)})]})]}),(0,y.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-N)>1&&A(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,y.jsx)(n.default,{style:{width:M,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:F.map((e,t,l)=>(0,y.jsx)(n.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:P,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:H?(0,y.jsxs)(n.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,y.jsx)(n.default,{style:{width:q*J,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!he.current,onResponderRelease:()=>{ce(null),ae('')},children:(0,y.jsxs)(n.default,{style:{width:q*J},children:[($??[]).map((e,t)=>{const l=Math.max(0,oe(e.from)),o=Math.min(q*J,oe(e.to));return o<=l?null:(0,y.jsx)(n.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,u.hm)(e.from)} to ${(0,u.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:o-l,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),F.map((e,o,i)=>{return(0,y.jsxs)(n.default,{testID:`tl-row-${e.key}`,style:{height:P,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:o>0&&i[o-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(q/4)},(e,l)=>(0,y.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*J,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),L?.includes(e.key)?(0,y.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,y.jsx)(x.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(r=e.key,W.filter(e=>('__none'===r?!e.table:(0,d.tablesOf)(e.table).includes(r))&&(0,c.startOf)(e)te)).map(t=>{const o=ie?.id===t.id&&ie.row===e.key?ie:null,i=oe((0,c.startOf)(t)),r=Math.max(0,Math.min(q*J-44,i)),a=Math.min(q*J,oe((0,u.addMins)((0,c.startOf)(t),(0,c.durOf)(t,I)))),d=Math.min(q*J-r,Math.max(44,a-Math.max(0,i))),b=Y.has(t.id),j=de?.id===t.id;return(0,y.jsx)(n.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,p.privName)(t,S)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,u.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,I)} min${b?', clash':''}${(0,h.depositView)(t,!0)?`, ${(0,h.depositView)(t,!0).a11y}`:''}${j?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:j},accessibilityHint:j?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:j?'1':'0'},...be(t,e.key),style:[{position:'absolute',left:r,top:(H?2:4)+(o?o.dy:0),width:d,height:P-(H?4:8),borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:j?3:b?2.5:1,borderColor:j?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...j?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:o?40:j?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:j?'ns-resize':'pointer',touchAction:j?'none':'pan-y'},o?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,y.jsx)(x.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:H?1:2,style:{lineHeight:16},children:d<100?H&&d>=70?`${t.partySize} \xb7 ${(0,u.hm)((0,c.startOf)(t))}`:String(t.partySize):(0,y.jsxs)(y.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key||H?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,p.privName)(t,S)," \xb7 ",t.partySize,H?' \xb7 ':'\n',(0,u.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,h.depositView)(t,!0)?d>=150?` \xb7 ${(0,h.depositView)(t,!0).label}`:'Deposit paid'===(0,h.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var r}),!R&&me>=0&&me<=q*J?(0,y.jsx)(n.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:me,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,y.jsx)(n.default,{style:{position:'absolute',top:0,left:Math.max(-me,Math.min(-18,q*J-me-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,y.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,u.hm)(C)})})}):null]})})]}),ue?(0,y.jsx)(n.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,y.jsxs)(x.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,y.jsx)(n.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,p.privName)(ue,S)} ${s.SELECTED_A11Y}`,children:(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,p.privName)(ue,S)," \xb7 ",ue.partySize]})}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{ce(null),v(ue)}}),(0,y.jsx)(x.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{ce(null),ae('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=_r(_d[2]),i=e(_r(_d[3]));_r(_d[4]);var r=e(_r(_d[5])),n=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),u=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),x=_r(_d[16]),p=_r(_d[17]),y=_r(_d[18]);const j=30,k=52,w=28,M=120},1342,[828,860,34,281,236,295,102,1128,874,1025,1100,14,858,1118,1343,821,794,1344,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1343,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1344,[]); __d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1345,[5,828,34,283,336,236,402,102,426,821,873,794,1026,1000,1326,1346,2,1347,1348,874,858,25]); @@ -1432,10 +1432,10 @@ __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.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1349,[860,14,1025,1350]); __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])},1350,[861]); __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])},1351,[34,102,797,821,25]); -__d(function(_g,r,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:S,name:D,view:P,now:I,onClose:L,onDetails:v,onDone:N,otherDay:T,turnBase:W=90,onPickOnPlan:H}){const[_,z]=(0,l.useState)(!1),M=(0,j.useBookingWrite)(),[A,G]=(0,l.useState)(!1),[O,F]=(0,l.useState)(!1),[R,q]=(0,l.useState)(!1),E=(0,k.guestRowText)(S,{name:D,seated:'seated'===S.status&&!T}),J='seated'===S.status&&!T,K=S.table?J?`Seated \xb7 ${(0,a.tableCardLabel)(S.table)}`:(0,a.tableCardLabel)(S.table):J?'Seated':'No table yet',Q=T?[]:(0,y.guestActions)(S,D,P,I).filter(e=>'details'!==e.id),U=(0,g.tableActions)(S,D),V={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},X=async t=>{const s={...S,table:t};t!==S.table&&await u.repo.bookings.update(S.id,{table:t}),await(0,b.seatBookingNow)(e,s),N(`${D} seated at ${(0,y.tableWords)(t)}.`),L()},Y=async t=>'seat'===t.id&&t.table?X(t.table):'pick'===t.id?z(e=>!e):'details'===t.id?(L(),v(S)):'finished'===t.id?('seated'===S.status?await(0,b.finishBookingNow)(e,S):await u.repo.bookings.setStatus(S.id,'finished'),N('seated'===S.status&&S.table?`${D} finished. ${(0,y.tableWords)(S.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),L()):'noshow'===t.id?(await u.repo.bookings.setStatus(S.id,'noshow'),N(`${D} marked as a no-show.`),L()):void 0,Z=_?(0,y.freeTablesNow)(P,S.partySize).slice(0,8):[];if(A)return(0,w.jsx)(h.TablePicker,{rid:e,booking:S,name:D,turnBase:W,onClose:L,onSaved:N,onPickOnPlan:H?e=>{L(),H(S,e)}:void 0});if(O)return(0,w.jsx)(f.CancelWalkInConfirm,{rid:e,b:S,onClose:L,onDone:N});if(R)return(0,w.jsx)(p.CancelBookingConfirm,{rid:e,b:S,name:D,onClose:L,onDone:N});const ee=[...Q];return(0,w.jsxs)(c.Sheet,{visible:!0,onClose:L,title:`${S.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,w.jsx)(o.default,{accessible:!0,accessibilityLabel:E.a11y,testID:"guest-actions-summary",children:(0,w.jsxs)(c.T,{size:18,children:[E.people,E.deposit?(0,w.jsxs)(c.T,{size:18,weight:"semibold",colour:E.depositWarn?x.colours.amber:x.colours.goldLight,children:[" \xb7 ",E.deposit]}):null," \xb7 ",K]})}),(0,w.jsx)(t.ShowNumberButton,{b:S}),(0,w.jsxs)(o.default,{style:{gap:10},children:[ee.map(e=>(0,w.jsxs)(n.default.Fragment,{children:[(0,w.jsx)(c.Button,{kind:B(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:M.hint,disabled:'details'!==e.id&&!M.ok,testID:`guest-act-${e.id}`,onPress:()=>Y(e),style:C}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,w.jsxs)(c.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&_?(0,w.jsxs)(o.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Z.length?(0,w.jsx)(c.Muted,{children:"No free tables right now."}):null,Z.map(e=>(0,w.jsx)(c.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:M.hint,disabled:!M.ok,testID:`guest-pick-${e.table}`,onPress:()=>X(e.table),style:C},e.table))]}):null]},e.id)),U.map(t=>(0,w.jsx)(c.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:M.hint,disabled:!M.ok,testID:`guest-act-${t.id}`,style:C,onPress:async()=>{if(M.ok){if('assign'===t.id)return G(!0);await(0,h.saveBookingTables)(e,S,[]),N(`${D}: table taken off.`),L()}}},t.id)),!T&&(0,f.canCancelWalkIn)(S)?(0,w.jsx)(c.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${S.ref}, ${S.partySize} Covers`,accessibilityHint:M.hint,disabled:!M.ok,testID:"guest-act-cancelwalkin",onPress:()=>F(!0),style:C}):null,(0,$.canCancelBooking)(S)?(0,w.jsx)(c.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${S.time}, ${S.partySize} Covers`,accessibilityHint:M.hint,disabled:!M.ok,testID:"guest-act-cancelbooking",onPress:()=>q(!0),style:C}):null,(0,w.jsx)(c.Button,{kind:"ghost",label:V.label,accessibilityLabel:V.a11y,testID:"guest-act-details",onPress:()=>Y(V),style:C})]}),(0,w.jsx)(c.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:L,style:C})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=e(l),o=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),j=r(d[16]),w=r(d[17]);const C={minHeight:64},B=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1352,[1353,860,1025,34,102,794,1119,874,1355,1349,1118,1116,1132,1133,1134,821,1318,25]); +__d(function(_g,r,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:D,name:v,view:I,now:P,onClose:L,onDetails:z,onDone:H,otherDay:N,turnBase:T=90,onPickOnPlan:W,onEdit:_}){const[A,E]=(0,l.useState)(null),[F,M]=(0,l.useState)(!1),R=(0,w.useBookingWrite)(),[G,O]=(0,l.useState)(!1),[U,q]=(0,l.useState)(!1),[J,K]=(0,l.useState)(!1),Q=(0,k.guestRowText)(D,{name:v,seated:'seated'===D.status&&!N}),V='seated'===D.status&&!N,X=D.table?V?`Seated \xb7 ${(0,a.tableCardLabel)(D.table)}`:(0,a.tableCardLabel)(D.table):V?'Seated':'No table yet',Y=N?[]:(0,y.guestActions)(D,v,I,P).filter(e=>'details'!==e.id),Z=(0,g.tableActions)(D,v),ee={id:'details',label:'Guest details',a11y:`Guest details, ${v}`},te=async t=>{const s={...D,table:t};t!==D.table&&await u.repo.bookings.update(D.id,{table:t}),await(0,b.seatBookingNow)(e,s),H(`${v} seated at ${(0,y.tableWords)(t)}.`),L()},se=async t=>'seat'===t.id&&t.table?te(t.table):'pick'===t.id?M(e=>!e):'details'===t.id?(L(),z(D)):'finished'===t.id?('seated'===D.status?await(0,b.finishBookingNow)(e,D):await u.repo.bookings.setStatus(D.id,'finished'),H('seated'===D.status&&D.table?`${v} finished. ${(0,y.tableWords)(D.table).replace(/^t/,'T')} needs clearing.`:`${v} finished.`),L()):'noshow'===t.id?(await u.repo.bookings.setStatus(D.id,'noshow'),H(`${v} marked as a no-show.`),L()):void 0,ae=F?(0,y.freeTablesNow)(I,D.partySize,!0).slice(0,12):[];if(G)return(0,C.jsx)(p.TablePicker,{rid:e,booking:D,name:v,turnBase:T,onClose:L,onSaved:H,onPickOnPlan:W?e=>{L(),W(D,e)}:void 0});if(U)return(0,C.jsx)(f.CancelWalkInConfirm,{rid:e,b:D,onClose:L,onDone:H});if(J)return(0,C.jsx)($.CancelBookingConfirm,{rid:e,b:D,name:v,onClose:L,onDone:H});const ie=[...Y];return(0,C.jsxs)(c.Sheet,{visible:!0,onClose:L,title:`${D.time} \xb7 ${v}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(o.default,{accessible:!0,accessibilityLabel:Q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(c.T,{size:18,children:[Q.people,Q.deposit?(0,C.jsxs)(c.T,{size:18,weight:"semibold",colour:Q.depositWarn?j.colours.amber:j.colours.goldLight,children:[" \xb7 ",Q.deposit]}):null," \xb7 ",X]})}),(0,C.jsx)(t.ShowNumberButton,{b:D}),(0,C.jsxs)(o.default,{style:{gap:10},children:[ie.map(e=>(0,C.jsxs)(n.default.Fragment,{children:[(0,C.jsx)(c.Button,{kind:B(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:R.hint,disabled:'details'!==e.id&&!R.ok,testID:`guest-act-${e.id}`,onPress:()=>se(e),style:S}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(c.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&F?(0,C.jsxs)(o.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ae.length?(0,C.jsx)(c.Muted,{children:"No free tables right now."}):null,A?(0,C.jsxs)(o.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:A.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[(0,C.jsx)(c.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:A.ask}),(0,C.jsx)(c.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!R.ok,accessibilityHint:R.hint,onPress:()=>{const e=A.table;E(null),te(e)},style:S}),(0,C.jsx)(c.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>E(null),style:S})]}):ae.map(e=>(0,C.jsx)(c.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,g.overCapacityAsk)([e.table],e.seats,D.partySize);t?E({table:e.table,ask:t}):te(e.table)},style:S},e.table))]}):null]},e.id)),Z.map(t=>(0,C.jsx)(c.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:R.hint,disabled:!R.ok,testID:`guest-act-${t.id}`,style:S,onPress:async()=>{if(R.ok){if('assign'===t.id)return O(!0);await(0,p.saveBookingTables)(e,D,[]),H(`${v}: table taken off.`),L()}}},t.id)),!N&&(0,f.canCancelWalkIn)(D)?(0,C.jsx)(c.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${D.ref}, ${D.partySize} Covers`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-cancelwalkin",onPress:()=>q(!0),style:S}):null,(0,x.canCancelBooking)(D)?(0,C.jsx)(c.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${v}, ${D.time}, ${D.partySize} Covers`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-cancelbooking",onPress:()=>K(!0),style:S}):null,!_||D.walkIn||['cancelled','noshow'].includes(D.status)||N&&!(D.date>=(0,h.ymd)(P))?null:(0,C.jsx)(c.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${v}, ${D.time}. Date, time, covers, table, anything.`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-edit",onPress:()=>{L(),_(D)},style:S}),(0,C.jsx)(c.Button,{kind:"ghost",label:ee.label,accessibilityLabel:ee.a11y,testID:"guest-act-details",onPress:()=>se(ee),style:S})]}),(0,C.jsx)(c.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:L,style:S})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=e(l),o=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),$=r(d[14]),x=r(d[15]),j=r(d[16]),w=r(d[17]),C=r(d[18]);const S={minHeight:64},B=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1352,[1353,860,1025,34,102,794,1119,874,1355,1349,1118,858,1116,1132,1133,1134,821,1318,25]); __d(function(g,r,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)(h.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(h.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=h.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,h.canShowNumber)(e,!y||(0,b.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 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,h.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,h.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]),b=r(d[7]),h=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1353,[34,379,402,102,874,1003,892,1023,1354,872,821,794,25]); __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')}`}},1354,[]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1355,[1025,1100]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a,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.maxSeatsc[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1355,[1025,1100]); __d(function(g,_r,_i,_a,_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 I}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const l=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,n.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,C.jsxs)(m.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,C.jsx)(x.T,{size:13,weight:"semibold",colour:T.colours.gold,children:"NEXT HOUR"}),(0,C.jsxs)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,C.jsx)(x.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,C.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?T.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?T.colours.amber:'#3C78B5'},children:[(0,C.jsx)(x.T,{size:13,weight:"semibold",children:e.time}),(0,C.jsxs)(x.T,{size:13,children:[(0,p.privName)(e,s)," \xb7 ",e.partySize]}),(0,C.jsx)(x.T,{size:12,colour:T.colours.muted,accessibilityLabel:e.table?(0,a.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,a.tableNumbers)(e.table)}`:'no table'}),(0,C.jsx)(x.T,{size:12,colour:t<0?T.colours.amber:T.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,C.jsx)(x.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,C.jsx)(x.T,{size:12,children:v.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,C.jsxs)(x.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,C.jsxs)(x.Row,{gap:4,children:[(0,C.jsx)(m.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:v.STATUS[e].colour}}),(0,C.jsx)(x.T,{size:12,colour:T.colours.muted,children:v.STATUS[e].label})]},e)),(0,C.jsx)(x.T,{size:12,colour:T.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,u.useState)(20);return(0,u.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,u.useEffect)(()=>{l<=0&&s()},[l]),(0,C.jsxs)(x.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,C.jsx)(x.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,C.jsx)(x.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return B}}),_e.TableSheet=function({rid:e,name:t,view:s,plan:i,todays:c,now:h,privacy:w,turnBase:S,onClose:I,onWalkIn:B,onMove:D,onDetails:z}){const M=s[t],N=j.useFloor.getState(),[P,R]=(0,u.useState)(!1),[L,A]=(0,u.useState)(M?.note??''),[W,O]=(0,u.useState)(!1),H=(0,$.useBookingWrite)();if(!M)return null;const F=M.booking,E=['seated','mains','dessert','bill'].includes(M.status),_=c.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,n.minsBetween)(h,(0,v.startOf)(e)))-Math.abs((0,n.minsBetween)(h,(0,v.startOf)(t)))),G=e=>e.partySize<=M.table.maxSeats,U=M.next??M.due,V=(0,v.turnFor)(M.covers||M.table.maxSeats,S);return(0,C.jsxs)(x.Sheet,{visible:!0,onClose:I,title:`${(0,a.tableNumbers)(t)} \xb7 ${v.STATUS[M.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===M.status?(0,C.jsx)(x.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{j.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,C.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(x.Badge,{kind:"neutral",label:`${M.table.minSeats}\u2013${M.table.maxSeats} seats`}),F?(0,C.jsx)(x.Badge,{kind:"gold",label:`${(0,p.privName)(F,w)} \xb7 ${F.partySize} \xb7 ${M.seatedMins}m`}):null,F?(0,C.jsx)(x.Badge,{kind:M.seatedMins>(0,v.durOf)(F,S)?'red':'neutral',label:`Turn about ${(0,v.durOf)(F,S)} min \xb7 free about ${(0,n.hm)((0,v.endOf)(F,S))} (est.)`}):(0,C.jsx)(x.Badge,{kind:"neutral",label:`Turn estimate for ${M.table.maxSeats}: about ${V} min`}),M.next?(0,C.jsx)(x.Badge,{kind:"blue",label:`Next: ${M.next.time} ${(0,p.privName)(M.next,w)} (${M.next.partySize})`}):null,M.allergy?(0,C.jsx)(x.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,C.jsx)(k.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,C.jsx)(o.BookingTableButton,{rid:e,booking:F??U,turnBase:S,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,C.jsx)(r.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,C.jsx)(r.ReinstateWalkInButton,{rid:e,b:F,today:(0,n.ymd)(new Date)}):null,!E&&'blocked'!==M.status&&U?(0,C.jsx)(x.Button,{label:`Seat ${(0,p.privName)(U,w)}`,accessibilityLabel:`Seat ${(0,p.privName)(U,w)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await y.repo.bookings.update(s.id,{table:s.table&&(0,j.tablesOf)(s.table).includes(t)?s.table:t}),await y.repo.bookings.setStatus(s.id,'seated'),(0,f.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==M.status&&U&&(0,v.startOf)(U)<=h?(0,C.jsxs)(x.Row,{gap:8,children:[(0,C.jsx)(x.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,p.privName)(U,w)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await y.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,C.jsx)(x.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,p.privName)(U,w)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await y.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===M.status?null:(0,C.jsxs)(x.Row,{gap:8,children:[(0,C.jsx)(x.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===M.status&&j.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,C.jsx)(x.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,C.jsxs)(m.default,{style:{gap:6},children:[0===_.length?(0,C.jsx)(x.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,C.jsxs)(b.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,p.privName)(s,w)} ${s.time}`,onPress:async()=>{await y.repo.bookings.update(s.id,{table:t}),await y.repo.bookings.setStatus(s.id,'seated'),(0,f.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?T.colours.border:T.colours.amber,backgroundColor:T.colours.surface2},children:[(0,C.jsxs)(x.T,{weight:"semibold",children:[s.time," \xb7 ",(0,p.privName)(s,w)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,a.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,C.jsxs)(x.T,{size:12,colour:T.colours.amber,children:["Bigger than this table (",M.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(x.T,{size:14,colour:T.colours.muted,children:"Course / status"}),(0,C.jsx)(x.Row,{wrap:!0,gap:6,children:v.STAGES.map(s=>(0,C.jsx)(x.Chip,{label:v.STAGE_LABEL[s],selected:M.status===s,onPress:()=>N.setLive(e,t,{stage:s})},s))}),(0,C.jsxs)(x.Row,{wrap:!0,gap:8,children:[F?(0,C.jsx)(x.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,C.jsx)(x.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await y.repo.bookings.setStatus(F.id,'finished'),N.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,C.jsxs)(x.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(x.Button,{kind:"secondary",label:'blocked'===M.status?'Unblock table':'Block table',onPress:()=>{N.setLive(e,t,{blocked:'blocked'!==M.status}),I()},testID:"block-table"}),(0,C.jsx)(x.Button,{kind:"ghost",label:M.note?'Edit note':'Note',onPress:()=>R(!P)}),F||U?(0,C.jsx)(x.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),z(F??U)},testID:"guest-details"}):null]}),P?(0,C.jsxs)(x.Row,{gap:6,children:[(0,C.jsx)(l.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[x.styles.input,{flex:1}]}),(0,C.jsx)(x.Button,{small:!0,label:"Save",onPress:()=>{N.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,w?(0,C.jsx)(x.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,i.joins.some(e=>e.tables.includes(t))?(0,C.jsxs)(x.Muted,{children:["Joins with ",i.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",i.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:a,todays:i,waiting:o,now:r,privacy:c,busy:h,onToast:w}){const[k,$]=(0,u.useState)(''),[B,D]=(0,u.useState)(2),z=(0,j.useFloor)(e=>e.smsLog);return(0,C.jsxs)(I,{title:`Waitlist (${o.length})`,right:(0,C.jsxs)(x.Muted,{children:["new party about ",(0,S.estimateWait)(o.length+1,t.settings.turnMins,h)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,C.jsx)(x.Muted,{children:"Nobody waiting."}):null,o.map((l,o)=>{const u=(0,v.suggestTable)(s,i,a,l.partySize,r,(0,v.turnFor)(l.partySize,t.settings.turnMins)),b=(0,S.estimateWait)(o+1,t.settings.turnMins,h),k=Math.max(0,(0,n.minsBetween)(new Date(l.joinedAt),r)),$=z.find(t=>t.rid===e&&t.text.includes(`#${l.number} `));return(0,C.jsxs)(m.default,{style:{backgroundColor:T.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(x.T,{weight:"semibold",children:["#",l.number," ",(0,p.pv)(l.name,c)," \xb7 ",l.partySize]}),(0,C.jsxs)(x.T,{size:12,colour:k>b?T.colours.amber:T.colours.muted,children:["waited ",k,"m \xb7 quoted about ",b,"m"]})]}),u?(0,C.jsxs)(x.T,{size:12,colour:u.clashes?T.colours.amber:T.colours.ok,children:["Best table: ",u.table," (",u.why,")"]}):(0,C.jsx)(x.T,{size:12,colour:T.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,C.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(x.Button,{small:!0,label:$||'notified'===l.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${l.number}`,onPress:()=>{j.useFloor.getState().logSms(e,r.toISOString(),`#${l.number} ${l.partySize}: Your table at ${t.name} is ready.`),y.repo.waitlist.setStatus(l.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),u?(0,C.jsx)(x.Button,{small:!0,kind:"success",label:`Seat at ${u.table}`,onPress:async()=>{await y.repo.waitlist.setStatus(l.id,'seated'),await y.repo.bookings.seatWalkIn(e,l.partySize,u.table,`From waitlist #${l.number}`),(0,f.resetTableLive)(e,u.table),w(`Waitlist #${l.number} seated at ${u.table}`)}}):null,(0,C.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>y.repo.waitlist.setStatus(l.id,'removed')})]}),'notified'===l.status?(0,C.jsx)(x.Badge,{kind:"ok",label:`Told table ready${$?` ${(0,n.hm)(new Date($.at))}`:''} `}):null]},l.id)}),(0,C.jsxs)(x.Row,{gap:6,children:[(0,C.jsx)(l.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:k,onChangeText:$,style:[x.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,C.jsx)(b.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:T.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(x.T,{weight:"bold",colour:T.colours.gold,children:B})}),(0,C.jsx)(x.Button,{small:!0,label:"Add",disabled:k.trim().length<2,onPress:()=>{y.repo.waitlist.join(e,k.trim(),B),$('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:l,now:a,walkInCount:o,staffOn:r,onSummary:u}){const c=o+l.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)),f=h?c/h:1,p=f>=1.1?T.colours.amber:f>=.85?T.colours.ok:T.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,n.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,n.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,v.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),k=y.filter(e=>e.future&&e.covers>j),S=t.nextHour?.covers??0,$=Math.ceil(S/16);return(0,C.jsxs)(I,{title:"Pace & kitchen",right:(0,C.jsx)(x.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,C.jsxs)(m.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${h}`,style:{gap:4},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{size:14,children:"Covers so far"}),(0,C.jsxs)(x.T,{weight:"bold",colour:p,children:[c," ",(0,C.jsxs)(x.T,{size:13,colour:T.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,C.jsx)(m.default,{style:{height:10,borderRadius:5,backgroundColor:(0,s.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,C.jsx)(m.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,C.jsxs)(x.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,i.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,C.jsx)(x.T,{size:13,colour:T.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,C.jsx)(m.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,C.jsxs)(m.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,C.jsx)(x.T,{size:10,colour:T.colours.muted,children:e.covers||''}),(0,C.jsx)(m.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?T.colours.red:e.future?'#6B5A3A':T.colours.gold}}),(0,C.jsx)(x.T,{size:9,colour:4===t?T.colours.gold:T.colours.muted,children:(0,n.hm)(e.from)})]},t))}),k.map(e=>(0,C.jsxs)(x.T,{size:13,colour:T.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,n.hm)(e.from),"\u2013",(0,n.hm)((0,n.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),$>r?(0,C.jsxs)(x.T,{size:13,colour:T.colours.amber,children:["\u26a0 Next hour about ",S," Covers with ",r," on: about ",$-r," more on the floor suggested."]}):(0,C.jsxs)(x.T,{size:13,colour:T.colours.ok,children:["Staffing looks OK for the next hour (",r," on)."]}),(0,C.jsx)(x.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),r=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,n.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,j.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{children:e}),(0,C.jsx)(x.T,{weight:"semibold",children:t})]},e);return(0,C.jsxs)(x.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(r)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,C.jsx)(x.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return j.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]),c=_r(d[9]);_r(d[10]);var b=e(_r(d[11])),h=e(_r(d[12])),m=e(_r(d[13])),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]),C=_r(d[25]);const I=({title:e,right:t,children:s,testID:l})=>(0,C.jsxs)(m.default,{testID:l,style:{backgroundColor:T.colours.surface,borderRadius:14,borderWidth:1,borderColor:T.colours.border,padding:10,gap:6},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{weight:"semibold",colour:T.colours.gold,children:e}),t]}),s]});const B=e=>(0,C.jsxs)(m.default,{style:{gap:6},children:[(0,C.jsxs)(x.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,C.jsxs)(x.Muted,{children:[e.time," \xb7 ",e.table?(0,j.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,C.jsx)(k.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,C.jsx)(c.BookingNeeds,{b:e,big:!0}),e.notes?(0,C.jsxs)(x.T,{children:["Notes: ",e.notes]}):(0,C.jsx)(x.Muted,{children:"No notes."}),e.allergies.length?(0,C.jsx)(m.default,{style:{backgroundColor:T.colours.redBg,borderRadius:8,padding:8},children:(0,C.jsxs)(x.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,w.allergenLabel)(e.allergen)} \u2014 ${(0,w.severityLabel)(e.severity)}`).join('; ')]})}):(0,C.jsx)(x.Muted,{children:"No allergies declared."}),(0,C.jsx)(t.ShowNumberButton,{b:e},`num-${e.id}`)]});const D=!0},1356,[1353,828,827,860,1140,1114,1132,858,34,1102,236,402,295,102,794,1119,1344,874,1025,861,1112,1100,1303,821,1318,25]); __d(function(g,_r,_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.']}]},1357,[827,34,236,402,102,794,874,1025,1358,821,1359,1361,25]); __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1358,[]); @@ -1475,7 +1475,7 @@ __d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModul __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1392,[34,402,1166,794,821,25]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=f,_e.BookingUndo=function({b:e,rid:t,today:h,who:k}){const[$,w]=(0,s.useState)(!1),y=f(e,h);if(!y)return null;const p=(0,l.tableCardLabel)(e.table),j=l.useFloor.getState().setLive;if('unseat'===y)return $?(0,b.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,b.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",k,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',p?` and ${p} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,b.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${k}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:void 0,dirty:!1})),w(!1)}}),(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${k} seated`,onPress:()=>w(!1)})]})]}):(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${k}: ${e.walkIn?'removes the walk-in':'back to booked'}${p?`, frees ${p}`:''}`,onPress:()=>w(!0)});const x='undo-finished'===y?'seated':'confirmed';return(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===y?`Undo finished: ${k} back to seated${p?` at ${p}`:''}`:`Undo no-show: ${k} back to booked`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,x),'seated'===x&&(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:'seated',dirty:!1}))}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]);function f(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1393,[34,102,874,1025,794,821,25]); __d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1394,[34,102,879,874,864,821,794,25]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=E,_e.signInWithText=H,_e.SignInWithLink=V,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return!h.IS_CAR&&(v.includes(h.APP_VARIANT)&&!b.PITCH&&!e&&!M())},_e.InviteGate=function(){const[e,H]=(0,u.useState)(p.useSession.persist.hasHydrated()),[D,F]=(0,u.useState)(p.START_INVITE||p.START_HANDOVER?'checking':'done'),[W,L]=(0,u.useState)(null),[K,U]=(0,u.useState)(0),[G,Y]=(0,u.useState)(!1),[$,B]=(0,u.useState)(null),X=(0,p.useSession)(e=>e.meId),Q=(0,p.useSession)(e=>!X||!!e.welcomed[X]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>H(!0));return p.useSession.persist.hasHydrated()&&H(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_HANDOVER&&!p.START_INVITE&&!z){z=!0;const n=await(0,I.claimChromeHandover)(p.START_HANDOVER);if(!t)return;if('ok'===n.status&&n.id.staffRef){R(N(n.id.staffRef)??E({id:n.id.staffRef,name:n.id.displayName||n.id.staffRef,role:'owner'===n.id.role?'owner':'manager'===n.id.role?'manager':'staff',level:'head_chef'===n.id.role?'Head Chef':void 0,job:'',active:!0}))}else if('refused'===n.status&&!e)return L(n.message),void F('done')}if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&L(e)});if(!t)return;if('refused'===e.kind)return L(e.message),void F('done');if('offline'===e.kind)return Y(!0),void(n=setTimeout(()=>{t&&U(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void F('bad')}const o=N(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),B(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}F('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,K]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!X){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t,{app:s,message:l})})}if(G)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===D)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!X&&!b.PITCH)return W&&/already been used/i.test(W)?j(x,'invite-app-used'):W&&(0,S.isPhoneLinked)(W)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):W?j(W,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===D)return(0,w.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,w.jsx)(T.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,w.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F('done')}),(0,w.jsx)(T.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(W&&!X&&(0,S.isPhoneLinked)(W))return(0,w.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:24,weight:"bold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,w.jsx)(T.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,w.jsx)(T.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(W&&!X)return(0,w.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,w.jsx)(T.Muted,{center:!0,children:W}),(0,w.jsx)(T.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,w.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>L(null)})]});if($&&!X)return(0,w.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,w.jsx)(T.Muted,{center:!0,children:$}),(0,w.jsx)(V,{})]});if(!X&&!b.PITCH&&!M())return(0,w.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:W?'This link can\u2019t be used here':'Sign in to CoverCharge'}),W?(0,w.jsx)(T.Muted,{center:!0,children:W}):null,(0,w.jsx)(T.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,w.jsx)(V,{})]});const q=(0,p.rosterPerson)(X);return q&&!Q&&_(q)?(0,w.jsx)(k.LaunchWelcome,{p:q,onDone:()=>p.useSession.getState().markWelcomed(q.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),m=_r(d[12]),k=_r(d[13]),T=_r(d[14]),I=_r(d[15]),b=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),w=_r(d[20]);const x='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,w.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const N=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return R(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=N(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=N(o.id.staffRef)??E({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return R(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function V(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,w.jsxs)(f.default,{style:{gap:6},children:[(0,w.jsx)(T.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsx)(T.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,w.jsx)(T.T,{size:13,colour:m.colours.red,children:t}):null]})}let z=!1;const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1395,[5,1396,1397,1398,1399,1400,34,236,41,102,872,1003,821,1401,794,988,2,1093,1002,892,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=E,_e.signInWithText=H,_e.SignInWithLink=V,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId),n=(0,T.useSync)(e=>'device'===e.kind&&!!e.venueId);return h.IS_CAR?!b.PITCH&&!n:j.includes(h.APP_VARIANT)&&!b.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,H]=(0,u.useState)(p.useSession.persist.hasHydrated()),[D,F]=(0,u.useState)(p.START_INVITE||p.START_HANDOVER?'checking':'done'),[W,L]=(0,u.useState)(null),[K,U]=(0,u.useState)(0),[G,Y]=(0,u.useState)(!1),[$,B]=(0,u.useState)(null),X=(0,p.useSession)(e=>e.meId),Q=(0,p.useSession)(e=>!X||!!e.welcomed[X]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>H(!0));return p.useSession.persist.hasHydrated()&&H(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!j.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_HANDOVER&&!p.START_INVITE&&!z){z=!0;const n=await(0,T.claimChromeHandover)(p.START_HANDOVER);if(!t)return;if('ok'===n.status&&n.id.staffRef){R(N(n.id.staffRef)??E({id:n.id.staffRef,name:n.id.displayName||n.id.staffRef,role:'owner'===n.id.role?'owner':'manager'===n.id.role?'manager':'staff',level:'head_chef'===n.id.role?'Head Chef':void 0,job:'',active:!0}))}else if('refused'===n.status&&!e)return L(n.message),void F('done')}if(p.START_INVITE&&!(e&&await(0,T.signedInHereAs)(e)&&await(0,T.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&L(e)});if(!t)return;if('refused'===e.kind)return L(e.message),void F('done');if('offline'===e.kind)return Y(!0),void(n=setTimeout(()=>{t&&U(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void F('bad')}const o=N(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,T.signedInHereAs)(o.id)){if(await(0,T.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),B(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}F('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,K]),!j.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!X){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t,{app:s,message:l})})}if(G)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===D)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!X&&!b.PITCH)return W&&/already been used/i.test(W)?v(x,'invite-app-used'):W&&(0,S.isPhoneLinked)(W)?v(S.PHONE_LINKED_TEXT,'invite-phone-linked'):W?v(W,'invite-app-refused'):v(P,'invite-app-notsetup');if('bad'===D)return(0,w.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,w.jsx)(I.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,w.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F('done')}),(0,w.jsx)(I.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(W&&!X&&(0,S.isPhoneLinked)(W))return(0,w.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:24,weight:"bold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,w.jsx)(I.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,w.jsx)(I.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(W&&!X)return(0,w.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,w.jsx)(I.Muted,{center:!0,children:W}),(0,w.jsx)(I.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,w.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>L(null)})]});if($&&!X)return(0,w.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,w.jsx)(I.Muted,{center:!0,children:$}),(0,w.jsx)(V,{})]});if(!X&&!b.PITCH&&!M())return(0,w.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:W?'This link can\u2019t be used here':'Sign in to CoverCharge'}),W?(0,w.jsx)(I.Muted,{center:!0,children:W}):null,(0,w.jsx)(I.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,w.jsx)(V,{})]});const q=(0,p.rosterPerson)(X);return q&&!Q&&_(q)?(0,w.jsx)(k.LaunchWelcome,{p:q,onDone:()=>p.useSession.getState().markWelcomed(q.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),m=_r(d[12]),k=_r(d[13]),I=_r(d[14]),T=_r(d[15]),b=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),w=_r(d[20]);const x='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,n)=>(0,w.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:e})}),j=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const N=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return R(t),_(t)?((0,T.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=N(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,T.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=N(o.id.staffRef)??E({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return R(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function V(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,w.jsxs)(f.default,{style:{gap:6},children:[(0,w.jsx)(I.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsx)(I.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,w.jsx)(I.T,{size:13,colour:m.colours.red,children:t}):null]})}let z=!1;const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1395,[5,1396,1397,1398,1399,1400,34,236,41,102,872,1003,821,1401,794,988,2,1093,1002,892,25]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1396,[34,102,873,794,5,6,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1397,[]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1398,[34,102,873,794,25]); diff --git a/car-app/index.html b/car-app/index.html index 2392e3e40fbf28d99e302b39651f456a6d6c2c92..c2005480fa56a2254dae9c0c26e34a0985a77c03 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 c63f21484feac126ace101d7c1734c749e61fef6..4518c1c7e431b827225882565ddc253cb91065f1 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 bff71d7ea6f3991b80554175975124df6373fd00..44e5e24306695a85f8bfbda5ca427598e5b2b52a 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-963578733e"; +const V = "cc-car-e6c1d606f6"; const BASE = "/car-app/"; -const PRECACHE = ["/car-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/car-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/car-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/car-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/car-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/car-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/car-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/car-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/car-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/car-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/car-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/car-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/car-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/car-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/car-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/car-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/car-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/car-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/car-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/car-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/car-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/car-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/car-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/car-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/car-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/car-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/car-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/car-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/car-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/car-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/car-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/car-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/car-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/car-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/car-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/car-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/car-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/car-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/car-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/car-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/car-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/car-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/car-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/car-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/car-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/car-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/car-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/car-app/favicon.ico", "/car-app/index.html", "/car-app/_expo/static/js/web/bundle.js?v=963578733e87371ffa94a643d062ee06260a9f7e8296a2fb61fcc827b2a019d5"]; +const PRECACHE = ["/car-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/car-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/car-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/car-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/car-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/car-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/car-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/car-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/car-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/car-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/car-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/car-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/car-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/car-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/car-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/car-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/car-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/car-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/car-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/car-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/car-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/car-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/car-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/car-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/car-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/car-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/car-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/car-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/car-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/car-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/car-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/car-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/car-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/car-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/car-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/car-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/car-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/car-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/car-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/car-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/car-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/car-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/car-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/car-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/car-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/car-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/car-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/car-app/favicon.ico", "/car-app/index.html", "/car-app/_expo/static/js/web/bundle.js?v=e6c1d606f672bd9d71fd6c8a662476187585a8e5cdc989f40c821e82deeaf8ed"]; // 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 32fcc49872cfb61fbbaeb2ecd6839c66a337112f..def8c6efbed1a55e822fccd2875edd480fd9290d 100644 --- a/chef-app/_expo/static/js/web/bundle.js +++ b/chef-app/_expo/static/js/web/bundle.js @@ -1095,7 +1095,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()})},1012,[34,1013]); __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},1013,[1010,978,1014]); __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'}},1014,[1010]); -__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.155'},1015,[]); +__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.156'},1015,[]); __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});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:h}=await r.select();c&&s(c,h);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},h='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,h.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),h}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),h={...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:h})}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}}},1016,[1017,1018,934,978,1013]); __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())}}}},1018,[978]); @@ -1196,9 +1196,9 @@ __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,"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'},1113,[821]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},1114,[34,102,1115,821,1116,794,25]); __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 b={...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)(b)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(b,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}});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})},1115,[860,1100]); -__d(function(_g,r,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=$,_e.TablePicker=function({rid:e,booking:u,name:p,turnBase:k=90,onClose:v,onSaved:w,onPickOnPlan:T}){const C=(0,b.usePlan)(e),L=(0,c.useBookings)(e),[S,W]=(0,t.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),P=(0,t.useMemo)(()=>(0,h.pickGroups)(C),[C]),z=L.filter(e=>e.date===u.date),O=(0,h.seatsOf)(C,S),D=(0,h.seatLine)(O.total,u.partySize),I=(0,h.pickClashes)(u,S,z,k),B=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,M=(0,h.tableKey)(S)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),N=(0,f.useBlocks)(e=>e.blocks),R=(0,f.blockAt)(N,e,u.date,u.time),_=e=>W(s=>(0,h.toggleTable)(s,e)),Y=async s=>{try{await $(e,u,s),w?.((0,h.savedWords)(p,u.partySize,s,(0,h.seatsOf)(C,s).total)),v()}catch(e){w?.(`Couldn\u2019t save tables for ${p}: ${String(e?.message??e).slice(0,120)}`)}},G=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(S)} picked. ${D.text}.`,children:[(0,x.jsx)(y.T,{size:18,weight:"semibold",colour:g.colours.goldLight,children:(0,h.tablesWords)(S)}),(0,x.jsx)(y.T,{size:17,colour:g.colours.text,children:D.text})]}),R?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${R.from} to ${R.to}${R.reason?` (${R.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.goldMuted},children:(0,x.jsxs)(y.T,{size:16,colour:g.colours.goldLight,children:["New bookings paused ",R.from,"\u2013",R.to,R.reason?` \xb7 ${R.reason}`:'',". You can still save tables for this booking."]})}):null,I.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(I)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.gold},children:(0,x.jsxs)(y.T,{size:16,weight:"semibold",colour:g.colours.goldLight,children:[(0,h.clashWords)(I)," You can still save."]})}):null,(0,x.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(y.Button,{testID:"table-pick-save",label:I.length?'Save anyway':'Save tables',disabled:!M||!S.length,accessibilityLabel:`${I.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(S)} for ${p}. ${D.text}.${I.length?` ${(0,h.clashWords)(I)}`:''}`,onPress:()=>Y(S),style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(y.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${p}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(y.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:v,style:j})]})]});return(0,x.jsxs)(y.Sheet,{visible:!0,onClose:v,title:`Tables \xb7 ${u.time} ${p} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:G,children:[(0,x.jsx)(s.TableNumberWarning,{plan:C}),(0,x.jsx)(y.T,{size:16,colour:g.colours.text,children:"Tap one table, or several to join them. Tap again to take one off."}),T?(0,x.jsx)(y.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${p}`,onPress:()=>T(S),style:j}):null,P.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(y.T,{size:15,weight:"semibold",colour:g.colours.gold,children:e.area}),(0,x.jsx)(y.Row,{gap:8,wrap:!0,children:e.tables.map(e=>{const s=S.includes(e.name),t=B(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:s},'aria-checked':s,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,s,t),onPress:()=>_(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:s?2:1,borderColor:s?g.colours.gold:t?g.colours.goldMuted:g.colours.hairline,borderStyle:t&&!s?'dashed':'solid',backgroundColor:s?g.colours.gold:e?g.colours.tilePressed:g.colours.tile}),children:[(0,x.jsx)(y.T,{size:18,weight:"semibold",colour:s?g.colours.onGold:g.colours.text,children:(0,l.tableNumbers)(e.name)}),(0,x.jsxs)(y.T,{size:14,colour:s?g.colours.onGold:g.colours.muted,children:[e.seats," seats",t?' \xb7 booked':'']})]},e.name)})})]},e.area)),P.length?null:(0,x.jsx)(y.Muted,{children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var s=r(d[0]),l=r(d[1]),t=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),g=r(d[9]),p=r(d[10]),y=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function $(e,s,l){const t=(0,h.tableKey)(l),o=(0,b.tablesOf)(s.table);await c.repo.bookings.update(s.id,(0,u.tablePatch)(t||null)),'seated'===s.status&&s.date===(0,p.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(t).includes(e)).forEach(s=>b.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0})),t&&(0,k.resetTableLive)(e,t))}},1116,[1117,860,34,402,102,874,1025,1115,1118,821,858,794,1119,1022,25]); +__d(function(_g,r,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=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.amber,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(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?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.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=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1116,[1117,860,34,402,102,874,1025,1115,1118,821,858,794,1119,1022,25]); __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])},1117,[34,859,821,794,25]); -__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1118,[860,1100]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.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=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1118,[860,1100]); __d(function(g,_r,_i,_a,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 O}}),_e.useTableNames=N,_e.resetTableLive=M,_e.seatBookingNow=L,_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=F,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return R}}),_e.TablePicker=W,_e.WalkInSheet=E,_e.WalkInMatchPrompt=H,_e.AssignTableSheet=_,_e.undoNotice=Y,_e.NewBookingSheet=U,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[i,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,B.jsxs)(B.Fragment,{children:[s?(0,B.jsx)(E,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,B.jsx)(U,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,i?(0,B.jsx)(_,{booking:i.b,combine:i.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),i=_r(_d[5]),n=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),z=_r(_d[27]),B=_r(_d[28]);const O=Array.from({length:12},(e,t)=>String(t+1));function N(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function M(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}async function L(e,t){await f.repo.bookings.setStatus(t.id,'seated'),M(e,t.table)}function F(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=N(e),a=(0,S.useFloor)(t=>t.live[e])??{},i=(0,S.usePlan)(e),n=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(n,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(i.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,S.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,x.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const R=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function W({use:e,value:t,onPick:s,big:o,best:a,dense:i,bestSet:n,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=i?6:8,y=i?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(n??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,B.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],n=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!n,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,B.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?n?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:n,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:i?58:64,borderRadius:12,borderWidth:n||u?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:n||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:n?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||n?1:.55},children:[(0,B.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,B.jsx)(T.T,{weight:"bold",size:22,colour:n?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,B.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,B.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,B.jsx)(T.T,{size:i?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const A=[1,2,3,4,5,6,7,8];function E({onClose:e,onSeated:a,wide:i,initialTable:y}){const{rid:w,r:C,now:D}=(0,p.useCtx)(15e3),I=F(w,D),[$,P]=(0,r.useState)(2),[O,N]=(0,r.useState)(!1),[R,E]=(0,r.useState)(y??null),_=(0,S.usePlan)(w),Y=(0,f.useBookings)(w),U=(0,v.useBlocks)(e=>e.blocks),q=(0,v.closedAreasAt)(U,w,(0,x.ymd)(D),(0,x.hm)(D)),Q=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(I).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(_,Y.filter(e=>e.date===(0,x.ymd)(D)),e,$,D,(0,k.turnFor)($,C.settings.turnMins),90,void 0,{closed:q})?.table??null},[_,Y,I,$,q.size,D.getTime()]);(0,r.useEffect)(()=>{R&&(0,S.tablesOf)(R).some(e=>'Closed'===I[e]?.label)&&E(null)},[R,q.size]);const[V,G]=(0,r.useState)(!1),[K,X]=(0,r.useState)(''),J=(e,t=String(e),s=()=>{N(!1),P(e)})=>{const o='9+'===t?O:!O&&$===e;return(0,B.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:i?58:60,height:i?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,B.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},Z=(0,B.jsx)(s.PartySizeInput,{value:$,onChange:P,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),ee=(0,B.jsxs)(b.default,{style:{gap:8,width:i?256:void 0},children:[(0,B.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,B.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[A.map(e=>J(e)),J(9,'9+',()=>{N(!0),P(e=>e>=9?e:9)})]}),O?Z:null]}),[te,se]=(0,r.useState)(!1),[oe,le]=(0,r.useState)(null),ae=async(t=R,s=!1)=>{if(!te){if(!s){const e=(0,z.bookingsNearWalkIn)(Y,D,$);if(e.length)return void le({at:t,list:e})}se(!0);try{const s=await f.repo.bookings.seatWalkIn(w,$,t??void 0,K);M(w,t??void 0),a(s),e()}finally{se(!1)}}},ie=async(t,s)=>{if(!te){se(!0);try{const o=s??t.table??null;o&&o!==t.table&&await f.repo.bookings.assignTable(t.id,o),await L(w,{...t,table:o??void 0}),(0,n.notify)({id:`seated:${t.id}`,testID:'walkin-match-toast',timeoutMs:5e3,icon:'\u2713',title:`${t.name} seated \xb7 ${t.partySize} \xb7 ${o?(0,l.tableNumbers)(o):'table to assign'} (booking ${t.ref})`}),le(null),e()}finally{se(!1)}}},ne=(0,B.jsxs)(b.default,{style:{gap:8,flex:i?1:void 0,minWidth:0},children:[(0,B.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,B.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),R?(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>E(null)}):null]}),(0,B.jsx)(W,{use:I,value:R,onPick:e=>{I[e]&&!I[e].busy?ae(e):E(R===e?null:e)},big:i,dense:i,best:Q,bestSet:(0,u.bestTables)(_)}),(0,B.jsxs)(T.Muted,{children:["Tap a free table to seat them there",Q&&!R?` (suggested for ${$}: ${(0,l.tableNumbers)(Q)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(D)}`,maxWidth:i?1100:void 0,testID:"walkin-sheet",children:[(0,B.jsx)(T.Button,{label:`Seat walk-in \xb7 ${$} ${1===$?'person':'people'}${R?` \xb7 ${(0,l.tableNumbers)(R)}`:''}`,disabled:te,onPress:()=>{ae()},testID:"seat-walkin",style:{minHeight:52}}),i?(0,B.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[ee,ne]}):(0,B.jsxs)(B.Fragment,{children:[ee,ne]}),(0,B.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[V?(0,B.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:K,onChangeText:X,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,B.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,B.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]}),oe?(0,B.jsx)(H,{list:oe.list,busy:te,onYes:e=>{ie(e,oe.at)},onNo:()=>{const e=oe.at;le(null),ae(e,!0)},onClose:()=>le(null)}):null]})}function H({list:e,busy:t,onYes:s,onNo:o,onClose:a}){return(0,B.jsx)(T.Sheet,{visible:!0,onClose:a,title:"Booked party?",maxWidth:720,testID:"walkin-match",children:(0,B.jsxs)(b.default,{style:{gap:14},children:[e.map((e,o)=>(0,B.jsxs)(b.default,{testID:`walkin-match-${o}`,style:{gap:12,padding:16,borderRadius:16,borderWidth:2,borderColor:j.colours.gold,backgroundColor:'#15130F'},children:[(0,B.jsx)(b.default,{accessibilityRole:"header",accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:26,weight:"bold",colour:j.colours.goldLight,testID:"walkin-match-question",children:(0,z.walkInMatchQuestion)(e)})}),e.table?(0,B.jsxs)(T.T,{size:17,colour:j.colours.text,children:["Booked table ",(0,l.tableNumbers)(e.table)," \xb7 ",e.ref]}):(0,B.jsx)(T.T,{size:17,colour:j.colours.text,children:e.ref}),(0,B.jsx)(T.Button,{label:"Yes, seat booking",testID:"walkin-match-yes",disabled:t,accessibilityLabel:`Yes, seat ${e.name}'s booking, ${e.partySize} people`,onPress:()=>s(e),style:{minHeight:64}})]},e.id)),(0,B.jsx)(T.Button,{kind:"secondary",label:"No, new walk-in",testID:"walkin-match-no",disabled:t,onPress:o,style:{minHeight:64}})]})})}function _({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:i}=(0,p.useCtx)(15e3),n=F(o,i),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[n,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(i)),t,e.partySize,i,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,i.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),O=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&M(o,l),t()},L=C?(0,B.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,B.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,B.jsx)(b.default,{testID:"combine-short",children:(0,B.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,B.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,B.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>N(I)}),(0,B.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,B.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${R(e)}`,testID:"assign-table-sheet",footer:L,children:[v&&!C?(0,B.jsx)(b.default,{testID:"assign-suggested",children:(0,B.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,B.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,B.jsx)(W,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await N([e])}})]})}function Y(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${R(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function U({date:e,onClose:t,wide:n,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:O}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,L]=(0,r.useState)(ee.blocks),[W,A]=(0,r.useState)(!1),[E,H]=(0,r.useState)(''),[_,Y]=(0,r.useState)(2),[U,q]=(0,r.useState)(null),[Q,V]=(0,r.useState)(''),[G,K]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ie=(0,S.usePlan)(u),ne=(0,P.dogSetUp)(ie),re=!0===te.dog&&ne,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(_,c.settings.turnMins),be=F.filter(e=>e.date===M),he=e=>(0,k.freeTablesAt)(ie,be,_,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(R,u,M,e)}),ge=re&&U?he(U):[];(0,r.useEffect)(()=>{ae(null)},[re,U,_]);const pe=(0,y.bookingSlots)(c,ue,e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),_,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0),e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),me=(0,w.ukPhone)(G),[fe,ye]=(0,r.useState)(!1),ke=U?pe.find(e=>e.time===U):void 0,xe=ke&&ke.left<_?{left:Math.max(0,ke.left),time:ke.time}:null,je=ke&&null!=ke.partiesLeft&&ke.partiesLeft<1?{time:ke.time,cap:ke.partiesCap??0}:null,we=xe||je,Te=U?(0,v.blockAt)(R,u,M,U):void 0,Se='staff'!==z,ve=!!U&&!(0,D.dogTimeOk)(c,F,M,U,de),Ce=!oe.length&&E.trim().length>=2&&!!U&&(!we||fe)&&(0,o.validParty)(_)&&me.ok&&(0,w.emailOk)(X)&&(!Te||Se&&W)&&(!re||ge.length>0)&&!ve,De=te.wheelchair>0||te.stepFree;return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,B.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:_,audience:"staff"}),te.dog&&!ne?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,B.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(L(e),q(null),A(!1))}}),(0,B.jsxs)(T.Row,{gap:6,children:[(0,B.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,B.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,B.jsx)(T.Field,{label:"Name",value:E,onChangeText:H,placeholder:"e.g. Reid",testID:"nb-name"}),(0,B.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&G?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,B.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,B.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(T.T,{center:!0,children:"Covers"}),(0,B.jsx)(s.PartySizeInput,{value:_,onChange:e=>{Y(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!he(e.time).length||!(0,D.dogTimeOk)(c,F,M,e.time,de);return(0,B.jsx)(T.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,v.blockAt)(R,u,M,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:U===e.time,onPress:()=>{q(e.time),A(!1),ye(!1)}},e.time)})}),we?(0,B.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[xe?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(_,xe.left,xe.time)}):null,je?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overPartiesNote)(je.time,je.cap)}):null,(0,B.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&U?(0,B.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,B.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,B.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ie.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),ge.length?(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:ge.slice(0,10).map((e,t)=>(0,B.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${De&&(0,P.accessibleSetUp)(ie)&&!(0,P.isAccessible)(ie,e.table)?' \xb7 not step-free':''}`,selected:(le??ge[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",_," at ",U,". Try another time."]})]}):null,Te?(0,B.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,B.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",Te.from,"\u2013",Te.to,Te.reason?` (${Te.reason})`:'']}),Se?(0,B.jsx)(T.Chip,{label:W?'Manager override on':'Override and book anyway',selected:W,onPress:()=>A(e=>!e)}):(0,B.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,B.jsx)(b.default,{testID:"nb-closed",children:(0,B.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,B.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:_,date:M,time:U,today:(0,x.ymd)(h),bookings:F,audience:"staff",showTables:!1!==c.settings.tableRequests}),De&&!(0,P.accessibleSetUp)(ie)?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,B.jsx)(T.Field,{label:"Notes (optional)",value:Q,onChangeText:V,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,i.depositDue)((0,i.depositOf)(c.settings),_)?(0,B.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,i.depositDue)((0,i.depositOf)(c.settings),_))," (",(0,a.gbp)((0,i.depositOf)(c.settings).perPersonPence)," per person for ",(0,i.depositOf)(c.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,B.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),ve?(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",U,". Try another time: dogs are very welcome then."]}):null,(0,B.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Ce,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||ge.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:_,date:M,time:U,notes:Q.trim(),security:(0,i.depositDue)((0,i.depositOf)(c.settings),_)?'deposit':'none',depositPaid:0,...(0,i.depositDue)((0,i.depositOf)(c.settings),_)?{depositDue:(0,i.depositDue)((0,i.depositOf)(c.settings),_),depositPolicy:(0,i.depositWords)((0,i.depositOf)(c.settings),_,c.name).join(' '),depositRefundable:(0,i.depositOf)(c.settings).refundable,depositCutoffHours:(0,i.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===U)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??ge[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,O)).catch(()=>{}),d?.({date:M,time:U,name:E.trim()}),t()}})]})}},1119,[827,1120,1121,860,867,14,1122,34,859,402,102,872,1084,874,1123,1100,858,821,864,794,1025,1022,1124,1125,1130,1102,1096,1131,25]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,$]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{$(String(e))},[e]);const w=e=>p((0,s.clampParty)(e,b,y)),I=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>w(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:c.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(u.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:c.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?I(-10,'\u221210',"10 fewer people"):null,I(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{$(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&w((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);$(String(e)),w(e)},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:c.colours.border,color:c.colours.text,backgroundColor:c.colours.surface,textAlign:'center',fontSize:20,fontFamily:c.fonts.semibold}}),I(1,'+','One more person'),y-b>=20?I(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),c=r(_d[5]),u=r(_d[6]),d=r(_d[7])},1120,[34,402,412,102,1121,821,794,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return 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.`},1121,[]); @@ -1210,12 +1210,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}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"fitLabel",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"BIG_LABEL_MIN",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"OCC_LABEL_MIN",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"occupiedLabel",{enumerable:!0,get:function(){return S}}),_e.areaBounds=I,_e.minReadableScale=function(e,t){return Math.max(0,...e.tables.filter(e=>e.areaId===t).map(e=>{const t='round'===e.shape?.85:1,o=(7.4399999999999995*Math.max(1,(0,g.tableNumber)(e).length)+6)/(e.w*t),n=22/Math.min(e.w,e.h);return Math.max(o,n)}))},_e.seatSpots=R,_e.FixtureShape=T,_e.FloorCanvas=function(e){const[$,L]=(0,r.useState)({w:0,h:0}),z=e.plan.tables.filter(t=>t.areaId===e.areaId),E=e.crop&&z.length?I(e.plan,e.areaId):{x:0,y:0,w:l.PLAN_W,h:l.PLAN_H},F='live'===e.mode?[...new Map(z.flatMap(t=>{const o=e.view?.[t.name];if(!o?.group||o.group.length<2)return[];const n=[...o.group].sort().join('+');return[[n,{key:n,members:o.group,view:o}]]})).values()]:[],O=28*F.length,D={x:E.x,y:E.y,r:E.x+E.w,b:E.y+E.h},_=$.w?'width'===e.fit?Math.min($.w/l.PLAN_W,e.maxH?e.maxH/l.PLAN_H:9):Math.min($.w/E.w,Math.max(1,$.h-O)/E.h):0,B=e.fill&&'contain'===e.fit&&_>0&&$.h>0,N=B?($.w/_-E.w)/2:0,P=B?(($.h-O)/_-E.h)/2:0,W={x:D.x-N,y:D.y-P,r:D.r+N,b:D.b+P},H=W.r-W.x,G=W.b-W.y,[Y,X]=(0,r.useState)(null),U=(0,r.useRef)(null),[q,J]=(0,r.useState)(null),K=(0,r.useRef)(null);K.current=q,i.default.useEffect(()=>{if(!q)return;const e=setTimeout(()=>J(null),n.ARM_MS);return()=>clearTimeout(e)},[q]);const V='live'===e.mode&&!!e.onDrop,Q=e=>!V||(0,n.isArmed)(K.current,e.id,Date.now()),Z=t=>e.plan.sections.find(e=>e.id===t.sectionId),ee=t=>e.plan.joins.find(e=>e.tables.includes(t.name)),te=i.default.useMemo(()=>(0,g.numberClashes)(e.plan.tables).sameArea,[e.plan.tables]),oe=(t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>Q(t),onResponderTerminationRequest:()=>!Q(t),onResponderGrant:e=>{U.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,id:t.id,kind:o}},onResponderMove:n=>{const r=U.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,a=n.nativeEvent.pageY-r.y;Math.abs(i)+Math.abs(a)<6&&!Y||Q(t)&&('live'!==e.mode||e.onDrop&&e.view&&['seated','mains','dessert','bill'].includes(e.view[t.name]?.status)&&e.view[t.name]?.booking)&&X({id:t.id,dx:i,dy:a,kind:o})},onResponderRelease:r=>{const i=U.current;U.current=null;const s=r.nativeEvent.pageX-(i?.x??0),u=r.nativeEvent.pageY-(i?.y??0);if(X(null),Math.abs(s)+Math.abs(u)<6||!_){if('move'===o){if(V){const e=(0,n.releaseOn)(K.current,t.id,!1,Date.now());if(J(e.arm),'select'===e.action)try{a.default.announceForAccessibility(n.SELECTED_A11Y)}catch{}}e.onTap?.(t)}return}if(V){const e=(0,n.releaseOn)(K.current,t.id,!0,Date.now());if(J(e.arm),'move'!==e.action)return}const h=s/_,c=u/_;if('edit'===e.mode&&'move'===o)e.onMove?.(t,w(v(t.x+h,e.snapOn),0,l.PLAN_W-t.w),w(v(t.y+c,e.snapOn),0,l.PLAN_H-t.h));else if('edit'===e.mode&&'resize'===o)e.onResize?.(t,w(v(t.w+h,e.snapOn),50,400),w(v(t.h+c,e.snapOn),50,300));else if('live'===e.mode&&e.onDrop){const o=t.x+t.w/2+h,n=t.y+t.h/2+c,r=z.find(e=>e.id!==t.id&&o>=e.x-10&&o<=e.x+e.w+10&&n>=e.y-10&&n<=e.y+e.h+10);r&&e.onDrop(t,r)}}}),ne=e=>e*_,re=e=>ne(e-W.x),ie=e=>ne(e-W.y),ae='width'===e.fit?l.PLAN_H*_+O||200:void 0;return(0,x.jsxs)(s.default,{testID:"floor-canvas",onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),style:[{width:'100%',borderRadius:16,overflow:'hidden'},'contain'===e.fit?{flex:1}:{height:ae}],children:[F.map(e=>{const o=z.filter(t=>e.members.includes(t.name)),n=o.length?(Math.min(...o.map(e=>e.x))+Math.max(...o.map(e=>e.x+e.w)))/2:W.x+H/2,r=e.view.booking?.time??e.view.next?.time,i=`${A(e.members)}${r?` \xb7 ${'seated'===e.view.status?'Seated':'Booked'} ${r}`:''}`,a=Math.min(Math.max(0,$.w-8),260);return(0,x.jsx)(s.default,{testID:`joined-label-${e.key}`,accessible:!0,accessibilityLabel:`Joined tables ${i}`,pointerEvents:"none",style:{height:28,width:a,marginLeft:w(ne(n-W.x)-a/2,4,Math.max(4,$.w-a-4)),alignItems:'center',justifyContent:'center',overflow:'hidden',borderRadius:8,borderWidth:1,borderColor:h.colours.gold,backgroundColor:(0,t.soutersSurface)('#0B0B0B')},children:(0,x.jsx)(c.T,{size:16,weight:"bold",colour:h.colours.goldLight,center:!0,numberOfLines:1,children:i})},e.key)}),_?(0,x.jsx)(s.default,{style:{width:ne(H),height:ne(G),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0F0E0C'),borderRadius:16,borderWidth:1,borderColor:h.colours.border,overflow:'hidden'},children:(0,x.jsxs)(s.default,{style:{position:'absolute',left:0,top:0,width:ne(H),height:ne(G)},children:['edit'===e.mode?Array.from({length:l.PLAN_W/(2*l.GRID)},(e,o)=>(0,x.jsx)(s.default,{style:{position:'absolute',left:re(o*l.GRID*2),top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`v${o}`)):null,'edit'===e.mode?Array.from({length:l.PLAN_H/(2*l.GRID)},(e,o)=>(0,x.jsx)(s.default,{style:{position:'absolute',top:ie(o*l.GRID*2),left:0,right:0,height:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`h${o}`)):null,(e.plan.fixtures??[]).filter(t=>t.areaId===e.areaId).map(t=>(0,x.jsx)(T,{f:{...t,x:t.x-W.x,y:t.y-W.y},S:ne,live:'live'===e.mode},t.id)),e.plan.joins.map(e=>{const t=z.filter(t=>e.tables.includes(t.name));if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,x.jsx)(s.default,{testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:re((r+a)/2-u/2),top:ie((i+l)/2)-3,width:ne(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.55)',transform:[{rotate:`${h}rad`}]}},e.id)}),z.map(n=>{const r=e.view?.[n.name],a=r?u.STATUS[r.status]:u.STATUS.free,v=Y?.id===n.id,w=v&&'resize'===Y.kind?Math.max(50,n.w+Y.dx/_):n.w,$=v&&'resize'===Y.kind?Math.max(50,n.h+Y.dy/_):n.h,I=v&&'move'===Y.kind?n.x+Y.dx/_:n.x,T=v&&'move'===Y.kind?n.y+Y.dy/_:n.y,A=e.selected===n.id||e.highlight?.includes(n.name)||q?.id===n.id,L=Z(n),z='edit'===e.mode?'#2A2419':a.colour,E='edit'===e.mode?h.colours.text:a.fg,F='round'===n.shape?ne(Math.min(w,$))/2:ne(10),O='live'===e.mode?(0,g.liveTableLabel)(n,te):(0,l.tableLabel)(n),D=ne(Math.min(w,$))<64,B=r?r.covers>0?r.covers:'soon'===r.status?(r.next??r.dayBookings?.[0])?.partySize??0:0:0,N=e.big&&'live'===e.mode&&r&&!(r.group&&r.group.length>1)&&k.has(r.status)&&B>0,P=N?S(O,B):O,W=M(e.big?Math.max(13,Math.min(34,ne(Math.min(w,$))/3)):Math.max(11,Math.min(22,ne(Math.min(w,$))/4)),P,ne(w)*('round'===n.shape?.85:1),N?C:e.big?j:9),H=ne(w)*('round'===n.shape?.85:1),G=e=>e.length*W*.62+6,X=N&&G(P)>H,U=X&&Math.max(G(O),G(`(${B})`))<=H&&1.2*W*2<=ne($)-4,J=X&&!U,K=Math.max(e.big?11:12,Math.round(.62*W)),V=(ne($)-6-1.4*W)/(1.4*K),Q=V>=2&&ne(w)>=5*K?2:V>=1?1:0,ae=r?.booking&&void 0!==r.seatedMins?r.booking.time:void 0,se='soon'===r?.status?r.next?.time??r.dayBookings?.[0]?.time:void 0,le='edit'===e.mode?`Table ${(0,o.tableNumbers)(O)}, ${(0,l.shapeLabel)(n.shape).toLowerCase()}, ${n.minSeats}\u2013${n.maxSeats} seats${n.online?', bookable online':''}`:'soon'===r?.status?`Table ${(0,o.tableNumbers)(O)}, booked later${se?`, ${se}`:''}${r.group?`, combined with ${r.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`:`Table ${(0,o.tableNumbers)(O)}, ${a.label}${void 0!==r?.seatedMins?`, seated ${r.seatedMins} min`:''}${r?.covers?`, ${r.covers} Covers`:''}${r?.dayBookings?.length?`, booked: ${r.dayBookings.map(e=>`${e.time}, ${e.partySize} Covers`).join('; ')}`:''}${r?.group?`, combined with ${r.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`,de=void 0!==r?.seatedMins&&r.booking?Math.min(1.2,r.seatedMins/(r.booking.durationMins??(0,u.turnFor)(r.booking.partySize,e.turnBase))):null;return(0,x.jsxs)(i.default.Fragment,{children:[R({...n,w:w,h:$}).map((t,o)=>(0,x.jsx)(s.default,{pointerEvents:"none",style:[{position:'absolute',left:re(I+t.x)-Math.max(4,ne(8)),top:ie(T+t.y)-Math.max(4,ne(8)),width:Math.max(8,ne(16)),height:Math.max(8,ne(16)),borderRadius:99,backgroundColor:'edit'===e.mode?'#5A4C33':'rgba(255,255,255,0.16)',borderWidth:1,borderColor:'edit'===e.mode?h.colours.gold:'rgba(255,255,255,0.25)'},y()]},o)),'live'===e.mode&&(ne(w)<44||ne($)<44)?(0,x.jsx)(s.default,{accessible:!1,importantForAccessibility:"no-hide-descendants",'aria-hidden':!0,...oe(n,'move'),style:{position:'absolute',left:re(I+w/2)-Math.max(44,ne(w))/2,top:ie(T+$/2)-Math.max(44,ne($))/2,width:Math.max(44,ne(w)),height:Math.max(44,ne($)),zIndex:2}}):null,(0,x.jsxs)(s.default,{testID:`table-${n.name}`,accessibilityRole:"button",accessibilityLabel:le,onAccessibilityTap:()=>e.onTap?.(n),onKeyDown:t=>{'Enter'!==t?.key&&' '!==t?.key||e.onTap?.(n)},tabIndex:0,...oe(n,'move'),style:[{position:'absolute',left:re(I),top:ie(T),width:ne(w),height:ne($),borderRadius:F,backgroundColor:z,alignItems:'center',justifyContent:'center',padding:2,overflow:J?'visible':'hidden',borderWidth:A?3:e.sectionColours&&L?2.5:1.5,borderColor:A?'#FFFFFF':e.sectionColours&&L?(0,h.brandColour)(L.colour):'edit'===e.mode?h.colours.gold:'rgba(0,0,0,0.35)',transform:[{scale:v?1.06:1}],zIndex:v?50:J?4:3,opacity:v&&'live'===e.mode?.85:1,shadowColor:'#000',shadowOpacity:v?.6:.3,shadowRadius:v?14:6,cursor:'edit'===e.mode?'grab':'pointer',touchAction:'none'},v?null:y()],children:[(0,x.jsxs)(s.default,{style:J?{alignItems:'center',justifyContent:'center',overflow:'visible'}:{alignItems:'center',justifyContent:'center',maxWidth:'100%',maxHeight:'100%',overflow:'hidden'},pointerEvents:"none",children:[N?(0,x.jsx)(c.T,{testID:`table-label-${n.name}`,style:U?{flexShrink:0,lineHeight:Math.round(1.2*W),maxWidth:Math.max(20,H-4)}:J?{...p,whiteSpace:'nowrap',textShadowColor:'rgba(0,0,0,0.9)',textShadowRadius:3,textShadowOffset:{width:0,height:0}}:p,weight:"bold",size:W,colour:J?'#FFFFFF':E,center:!0,numberOfLines:U?2:1,children:P}):(0,x.jsx)(c.T,{style:p,weight:"bold",size:W,colour:E,center:!0,numberOfLines:1,children:O}),'live'===e.mode&&'blocked'===r?.status?(0,x.jsx)(c.T,{style:f,size:Math.max(10,Math.round(.5*W)),weight:"semibold",colour:E,center:!0,numberOfLines:1,children:"Blocked"}):null,N||'live'===e.mode&&r?.group&&r.group.length>1?null:e.big&&'live'===e.mode&&r&&1===Q?'free'!==r.status&&'soon'!==r.status&&(r.covers||ae)?(0,x.jsx)(c.T,{style:f,size:K,weight:"bold",colour:E,center:!0,numberOfLines:1,children:[r.covers?`${r.covers}`:'',ae??''].filter(Boolean).join(' \xb7 ')}):null:e.big&&'live'===e.mode&&r&&2===Q?(0,x.jsxs)(x.Fragment,{children:['soon'!==r.status&&r.covers?(0,x.jsxs)(c.T,{style:f,size:K,weight:"semibold",colour:E,center:!0,children:[r.covers," ",1===r.covers?'Cover':'Covers']}):'free'!==r.status||D?null:(0,x.jsxs)(c.T,{style:f,size:K,colour:E,center:!0,children:[n.minSeats,"\u2013",n.maxSeats]}),'free'!==r.status&&'soon'!==r.status&&ae?(0,x.jsx)(c.T,{style:f,size:K,weight:"bold",colour:E,center:!0,children:ae}):'dirty'===r.status?(0,x.jsx)(c.T,{style:f,size:K,colour:E,center:!0,children:"Clear"}):null]}):e.big&&'live'===e.mode?null:'edit'===e.mode?D?null:(0,x.jsxs)(c.T,{style:f,size:11,colour:h.colours.muted,center:!0,children:[n.minSeats,"\u2013",n.maxSeats,n.online?' \xb7 online':'']}):r?(0,x.jsxs)(x.Fragment,{children:['free'!==r.status||D?null:(0,x.jsxs)(c.T,{style:f,size:11,colour:E,center:!0,children:[n.minSeats,"\u2013",n.maxSeats," seats"]}),void 0!==r.seatedMins?(0,x.jsxs)(c.T,{style:f,size:12,weight:"semibold",colour:E,center:!0,children:[r.seatedMins,"m \xb7 ",r.covers,"\ud83d\udc65"]}):r.orderOnly?(0,x.jsx)(c.T,{style:f,size:11,colour:E,center:!0,children:"Open order"}):null,'dirty'!==r.status||D?null:(0,x.jsx)(c.T,{style:f,size:11,colour:E,center:!0,children:"Clear"}),!D||r.allergy||r.vip?(0,x.jsxs)(c.T,{style:f,size:11,colour:E,center:!0,children:[r.allergy?'\u26a0':'',r.vip?'VIP'===r.vip?'\u2605':'\u2665':'',r.occasion?u.OCCASION_ICON[r.occasion]:'',r.note?'\u270e':'']}):null]}):null]}),null,'live'===e.mode&&r&&!D&&(r.booking??r.next)&&(0,b.needsIcons)(r.booking??r.next).replace('\u26a0\ufe0f','').trim()?(0,x.jsx)(s.default,{pointerEvents:"none",testID:`needs-${n.name}`,style:{position:'absolute',bottom:e.big?-Math.max(9,.55*K):2,right:e.big?-6:4,backgroundColor:(0,t.soutersSurface)('rgba(11,11,11,0.85)'),borderRadius:8,paddingHorizontal:4,borderWidth:1,borderColor:'rgba(255,255,255,0.15)'},children:(0,x.jsx)(c.T,{size:e.big?Math.max(11,.75*K):10,children:(0,b.needsIcons)(r.booking??r.next).replace('\u26a0\ufe0f','').trim()})}):null,L&&'live'===e.mode&&e.sectionColours&&!D&&!e.big?(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:3,right:6,backgroundColor:(0,h.brandColour)(L.colour),borderRadius:6,paddingHorizontal:3},children:(0,x.jsx)(c.T,{size:9,weight:"bold",colour:"#0B0B0B",children:L.server})}):null,null===de||D?null:(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:'15%',right:'15%',bottom:5,height:4,borderRadius:2,backgroundColor:'rgba(0,0,0,0.25)'},children:(0,x.jsx)(s.default,{style:{width:`${Math.min(100,100*de)}%`,height:4,borderRadius:2,backgroundColor:de>=1?'#B3261E':'rgba(0,0,0,0.6)'}})}),ee(n)&&'edit'===e.mode?(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',bottom:2,left:4},children:(0,x.jsx)(c.T,{size:10,colour:h.colours.gold,children:"\u26d3"})}):null]}),'edit'===e.mode&&e.selected===n.id?(0,x.jsx)(s.default,{testID:"resize-handle",accessibilityLabel:"Resize table",...oe(n,'resize'),style:{position:'absolute',left:re(I+w)-14,top:ie(T+$)-14,width:28,height:28,borderRadius:14,backgroundColor:h.colours.gold,borderWidth:2,borderColor:'#fff',zIndex:60,cursor:'nwse-resize',touchAction:'none'}}):null]},n.id)}),0===z.length?(0,x.jsx)(s.default,{style:{position:'absolute',left:0,right:0,top:'45%'},children:(0,x.jsxs)(c.T,{center:!0,colour:h.colours.muted,children:["No tables in this area yet",'edit'===e.mode?' \u2014 add some in Tables':'',"."]})}):null]})}):null]})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),i=e(r),a=e(_r(d[4]));_r(d[5]);var s=e(_r(d[6])),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),c=_r(d[10]),b=_r(d[11]),g=_r(d[12]),x=_r(d[13]);const f={flexShrink:0},p={flexShrink:0,maxWidth:'none'},y=(e=250)=>({transitionProperty:'background-color, border-color, transform, left, top, width, height',transitionDuration:`${e}ms`}),v=(e,t=!0)=>t?Math.round(e/l.GRID)*l.GRID:Math.round(e),w=(e,t,o)=>Math.max(t,Math.min(o,e)),M=(e,t,o,n=9)=>Math.max(n,Math.min(e,(o-6)/(.62*Math.max(1,t.length)))),j=12,C=11,k=new Set(['soon','seated','mains','dessert','bill']),S=(e,t)=>`${e} (${t})`,$=46;function I(e,t){const o=e.tables.filter(e=>e.areaId===t);if(!o.length)return{x:0,y:0,w:l.PLAN_W,h:l.PLAN_H};const n=Math.max(0,Math.min(...o.map(e=>e.x))-$),r=Math.max(0,Math.min(...o.map(e=>e.y))-$);return{x:n,y:r,w:Math.min(l.PLAN_W,Math.max(...o.map(e=>e.x+e.w))+$)-n,h:Math.min(l.PLAN_H,Math.max(...o.map(e=>e.y+e.h))+$)-r}}function R(e){const t=Math.max(1,e.maxSeats),o=[];if('round'===e.shape){const n=e.w/2+9.6,r=e.h/2+9.6;for(let i=0;ie.w,r=Math.ceil(t/2),i=t-r;if(n){for(let t=0;te.w,a=n?{borderColor:'#FFFFFF',borderWidth:2}:null;return'bar'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#2A2216':'#3A2E1C',borderRadius:8,borderWidth:1.5,borderColor:o?'#5A4A30':h.colours.gold},a],children:(0,x.jsx)(c.T,{size:Math.max(9,Math.min(14,t(e.h)/2.4)),weight:"semibold",colour:h.colours.goldLight,children:"BAR"})}):'wall'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#3A3631':'#5C574F',borderRadius:2},a]}):'window'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:'rgba(226,196,137,0.16)',borderColor:'rgba(226,196,137,0.6)',borderWidth:1,borderRadius:2},a],children:!o&&t(i?e.h:e.w)>60?(0,x.jsx)(c.T,{size:9,colour:"#BFDDFF",style:i?{transform:[{rotate:'90deg'}]}:void 0,children:"WINDOW"}):null}):(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{borderColor:o?'#7A6440':h.colours.gold,borderWidth:1.5,borderStyle:'dashed',borderRadius:3,backgroundColor:'rgba(207,164,95,0.08)'},a],children:t(i?e.h:e.w)>40?(0,x.jsx)(c.T,{size:9,colour:h.colours.goldLight,style:i?{transform:[{rotate:'90deg'}]}:void 0,children:"DOOR"}):null})}function A(e){return(0,l.tablesLabel)(e.join('+')).replace(/^Tables? /,'').replace(/ \+ /g,'+')}},1127,[828,860,1128,34,281,236,102,1025,1100,821,794,1102,859,25]); __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])},1129,[34,402,102,874,861,863,821,794,25]); -__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 a}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return o}}),_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 d}}),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 l}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return f}}),_e.changedFields=P,_e.historyText=O,_e.editPatch=function(t,a,s,o=(new Date).toISOString()){const n=P(t,a);if(!n.length)return{};const d={};for(const c of n)switch(c){case'partySize':d.partySize=(0,e.clampParty)(Number(a.partySize));break;case'phone':case'email':case'table':d[c]=String(a[c]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[c]=String(a[c]??'').trim();break;case'area':d.area=(a.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(a.dogs??0)),d.dog=Number(a.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(a.highChairs??0))||void 0;break;case'wheelchair':d.access={...t.access??{},wheelchair:Math.max(0,Number(a.wheelchair??0))||void 0};break;case'occasion':d.occasion=a.occasion||void 0;break;case'allergies':d.allergies=[...a.allergies??[]],d.allergyNone=!!a.allergyNone&&!(a.allergies??[]).length,d.allergyNote=(a.allergyNote??'').trim()||void 0,(a.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(a.vegan??0)||void 0,vegetarian:Number(a.vegetarian??0)||void 0};break;case'deposit':if(!a.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(a.depositDue??0))),a.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(a.depositDate??'')?a.depositDate:o.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(a.depositAmount??0))),depositPaidBy:s.by.slice(0,80),depositPaidAt:e===o.slice(0,10)?o:`${e}T12:00:00.000Z`,depositMethod:a.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=a.status,'seated'!==a.status||t.seatedAt||(d.seatedAt=o),'finished'!==a.status||t.finishedAt||(d.finishedAt=o),'confirmed'!==a.status&&'pending'!==a.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=a.source||void 0;break;case'tags':d.tags=[...(t.tags??[]).filter(e=>!p.includes(e)),...a.tags??[]];break;case'duration':d.durationMins=Number(a.duration??0)>=15?Number(a.duration):void 0}n.includes('table')&&(d.tableSetHere=!0);const c=t;return d.locallyEdited=!0,d.editedFields=[...new Set([...c.editedFields??[],...n])],d.editLog=[...c.editLog??[],{at:o,by:s.by.slice(0,80),app:s.app,fields:n,text:O(t,a,n,s.by.slice(0,80),o)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>b[e]??e).join(', ')} changed by ${e.by} ${N(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,a,s,o,n=90,d){const c=[];if(!P(e,a).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return c;const u={...e,date:a.date,time:a.time,partySize:a.partySize,...Number(a.duration??0)>=15?{durationMins:Number(a.duration)}:{}};if(a.table){const e=(0,t.tableOverlaps)(u,a.table,s.filter(e=>e.date===a.date),n);if(e.length&&c.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),d){const e=a.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>d.tables.find(t=>t.name===e)).filter(Boolean),t=e.reduce((e,t)=>e+t.maxSeats,0);e.length&&td.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(a.dogs??0)>0&&s.length&&c.push(`Dogs aren\u2019t allowed in ${s[0].name}. Pick a dog-friendly table.`)}}o&&c.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return c},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return k}}),_e.bookingExtras=function(e){const t=e,a=e.dogs??(e.dog?1:0),s=[];a&&s.push(w(a,'dog','dogs'));t.highChairs&&s.push(w(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&s.push(w(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&s.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&s.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&s.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&s.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&s.push(`Deposit by ${t.depositMethod}`);return s.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]);const a='For example: birthday, high chair, dog, window seat',s='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.',o=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')},d=['date','time','partySize','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration'],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'}],l=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],h=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],p=['VIP','Regular'],b={date:'date',time:'time',partySize:'covers',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'},f=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:(a=e.depositPaidAt,a?a.slice(0,10):''),depositDue:e.depositDue??0,status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>p.includes(e)).sort(),duration:e.durationMins??0};var a},y=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),$=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'']:[!1]);function v(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return y(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return $(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':return Number(t[e]??0);default:return String(t[e]??'').trim()}}function P(e,t){const a=f(e);return d.filter(e=>v(e,a)!==v(e,t))}const S=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,N=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},w=(e,t,a)=>`${e} ${1===e?t:a}`;function O(e,t,a,s,o){const n=f(e),d=[];for(const e of[...a].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))'deposit'===e?t.depositOn?t.depositPaid&&!n.depositPaid?d.push(`deposit marked paid (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&n.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${S(Number(t.depositDue??0))}`):d.push('deposit taken off'):'dogs'===e?d.push(!n.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?w(Number(t.dogs),'dog','dogs'):'no dog now'):'highChairs'===e?d.push(t.highChairs?w(Number(t.highChairs),'high chair','high chairs'):'no high chair now'):'wheelchair'===e?d.push(t.wheelchair?w(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now'):'partySize'===e?d.push(`covers ${n.partySize} to ${t.partySize}`):'time'===e?d.push(`time ${n.time} to ${t.time}`):'date'===e?d.push(`date ${n.date} to ${t.date}`):'table'===e?d.push(t.table?`table ${t.table}`:'table taken off'):'status'===e?d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`):'occasion'===e?d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off'):'area'===e?d.push(t.area?`area ${t.area}`:'any area'):'duration'===e?d.push(t.duration?`table time ${t.duration} min`:'table time as usual'):d.push(`${b[e]} changed`);const c=d.join(', ');return`${c.charAt(0).toUpperCase()}${c.slice(1)} by ${s} ${N(o)}`}const k=e=>e.map(e=>b[e]).join(', ')},1130,[1121,1115]); +__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 n}}),_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 d}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return l}}),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}}),_e.changedFields=N,_e.historyText=k,_e.editPatch=function(t,a,s,o=(new Date).toISOString()){const n=N(t,a);if(!n.length)return{};const d={};for(const c of n)switch(c){case'partySize':d.partySize=(0,e.clampParty)(Number(a.partySize));break;case'phone':case'email':case'table':d[c]=String(a[c]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[c]=String(a[c]??'').trim();break;case'area':d.area=(a.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(a.dogs??0)),d.dog=Number(a.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(a.highChairs??0))||void 0;break;case'wheelchair':d.access={...t.access??{},wheelchair:Math.max(0,Number(a.wheelchair??0))||void 0};break;case'occasion':d.occasion=a.occasion||void 0;break;case'allergies':d.allergies=[...a.allergies??[]],d.allergyNone=!!a.allergyNone&&!(a.allergies??[]).length,d.allergyNote=(a.allergyNote??'').trim()||void 0,(a.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(a.vegan??0)||void 0,vegetarian:Number(a.vegetarian??0)||void 0};break;case'deposit':if(!a.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(a.depositDue??0))),a.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(a.depositDate??'')?a.depositDate:o.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(a.depositAmount??0))),depositPaidBy:s.by.slice(0,80),depositPaidAt:e===o.slice(0,10)?o:`${e}T12:00:00.000Z`,depositMethod:a.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=a.status,'seated'!==a.status||t.seatedAt||(d.seatedAt=o),'finished'!==a.status||t.finishedAt||(d.finishedAt=o),'confirmed'!==a.status&&'pending'!==a.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=a.source||void 0;break;case'tags':d.tags=[...(t.tags??[]).filter(e=>!b.includes(e)),...a.tags??[]];break;case'duration':d.durationMins=Number(a.duration??0)>=15?Number(a.duration):void 0}n.includes('table')&&(d.tableSetHere=!0);const c=t;return d.locallyEdited=!0,d.editedFields=[...new Set([...c.editedFields??[],...n])],d.editLog=[...c.editLog??[],{at:o,by:s.by.slice(0,80),app:s.app,fields:n,text:k(t,a,n,s.by.slice(0,80),o)}].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} ${w(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,s,o,n,d=90,c){const u=[];if(!N(e,s).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return u;const l={...e,date:s.date,time:s.time,partySize:s.partySize,...Number(s.duration??0)>=15?{durationMins:Number(s.duration)}:{}};if(s.table){const e=(0,t.tableOverlaps)(l,s.table,o.filter(e=>e.date===s.date),d);if(e.length&&u.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),c){const e=s.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>c.tables.find(t=>t.name===e)).filter(Boolean),t=e.reduce((e,t)=>e+t.maxSeats,0),o=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),t,s.partySize):null;o&&u.push(o);const n=e.map(e=>c.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(s.dogs??0)>0&&n.length&&u.push(`Dogs aren\u2019t allowed in ${n[0].name}. Pick a dog-friendly table.`)}}n&&u.push(`Bookings are paused ${n.from} to ${n.to}${n.reason?` (${n.reason})`:''}.`);return u},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return M}}),_e.bookingExtras=function(e){const t=e,a=e.dogs??(e.dog?1:0),s=[];a&&s.push(O(a,'dog','dogs'));t.highChairs&&s.push(O(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&s.push(O(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&s.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&s.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&s.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&s.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&s.push(`Deposit by ${t.depositMethod}`);return s.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),a=r(_d[2]);const s='For example: birthday, high chair, dog, window seat',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.',n=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const d=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},c=['date','time','partySize','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration'],u=['card','cash','bank transfer','website','other'],l=[{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',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'},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:(a=e.depositPaidAt,a?a.slice(0,10):''),depositDue:e.depositDue??0,status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0};var a},v=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),$=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'']:[!1]);function P(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return v(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return $(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':return Number(t[e]??0);default:return String(t[e]??'').trim()}}function N(e,t){const a=y(e);return c.filter(e=>P(e,a)!==P(e,t))}const S=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},O=(e,t,a)=>`${e} ${1===e?t:a}`;function k(e,t,a,s,o){const n=y(e),d=[];for(const e of[...a].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))'deposit'===e?t.depositOn?t.depositPaid&&!n.depositPaid?d.push(`deposit marked paid (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&n.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${S(Number(t.depositDue??0))}`):d.push('deposit taken off'):'dogs'===e?d.push(!n.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?O(Number(t.dogs),'dog','dogs'):'no dog now'):'highChairs'===e?d.push(t.highChairs?O(Number(t.highChairs),'high chair','high chairs'):'no high chair now'):'wheelchair'===e?d.push(t.wheelchair?O(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now'):'partySize'===e?d.push(`covers ${n.partySize} to ${t.partySize}`):'time'===e?d.push(`time ${n.time} to ${t.time}`):'date'===e?d.push(`date ${n.date} to ${t.date}`):'table'===e?d.push(t.table?`table ${t.table}`:'table taken off'):'status'===e?d.push(`status ${l.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`):'occasion'===e?d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off'):'area'===e?d.push(t.area?`area ${t.area}`:'any area'):'duration'===e?d.push(t.duration?`table time ${t.duration} min`:'table time as usual'):d.push(`${f[e]} changed`);const c=d.join(', ');return`${c.charAt(0).toUpperCase()}${c.slice(1)} by ${s} ${w(o)}`}const M=e=>e.map(e=>f[e]).join(', ')},1130,[1121,1115,1118]); __d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WALKIN_MATCH_MINS",{enumerable:!0,get:function(){return t}}),e.bookingsNearWalkIn=function(s,o,u,d=3){const c=n(o);return s.filter(t=>t.date===c&&!t.walkIn&&('confirmed'===t.status||'pending'===t.status)&&/^\d{2}:\d{2}/.test(t.time||'')).map(t=>({b:t,d:Math.abs((new Date(`${t.date}T${t.time.slice(0,5)}:00`).getTime()-o.getTime())/6e4)})).filter(n=>n.d<=t).sort((t,n)=>(u?Number(n.b.partySize===u)-Number(t.b.partySize===u):0)||t.d-n.d).slice(0,d).map(t=>t.b)},e.walkInMatchQuestion=function(t){return`Is this ${t.name}, ${t.time.slice(0,5)}, ${t.partySize} ${1===t.partySize?'person':'people'}?`};const t=45,n=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1131,[]); __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 y}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return h}}),_e.cancelWalkInWords=x,_e.reinstateWalkInWords=p,_e.cancelWalkInNow=$,_e.reinstateWalkInNow=I,_e.CancelWalkInButton=function({rid:e,b:t,onDone:l,small:s,big:o}){const[c,u]=(0,n.useState)(!1);return y(t)?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(f.Button,{kind:"secondary",small:s,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>u(!0),style:o?{minHeight:64}:s?{minHeight:44}:w}),c?(0,k.jsx)(j,{rid:e,b:t,onClose:()=>u(!1),onDone:l}):null]}):null},_e.CancelWalkInConfirm=j,_e.ReinstateWalkInButton=function({rid:e,b:t,today:l,onDone:o,small:c}){const[u,y]=(0,n.useState)(!1);if(!h(t,l))return null;const x=p(t);if(!u)return(0,k.jsx)(f.Button,{kind:"ghost",small:c,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>y(!0),style:c?{minHeight:44}:w});return(0,k.jsxs)(f.Sheet,{visible:!0,onClose:()=>y(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,k.jsx)(s.default,{accessible:!0,accessibilityLabel:x,children:(0,k.jsx)(f.T,{size:18,colour:b.colours.text,children:x})}),(0,k.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(f.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[w,{flexGrow:1}],onPress:async()=>{await I(e,t),y(!1),o?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,k.jsx)(f.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>y(!1),style:w})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=(e=l)&&e.__esModule?e:{default:e},o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]);const w={minHeight:56},y=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),h=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function x(e){const t=(0,c.tablesOf)(e.table),n=(0,u.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 p(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 $(e,n){await o.repo.bookings.setStatus(n.id,'cancelled'),await o.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,c.tablesOf)(n.table).forEach(t=>c.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function I(e,t){await o.repo.bookings.setStatus(t.id,'seated'),(0,c.tablesOf)(t.table).forEach(t=>c.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function j({rid:e,b:t,onClose:n,onDone:l}){const o=x(t);return(0,k.jsxs)(f.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,k.jsx)(s.default,{accessible:!0,accessibilityLabel:o,children:(0,k.jsx)(f.T,{size:18,colour:b.colours.text,children:o})}),(0,k.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(f.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[w,{flexGrow:1}],onPress:async()=>{await $(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,c.tablesOf)(t.table).length?` ${(0,u.tablesWords)((0,c.tablesOf)(t.table))} free.`:''}`)}}),(0,k.jsx)(f.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:w})]})]})}},1132,[1133,34,102,874,1025,1118,821,794,25]); __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})]})]})}},1133,[34,102,874,1025,1115,1134,1118,821,1003,892,872,794,25]); __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))}},1134,[]); -__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:a,inStaffApp:n,shiftManager:l,big:o,testID:d}){const[r,u]=(0,t.useState)(!1),x=(0,p.useSession)(e=>e.meId),j=(0,b.useOwner)(e=>e.staff.find(e=>e.id===x&&e.active));return s.walkIn||!(0,h.canEditBooking)({variant:c.APP_VARIANT,inStaffApp:n,role:a,shiftManager:l})||x&&!(0,m.canChangeBookings)(j)?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.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}}),r?(0,T.jsx)(B,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:a,hidePrivate:n}){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,60);return o?(0,T.jsx)(B,{rid:e,id:o,who:i,hidePrivate:n,onClose:a}):(0,T.jsxs)(f.Sheet,{visible:!0,onClose:a,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,T.jsx)(f.T,{size:16,colour:j.colours.text,children:"Tip: tap the booking you want to change."}),r.length?r.map(e=>(0,T.jsx)(f.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${e.date===s?'Today':e.date} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${e.date===s?'today':e.date}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56,alignItems:'flex-start'}},e.id)):(0,T.jsx)(f.Muted,{children:"No bookings to edit from today on."}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:a,style:{minHeight:44}})]})},_e.EditBookingSheet=B;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),a=_r(_d[3]),n=(e=a)&&e.__esModule?e:{default:e},l=_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]),j=_r(_d[15]),y=_r(_d[16]),D=_r(_d[17]),C=_r(_d[18]),I=_r(_d[19]),f=_r(_d[20]),T=_r(_d[21]);const v=/^([01]\d|2[0-3]):[0-5]\d$/,w=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const k=e=>e?(e/100).toFixed(e%100?2:0):'',S=e=>{const t=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(t)&&t>=0?Math.round(100*t):NaN},P=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',$=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')}`:''},N=e=>e.charAt(0).toUpperCase()+e.slice(1);function E({title:e,children:t,testID:s}){return(0,T.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,T.jsx)(f.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const z=({label:e,value:t,onChange:s,max:i=20,testID:a})=>(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:e}),(0,T.jsx)(f.Stepper,{testID:a,value:t,min:0,max:i,onChange:s,label:e})]});function B({rid:e,id:a,who:p,onClose:b,hidePrivate:m='display'===c.APP_VARIANT}){const B=(0,l.useBookings)(e),A=B.find(e=>e.id===a),O=(0,r.useRestaurant)(e),R=(0,o.usePlan)(e),L=(0,d.useBlocks)(e=>e.blocks),[F,W]=(0,t.useState)(A?(0,h.draftOf)(A):null),[M,_]=(0,t.useState)(null),[H,V]=(0,t.useState)(null),[Y,G]=(0,t.useState)(k(A?(0,h.draftOf)(A).depositDue:0)),[U,X]=(0,t.useState)(k(A?(0,h.draftOf)(A).depositAmount:0)),[q,J]=(0,t.useState)(P(A?(0,h.draftOf)(A).depositDate:''));if(!A||!F||!O)return null;const K=e=>{_(null),V(null),W({...F,...e})},Q=w(F.time),Z=v.test(Q),ee=F.area?R.areas.filter(e=>e.name===F.area).map(e=>e.id):null,te=e=>!ee||e.split('+').every(e=>ee.includes(R.tables.find(t=>t.name===e)?.areaId??'')),se=(0,x.tableOptions)(R,B.filter(e=>e.date===F.date),F.table).filter(e=>te(e)||e===F.table),ie=!(F.depositOn&&(Number.isNaN(S(Y||'0'))||F.depositPaid&&(Number.isNaN(S(U||'0'))||q.trim()&&!$(q)))),ae={...F,time:Q,depositDue:S(Y||'0')||0,depositAmount:S(U||'0')||0,depositDate:$(q)},ne=(0,h.changedFields)(A,ae),le=O.settings.turnMins??90,oe=async()=>{const t=(0,h.editPatch)(A,ae,{by:p||'Team member',app:c.APP_VARIANT});if(Object.keys(t).length&&await l.repo.bookings.update(A.id,t),'seated'===A.status&&'table'in t&&t.table!==A.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(A.table),a=s(t.table),n=o.useFloor.getState(),l=i.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!a.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),a.forEach(t=>n.setLive(e,t,{stage:l,dirty:!1}))}V(`Saved. Changed: ${(0,h.editedWords)(ne)}.`),_(null),b()},de=F.allergies??[],re=e=>K({allergyNone:!1,allergies:de.some(t=>t.allergen===e)?de.filter(t=>t.allergen!==e):[...de,{allergen:e,severity:'allergy'}]}),ce=(0,h.historyLines)(A);return(0,T.jsxs)(f.Sheet,{visible:!0,onClose:b,title:`Edit booking \xb7 ${A.name} \xb7 ${A.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,T.jsx)(n.default,{style:{alignItems:'center'},children:(0,T.jsx)(C.DepositChip,{b:A,money:!0,big:!0,testID:"edit-deposit"})}),(0,h.isWixBooking)(A)?(0,T.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:h.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:h.WIX_EDIT_NOTE})}):null,(0,T.jsx)(f.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,T.jsxs)(E,{title:"Deposit",testID:"edit-section-deposit",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No deposit",selected:!F.depositOn,testID:"edit-deposit-none",onPress:()=>K({depositOn:!1,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit due",selected:!!F.depositOn&&!F.depositPaid,testID:"edit-deposit-due",onPress:()=>K({depositOn:!0,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit paid",selected:!!F.depositOn&&!!F.depositPaid,testID:"edit-deposit-paid",onPress:()=>{U||X(Y),q||J(P((0,y.ymd)(new Date))),K({depositOn:!0,depositPaid:!0})}})]}),F.depositOn?(0,T.jsx)(f.Field,{label:"Deposit due (\xa3)",value:Y,onChangeText:e=>{G(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,F.depositOn&&F.depositPaid?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Amount paid (\xa3)",value:U,onChangeText:e=>{X(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"How was it paid?"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.DEPOSIT_METHODS.map(e=>(0,T.jsx)(f.Chip,{label:N(e),selected:F.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>K({depositMethod:e})},e))}),(0,T.jsx)(f.Field,{label:"Date paid (DD/MM/YYYY)",value:q,onChangeText:e=>{J((0,s.slashDate)(e,q)),K({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),q.trim()&&!$(q)?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,ie?null:(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,T.jsx)(f.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,T.jsxs)(E,{title:"When",testID:"edit-section-when",children:[(0,T.jsx)(D.BookingDatePicker,{r:O,today:new Date,value:F.date,onChange:e=>K({date:e})}),(0,T.jsx)(f.Field,{label:"Time (24-hour, for example 19:15)",value:F.time,onChangeText:e=>K({time:e}),testID:"edit-time"}),Z?null:(0,T.jsx)(f.T,{size:15,colour:j.colours.amber,children:"Write the time like 19:15."}),(0,T.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,T.jsx)(f.T,{size:18,center:!0,children:"Covers"}),(0,T.jsx)(i.PartySizeInput,{value:F.partySize,onChange:e=>K({partySize:e}),label:"Covers",testID:"edit-covers"})]}),(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:"Table time"}),(0,T.jsx)(f.Stepper,{testID:"edit-duration",value:F.duration||0,min:0,max:360,step:15,onChange:e=>K({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,T.jsxs)(E,{title:"Where",testID:"edit-section-where",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"Any area",selected:!F.area,testID:"edit-area-any",onPress:()=>K({area:''})}),R.areas.map(e=>(0,T.jsx)(f.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:F.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>K({area:e.name})},e.id))]}),(0,T.jsx)(f.T,{size:18,weight:"semibold",center:!0,children:(0,x.tableButtonLabel)(F.table)}),(0,T.jsxs)(f.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Button,{kind:F.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(F.table?'':', chosen'),onPress:()=>K({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),se.map(e=>(0,T.jsx)(f.Button,{kind:e===F.table?'primary':'secondary',label:(0,x.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,x.tableButtonLabel)(e)}${e===F.table?', chosen':''}`,onPress:()=>K({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,T.jsxs)(E,{title:"Guest",testID:"edit-section-guest",children:[(0,T.jsx)(f.Field,{label:"Name",value:F.name,onChangeText:e=>K({name:e}),testID:"edit-name"}),m?(0,T.jsx)(f.Muted,{center:!0,children:"Phone and email can be changed in the Managers app. Use Show number on the booking to see the number."}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Phone",value:F.phone,onChangeText:e=>K({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,T.jsx)(f.Field,{label:"Email",value:F.email,onChangeText:e=>K({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Booked by"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.SOURCES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>K({source:e.id})},e.id))}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.TAGS.map(e=>{const t=(F.tags??[]).includes(e);return(0,T.jsx)(f.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>K({tags:t?(F.tags??[]).filter(t=>t!==e):[...F.tags??[],e].sort()})},e)})})]}),(0,T.jsxs)(E,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,T.jsx)(z,{label:"Dogs",value:F.dogs??0,max:6,onChange:e=>K({dogs:e}),testID:"edit-dogs"}),(0,T.jsx)(z,{label:"High chairs",value:F.highChairs??0,max:10,onChange:e=>K({highChairs:e}),testID:"edit-high-chairs"}),(0,T.jsx)(z,{label:"Wheelchair users",value:F.wheelchair??0,max:10,onChange:e=>K({wheelchair:e}),testID:"edit-wheelchair"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Occasion"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.OCCASIONS.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:(F.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>K({occasion:e.id})},e.id||'none'))})]}),(0,T.jsxs)(E,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No allergies",selected:!!F.allergyNone&&!de.length,testID:"edit-allergy-none",onPress:()=>K({allergyNone:!0,allergies:[]})}),u.ALLERGENS.map(e=>(0,T.jsx)(f.Chip,{label:e.short,selected:de.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>re(e.id)},e.id))]}),de.map(e=>(0,T.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,T.jsxs)(f.T,{size:15,center:!0,children:[u.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:u.SEVERITIES.map(t=>(0,T.jsx)(f.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>K({allergies:de.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,T.jsx)(f.Field,{label:"Anything else about allergies",value:F.allergyNote,onChangeText:e=>K({allergyNote:e}),testID:"edit-allergy-note"}),ne.includes('allergies')&&de.length?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,T.jsx)(z,{label:"Vegan",value:F.vegan??0,max:F.partySize,onChange:e=>K({vegan:e}),testID:"edit-vegan"}),(0,T.jsx)(z,{label:"Vegetarian",value:F.vegetarian??0,max:F.partySize,onChange:e=>K({vegetarian:e}),testID:"edit-vegetarian"})]}),'cancelled'!==A.status?(0,T.jsxs)(E,{title:"Status",testID:"edit-section-status",children:[(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.EDIT_STATUSES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>K({status:e.id})},e.id))}),(0,T.jsx)(f.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,T.jsx)(E,{title:"Notes",testID:"edit-section-notes",children:(0,T.jsx)(f.Field,{label:"Notes",value:F.notes,onChangeText:e=>K({notes:e}),placeholder:h.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),M?(0,T.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:[M.map(e=>(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,H?(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:H}):null,(0,T.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,T.jsx)(f.Button,{label:M?'Save anyway':'Save changes',testID:"edit-save",disabled:!Z||!ie||F.name.trim().length<1||!ne.length,onPress:()=>{const t=Z?(0,d.blockAt)(L,e,F.date,Q):void 0,s=(0,h.editWarnings)(A,ae,B,t,le,R);!s.length||M?oe():_(s)},style:{minHeight:56,flex:1}}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:b,style:{minHeight:56}})]}),ce.length?(0,T.jsx)(E,{title:"Changes",testID:"edit-history",children:ce.slice(0,12).map((e,t)=>(0,T.jsx)(f.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,T.jsx)(I.CancelBookingButton,{rid:e,b:A,name:A.name,big:!0,onDone:()=>b()}),(0,T.jsx)(I.ReinstateBookingButton,{b:A,name:A.name,today:(0,y.ymd)(new Date),onDone:()=>b()})]})}},1135,[34,1059,1120,102,874,1025,1022,876,872,1130,861,1003,892,1023,1115,821,858,1124,1112,1133,794,25]); +__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:a,inStaffApp:n,shiftManager:l,big:o,testID:r}){const[d,u]=(0,t.useState)(!1),x=(0,p.useSession)(e=>e.meId),j=(0,b.useOwner)(e=>e.staff.find(e=>e.id===x&&e.active));return s.walkIn||!(0,h.canEditBooking)({variant:c.APP_VARIANT,inStaffApp:n,role:a,shiftManager:l})||x&&!(0,m.canChangeBookings)(j)?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:r??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),d?(0,T.jsx)(B,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:a,hidePrivate:n}){const[o,r]=(0,t.useState)(null),d=(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,T.jsx)(B,{rid:e,id:o,who:i,hidePrivate:n,onClose:a}):(0,T.jsxs)(f.Sheet,{visible:!0,onClose:a,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),d.length?d.map(e=>(0,T.jsx)(f.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${k(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}, ${k(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>r(e.id),style:{minHeight:56}},e.id)):(0,T.jsx)(f.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:a,style:{minHeight:44}})]})},_e.EditBookingSheet=B;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),a=_r(_d[3]),n=(e=a)&&e.__esModule?e:{default:e},l=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),j=_r(_d[15]),y=_r(_d[16]),D=_r(_d[17]),C=_r(_d[18]),I=_r(_d[19]),f=_r(_d[20]),T=_r(_d[21]);const v=/^([01]\d|2[0-3]):[0-5]\d$/,w=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const k=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,y.ymd)(s)?'Tomorrow':$(e)};const S=e=>e?(e/100).toFixed(e%100?2:0):'',P=e=>{const t=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(t)&&t>=0?Math.round(100*t):NaN},$=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',N=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=>e.charAt(0).toUpperCase()+e.slice(1);function z({title:e,children:t,testID:s}){return(0,T.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,T.jsx)(f.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const A=({label:e,value:t,onChange:s,max:i=20,testID:a})=>(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:e}),(0,T.jsx)(f.Stepper,{testID:a,value:t,min:0,max:i,onChange:s,label:e})]});function B({rid:e,id:a,who:p,onClose:b,hidePrivate:m='display'===c.APP_VARIANT}){const k=(0,l.useBookings)(e),B=k.find(e=>e.id===a),O=(0,d.useRestaurant)(e),R=(0,o.usePlan)(e),L=(0,r.useBlocks)(e=>e.blocks),[F,W]=(0,t.useState)(B?(0,h.draftOf)(B):null),[M,_]=(0,t.useState)(null),[H,V]=(0,t.useState)(null),[Y,G]=(0,t.useState)(S(B?(0,h.draftOf)(B).depositDue:0)),[U,X]=(0,t.useState)(S(B?(0,h.draftOf)(B).depositAmount:0)),[q,J]=(0,t.useState)($(B?(0,h.draftOf)(B).depositDate:''));if(!B||!F||!O)return null;const K=e=>{_(null),V(null),W({...F,...e})},Q=w(F.time),Z=v.test(Q),ee=F.area?R.areas.filter(e=>e.name===F.area).map(e=>e.id):null,te=e=>!ee||e.split('+').every(e=>ee.includes(R.tables.find(t=>t.name===e)?.areaId??'')),se=(0,x.tableOptions)(R,k.filter(e=>e.date===F.date),F.table).filter(e=>te(e)||e===F.table),ie=!(F.depositOn&&(Number.isNaN(P(Y||'0'))||F.depositPaid&&(Number.isNaN(P(U||'0'))||q.trim()&&!N(q)))),ae={...F,time:Q,depositDue:P(Y||'0')||0,depositAmount:P(U||'0')||0,depositDate:N(q)},ne=(0,h.changedFields)(B,ae),le=O.settings.turnMins??90,oe=async()=>{const t=(0,h.editPatch)(B,ae,{by:p||'Team member',app:c.APP_VARIANT});if(Object.keys(t).length&&await l.repo.bookings.update(B.id,t),'seated'===B.status&&'table'in t&&t.table!==B.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(B.table),a=s(t.table),n=o.useFloor.getState(),l=i.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!a.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),a.forEach(t=>n.setLive(e,t,{stage:l,dirty:!1}))}V(`Saved. Changed: ${(0,h.editedWords)(ne)}.`),_(null),b()},re=F.allergies??[],de=e=>K({allergyNone:!1,allergies:re.some(t=>t.allergen===e)?re.filter(t=>t.allergen!==e):[...re,{allergen:e,severity:'allergy'}]}),ce=(0,h.historyLines)(B);return(0,T.jsxs)(f.Sheet,{visible:!0,onClose:b,title:`Edit booking \xb7 ${B.name} \xb7 ${B.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,T.jsx)(n.default,{style:{alignItems:'center'},children:(0,T.jsx)(C.DepositChip,{b:B,money:!0,big:!0,testID:"edit-deposit"})}),(0,h.isWixBooking)(B)?(0,T.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:h.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:h.WIX_EDIT_NOTE})}):null,(0,T.jsx)(f.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,T.jsxs)(z,{title:"Deposit",testID:"edit-section-deposit",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No deposit",selected:!F.depositOn,testID:"edit-deposit-none",onPress:()=>K({depositOn:!1,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit due",selected:!!F.depositOn&&!F.depositPaid,testID:"edit-deposit-due",onPress:()=>K({depositOn:!0,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit paid",selected:!!F.depositOn&&!!F.depositPaid,testID:"edit-deposit-paid",onPress:()=>{U||X(Y),q||J($((0,y.ymd)(new Date))),K({depositOn:!0,depositPaid:!0})}})]}),F.depositOn?(0,T.jsx)(f.Field,{label:"Deposit due (\xa3)",value:Y,onChangeText:e=>{G(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,F.depositOn&&F.depositPaid?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Amount paid (\xa3)",value:U,onChangeText:e=>{X(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"How was it paid?"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.DEPOSIT_METHODS.map(e=>(0,T.jsx)(f.Chip,{label:E(e),selected:F.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>K({depositMethod:e})},e))}),(0,T.jsx)(f.Field,{label:"Date paid (DD/MM/YYYY)",value:q,onChangeText:e=>{J((0,s.slashDate)(e,q)),K({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),q.trim()&&!N(q)?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,ie?null:(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,T.jsx)(f.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,T.jsxs)(z,{title:"When",testID:"edit-section-when",children:[(0,T.jsx)(D.BookingDatePicker,{r:O,today:new Date,value:F.date,onChange:e=>K({date:e})}),(0,T.jsx)(f.Field,{label:"Time (24-hour, for example 19:15)",value:F.time,onChangeText:e=>K({time:e}),testID:"edit-time"}),Z?null:(0,T.jsx)(f.T,{size:15,colour:j.colours.amber,children:"Write the time like 19:15."}),(0,T.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,T.jsx)(f.T,{size:18,center:!0,children:"Covers"}),(0,T.jsx)(i.PartySizeInput,{value:F.partySize,onChange:e=>K({partySize:e}),label:"Covers",testID:"edit-covers"})]}),(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:"Table time"}),(0,T.jsx)(f.Stepper,{testID:"edit-duration",value:F.duration||0,min:0,max:360,step:15,onChange:e=>K({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,T.jsxs)(z,{title:"Where",testID:"edit-section-where",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"Any area",selected:!F.area,testID:"edit-area-any",onPress:()=>K({area:''})}),R.areas.map(e=>(0,T.jsx)(f.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:F.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>K({area:e.name})},e.id))]}),(0,T.jsx)(f.T,{size:18,weight:"semibold",center:!0,children:(0,x.tableButtonLabel)(F.table)}),(0,T.jsxs)(f.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Button,{kind:F.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(F.table?'':', chosen'),onPress:()=>K({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),se.map(e=>(0,T.jsx)(f.Button,{kind:e===F.table?'primary':'secondary',label:(0,x.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,x.tableButtonLabel)(e)}${e===F.table?', chosen':''}`,onPress:()=>K({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,T.jsxs)(z,{title:"Guest",testID:"edit-section-guest",children:[(0,T.jsx)(f.Field,{label:"Name",value:F.name,onChangeText:e=>K({name:e}),testID:"edit-name"}),m?(0,T.jsx)(f.Muted,{center:!0,children:"Phone and email can be changed in the Managers app. Use Show number on the booking to see the number."}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Phone",value:F.phone,onChangeText:e=>K({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,T.jsx)(f.Field,{label:"Email",value:F.email,onChangeText:e=>K({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Booked by"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.SOURCES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>K({source:e.id})},e.id))}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.TAGS.map(e=>{const t=(F.tags??[]).includes(e);return(0,T.jsx)(f.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>K({tags:t?(F.tags??[]).filter(t=>t!==e):[...F.tags??[],e].sort()})},e)})})]}),(0,T.jsxs)(z,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,T.jsx)(A,{label:"Dogs",value:F.dogs??0,max:6,onChange:e=>K({dogs:e}),testID:"edit-dogs"}),(0,T.jsx)(A,{label:"High chairs",value:F.highChairs??0,max:10,onChange:e=>K({highChairs:e}),testID:"edit-high-chairs"}),(0,T.jsx)(A,{label:"Wheelchair users",value:F.wheelchair??0,max:10,onChange:e=>K({wheelchair:e}),testID:"edit-wheelchair"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Occasion"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.OCCASIONS.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:(F.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>K({occasion:e.id})},e.id||'none'))})]}),(0,T.jsxs)(z,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No allergies",selected:!!F.allergyNone&&!re.length,testID:"edit-allergy-none",onPress:()=>K({allergyNone:!0,allergies:[]})}),u.ALLERGENS.map(e=>(0,T.jsx)(f.Chip,{label:e.short,selected:re.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>de(e.id)},e.id))]}),re.map(e=>(0,T.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,T.jsxs)(f.T,{size:15,center:!0,children:[u.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:u.SEVERITIES.map(t=>(0,T.jsx)(f.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>K({allergies:re.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,T.jsx)(f.Field,{label:"Anything else about allergies",value:F.allergyNote,onChangeText:e=>K({allergyNote:e}),testID:"edit-allergy-note"}),ne.includes('allergies')&&re.length?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,T.jsx)(A,{label:"Vegan",value:F.vegan??0,max:F.partySize,onChange:e=>K({vegan:e}),testID:"edit-vegan"}),(0,T.jsx)(A,{label:"Vegetarian",value:F.vegetarian??0,max:F.partySize,onChange:e=>K({vegetarian:e}),testID:"edit-vegetarian"})]}),'cancelled'!==B.status?(0,T.jsxs)(z,{title:"Status",testID:"edit-section-status",children:[(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.EDIT_STATUSES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>K({status:e.id})},e.id))}),(0,T.jsx)(f.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,T.jsx)(z,{title:"Notes",testID:"edit-section-notes",children:(0,T.jsx)(f.Field,{label:"Notes",value:F.notes,onChangeText:e=>K({notes:e}),placeholder:h.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),M?(0,T.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:[M.map(e=>(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,H?(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:H}):null,(0,T.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,T.jsx)(f.Button,{label:M?'Save anyway':'Save changes',testID:"edit-save",disabled:!Z||!ie||F.name.trim().length<1||!ne.length,onPress:()=>{const t=Z?(0,r.blockAt)(L,e,F.date,Q):void 0,s=(0,h.editWarnings)(B,ae,k,t,le,R);!s.length||M?oe():_(s)},style:{minHeight:56,flex:1}}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:b,style:{minHeight:56}})]}),ce.length?(0,T.jsx)(z,{title:"Changes",testID:"edit-history",children:ce.slice(0,12).map((e,t)=>(0,T.jsx)(f.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,T.jsx)(I.CancelBookingButton,{rid:e,b:B,name:B.name,big:!0,onDone:()=>b()}),(0,T.jsx)(I.ReinstateBookingButton,{b:B,name:B.name,today:(0,y.ymd)(new Date),onDone:()=>b()})]})}},1135,[34,1059,1120,102,874,1025,1022,876,872,1130,861,1003,892,1023,1115,821,858,1124,1112,1133,794,25]); __d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceSlot",{enumerable:!0,get:function(){return w}}),_e.voiceAppFor=h,_e.useVoiceTarget=p,_e.VoiceSlot=function({size:e=56,layer:t=0}){const u=p(),c=(0,n.useRef)(null),l=(0,n.useRef)(y++).current,{width:f,height:h,fontScale:v}=(0,o.default)(),A=()=>{if(t{if(c.current!==e||!s||tu+.5?w.getState().owner===l&&w.setState({rect:null,owner:0}):w.setState({rect:{x:n,y:o,size:s},owner:l})})},W=(0,n.useRef)(A);return W.current=A,(0,n.useLayoutEffect)(()=>{if(u?.on)return S.set(l,{layer:t,measure:()=>W.current()}),()=>{S.delete(l),w.getState().owner===l&&w.setState({rect:null,owner:0}),requestAnimationFrame(b)}},[u?.on,t]),(0,n.useLayoutEffect)(()=>{A();const e=requestAnimationFrame(A);return()=>cancelAnimationFrame(e)},[f,h,v,u?.on]),(0,n.useEffect)(()=>{const e=c.current;if(!u?.on||'undefined'==typeof ResizeObserver||!e?.parentElement)return;const t=new ResizeObserver(A);return t.observe(e.parentElement),e.parentElement.parentElement&&t.observe(e.parentElement.parentElement),()=>t.disconnect()},[u?.on]),(0,n.useEffect)(()=>()=>{w.getState().owner===l&&w.setState({rect:null,owner:0})},[]),(0,n.useEffect)(()=>{u?.on||w.getState().owner!==l||w.setState({rect:null,owner:0})},[u?.on]),u?.on?(0,m.jsx)(s.default,{ref:c,testID:"voice-slot",onLayout:A,style:{width:e,height:e,flexShrink:0}}):null};var t=r(d[0]),n=r(d[1]),o=e(r(d[2])),s=e(r(d[3])),u=r(d[4]),c=r(d[5]),l=r(d[6]),f=r(d[7]),m=r(d[8]);const w=(0,u.create)(()=>({rect:null,owner:0}));function h(e){return'customer'===c.APP_VARIANT||/^\/(customer|table|demo)/.test(e)?null:e.startsWith('/owner')||e.startsWith('/admin')?'owner':e.startsWith('/team')?'staff':e.startsWith('/kitchen')?'chef':e.startsWith('/display')?'display':null}function p(){const e=(0,t.usePathname)()||'/',n=(0,l.useCtx)(6e4),o=(0,f.useVoiceSettings)(e=>e.enabled),s=h(e);if(!s)return null;const u='owner'===s?'owner'===n.role?'owner':'manager'===n.role?'manager':'staff':s;return{app:s,role:u,actions:'staff'===u?'staff':s,on:(0,f.voiceOn)(o,n.rid,u)}}let y=1;const S=new Map,E=()=>{let e=-1;return S.forEach(t=>{t.layer>e&&(e=t.layer)}),e};function b(){const e=E();S.forEach(t=>{t.layer===e&&t.measure()})}},1136,[30,34,426,102,846,872,1084,1137,25]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_ROLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"VOICE_ROLE_LABEL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useVoiceSettings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"voiceOn",{enumerable:!0,get:function(){return f}}),_e.micExplainedFor=function(e){try{if('1'===b()?.getItem(s(e)))return!0}catch{}return u.getState().micExplained},_e.setMicExplainedFor=function(e){try{b()?.setItem(s(e),'1')}catch{}u.getState().setMicExplained(!0)};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},c=r(d[1]),l=r(d[2]);const o=['owner','manager','staff','chef','display'],p={owner:'Owner (Managers app)',manager:'Managers (Managers app)',staff:'Staff app (full voice assistant, no money or HR)',chef:'Head Chef app',display:'Main Display'},u=(0,c.create)()((0,l.persist)(e=>({enabled:{},micExplained:!1,setEnabled:(n,t,c)=>e(e=>({enabled:{...e.enabled,[n]:{...e.enabled[n]??{},[t]:c}}})),setMicExplained:n=>e({micExplained:n})}),{name:'covercharge-voice-v1',version:4,storage:(0,l.createJSONStorage)(()=>t.default),migrate:(e,n)=>({enabled:n<2?{}:e?.enabled??{},micExplained:!!e?.micExplained}),merge:(e,n)=>({...n,enabled:e?.enabled??n.enabled,micExplained:e?.micExplained??n.micExplained}),partialize:e=>({enabled:e.enabled,micExplained:e.micExplained})})),f=(e,n,t)=>!1!==e[n]?.[t],s=e=>`cc-voice-mic-explained-${e}`,b=()=>{try{return'undefined'!=typeof window?window.localStorage:void 0}catch{return}}},1137,[839,846,849]); __d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VAT",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return n}}),e.dishCost=i,Object.defineProperty(e,"gpPct",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"priceForTarget",{enumerable:!0,get:function(){return c}}),e.costings=function(r,c,s,u){const d=(0,t.dishStats)(r);return c.map(t=>{const c=r.find(r=>r.id===t.dishId);if(!c||null==c.price)return null;const p=i(t,s),l=n(c.price),f=o(p,c.price),b=d.find(t=>t.item.id===c.id)?.sold??0;return{item:c,recipe:t,cost:p,priceInc:c.price,priceEx:l,gp:f,cashGp:l-p,below:ft.prevCost&&t.prevCost!==t.cost).map(s=>{const u=(s.cost-(s.prevCost??s.cost))/(s.prevCost??1)*100,d=r.filter(t=>t.lines.some(t=>t.ing===s.id)).map(r=>{const u=t.find(t=>t.id===r.dishId);if(!u||null==u.price)return null;const d=o(i(r,n,{ing:s.id,cost:s.prevCost}),u.price),p=o(i(r,n),u.price);return{item:u,before:d,after:p,dropped:d>=c&&pt.dropped),below:d.filter(t=>t.below)}})},e.weekGp=function(t,r,n){const i=t.reduce((t,r)=>t+r.priceEx*r.soldWeek,0),o=t.reduce((t,r)=>t+r.cost*r.soldWeek,0),c=o+r+Math.max(0,n);return{sales:i,theoCost:o,actualCost:c,theo:i?(i-o)/i*100:0,actual:i?(i-c)/i*100:0}},Object.defineProperty(e,"fmtQty",{enumerable:!0,get:function(){return s}});var t=_r(_d[0]);const r=.2,n=t=>Math.round(t/1.2);function i(t,r,n){return Math.round(t.lines.reduce((t,i)=>{const o=r.find(t=>t.id===i.ing);return t+(n&&n.ing===i.ing?n.cost:o?.cost??0)*i.qty},0))}const o=(t,r)=>{const i=n(r);return i>0?(i-t)/i*100:0},c=(t,r)=>50*Math.ceil(t/(1-r/100)*1.2/50);const s=(t,r)=>`${Number.isInteger(t)?t:t.toFixed(t<1?3:2).replace(/0+$/,'').replace(/\.$/,'')} ${'each'===r?'':r}`.trim()},1138,[1139]); @@ -1395,7 +1395,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}},1312,[827,860,34,102,794,861,867,1154,1313,874,821,25]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1313,[934,988,1154]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1314,[30,34,872,1315,1379,25]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ge}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:b,headerExtra:K,subHeader:He,noVoice:Pe=!1}={}){const Ue=(0,N.default)(),Je=b??Ue.width,Xe=Ue.height,Ze=Je<700,et=Je>=Xe,tt=!Ze&&et&&Je>=600,lt=tt,st=Math.round(Math.min(520,Math.max(Je>=1e3?448:280,.3*Je))),it=$.default.useRef(null),ot=$.default.useRef(0),[nt,at]=(0,T.useState)({w:0,h:0}),rt=(0,X.useOwner)(e=>e.site),dt=(0,Y.useRestaurant)(rt);(0,Ie.useAlertWatcher)(rt,{enabled:!e});const ct=(0,Y.useOrders)(rt),ut=(0,Y.useBookings)(rt),ht=(0,Y.useEvents)(rt),gt=(0,Y.useStore)(e=>e.skipMinutes),bt=(0,Y.useStore)(e=>e.clock.mode),yt=(0,Y.useNow)(5e3),pt=(0,X.useOwner)(e=>e.staff),ft=(0,X.useOwner)(e=>e.attendance),xt=(0,X.useOwner)(e=>e.shifts);$.default.useEffect(()=>{(0,ee.ensureAttendance)((0,q.ymd)(yt),yt)},[(0,q.ymd)(yt)]);const mt=ft.filter(e=>e.in&&!e.out&&yt.getTime()-new Date(e.in).getTime()<72e6&&yt.getTime()>=new Date(e.in).getTime()),jt=Ve(pt.find(e=>e.id===mt[0]?.staffId)?.name)||'Duty Manager',wt=k.IS_CAR?'Car':'Display';(0,v.useSoldOutLink)(!1,e?void 0:wt,!0);const kt=(0,q.ymd)(yt),It=(0,R.useTravelDay)('display',kt),Dt=(0,Z.useFrontDoor)(kt,et),vt=(0,te.useDisplaySettings)(rt),St=vt.privacy,Ct=(0,ce.useSaverSync)(),Tt=(0,te.usePlan)(rt),$t=(0,te.useFloor)(e=>e.live[rt]),Bt=(0,De.useBlocks)(e=>e.blocks),[Rt,Lt]=(0,T.useState)('plan'),[Wt,zt]=(0,T.useState)(!1),[Mt,Ht]=(0,T.useState)('all'),[Pt,Et]=(0,T.useState)(null),[Ot,At]=(0,T.useState)(null),[Nt,_t]=(0,T.useState)(null),[Gt,Vt]=(0,T.useState)(!1),[Ft,Ut]=(0,T.useState)(!1),[Kt,qt]=(0,T.useState)(null),[Yt,Qt]=(0,T.useState)(!1),[Jt,Xt]=(0,T.useState)(!1),[Zt,el]=(0,T.useState)(null),[tl,ll]=(0,T.useState)(null),[sl,il]=(0,T.useState)(null),ol=$.default.useRef(0),nl=e=>{ol.current=Date.now(),il(e)};$.default.useEffect(()=>{if(!sl)return;const e=setInterval(()=>{Date.now()-ol.current>=Te.DAY_IDLE_MS&&il(null)},5e3);return()=>clearInterval(e)},[sl]);const al=(0,Y.useWaitlist)(rt),rl=(0,Y.useStore)(e=>e.walkIns[rt]??0),[dl,cl]=(0,T.useState)(!1),[ul,hl]=(0,T.useState)(!1),[gl,bl]=(0,T.useState)(!1);(0,F.useReviewAlerts)(rt);const[yl,pl]=(0,T.useState)({view:0,content:0}),[fl,xl]=(0,T.useState)(null);$.default.useEffect(()=>{fl&&((0,S.notify)({id:`floor-note:${Date.now()}`,title:fl,timeoutMs:4500,big:!0,testID:'floor-toast'}),xl(null))},[fl]),$.default.useEffect(()=>{if(!e)return(0,L.setDisplaySilent)(!0),()=>(0,L.setDisplaySilent)(!1)},[e]);const[ml,jl]=(0,T.useState)(null),wl=$.default.useRef(0),[kl,Il]=(0,T.useState)(null);$.default.useEffect(()=>{if(!ml)return;wl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-wl.current;if(e>=Ge)return jl(null),void xl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Il(e>=105e3?Math.ceil((Ge-e)/1e3):null)},1e3);return()=>clearInterval(e)},[ml]);const Dl=e=>e.date!==kt?_t({title:`Guest details \xb7 ${(0,Te.dayWord)(e.date,kt)} ${e.time}`,body:(0,Ae.jsx)(Ae.Fragment,{children:(0,me.bookingDetails)(e)})}):_t({title:`Guest details \xb7 ${e.time}`,body:(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(Qe,{rid:rt,id:e.id,turnBase:dt.settings.turnMins}),e.walkIn?null:(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ae.jsx)(ye.CancelWalkInButton,{rid:rt,b:e,big:!0,onDone:e=>{_t(null),xl(e)}}):null,e.walkIn?(0,Ae.jsx)(ye.ReinstateWalkInButton,{rid:rt,b:e,today:kt,onDone:e=>{_t(null),xl(e)}}):null,(0,me.bookingDetails)(e)]})}),vl=ut.filter(e=>e.date===kt).sort((e,t)=>e.time.localeCompare(t.time)),Sl=vl.filter(e=>!['cancelled','noshow'].includes(e.status)),Cl=ct.filter(Fe).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Tl=(0,T.useMemo)(()=>(0,c.forecastToday)(dt,ut,ct,ht,yt),[dt,ut,ct,ht,yt.getTime()/6e4|0]),$l=(0,De.closedAreasAt)(Bt,rt,kt,(0,q.hm)(yt)),Bl=[...$l].join(','),Rl=(0,T.useMemo)(()=>(0,le.floorView)(Tt,ut,ct,$t??{},yt,dt.settings.turnMins,$l),[Tt,ut,ct,$t,yt.getTime(),Bl]),Ll=(0,xe.hoursFor)(dt,yt),Wl=Ll?.open??new Date(`${kt}T12:00:00`),zl=Ll?.close??new Date(`${kt}T21:00:00`),Ml=(0,q.addMins)(Wl,-Wl.getMinutes()),Hl=(0,q.addMins)(zl,30),Pl=e=>new Date(`${kt}T${e}:00`),El=(0,De.blocksOn)(Bt,rt,kt).map(e=>({from:Pl(e.from),to:Pl(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(dt,yt,kt)),Ol=Object.keys(Rl).filter(e=>'blocked'===Rl[e]?.status),Al=sl&&sl!==kt?sl:kt,Nl=Al!==kt,_l=(0,Te.dayWord)(Al,kt),Gl=/^(Today|Yesterday|Tomorrow)$/.test(_l),Vl=Nl?(0,Te.bookingsForDay)(ut,Al,kt).sort((e,t)=>e.time.localeCompare(t.time)):vl,Fl=(0,q.parseYmd)(Al);Fl.setHours(12);const Ul=Nl?(0,xe.hoursFor)(dt,Fl):Ll,Kl=Ul?.open??new Date(`${Al}T12:00:00`),ql=Ul?.close??new Date(`${Al}T21:00:00`),Yl=e=>new Date(`${Al}T${e}:00`),Ql=[...Nl?(0,De.blocksOn)(Bt,rt,Al).map(e=>({from:Yl(e.from),to:Yl(e.to),label:e.reason??'Paused'})):El,...Nl?(0,o.queuedServicePauses)(dt,Fl,Al):[]],Jl=(0,o.queuedServiceSessions)(dt,Fl),Xl=s.IS_QUEUED_VENUE&&(void 0===Jl||!Jl.length),Zl=(0,Ae.jsxs)(A.default,{testID:"queued-hours-gate",style:[We.look.panel,{padding:14,gap:8}],children:[(0,Ae.jsx)(G.T,{weight:"semibold",children:void 0===Jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ae.jsx)(G.Muted,{children:i.queuedVenues[rt]?.hours.note})]}),es=Nl?Ul||Vl.length?AlNl?(0,le.dayFloorView)(Tt,Vl,Al):Rl,[Nl,Tt,Vl,Al,Rl]),[ls,ss]=(0,T.useState)(null),is=Nl?Vl.filter(e=>!['cancelled','noshow'].includes(e.status)):Sl,os=is.reduce((e,t)=>e+t.partySize,0),ns=(0,u.coversSplit)(is,Al),as=(0,$e.cancelledDayTally)(ut,Al),rs=(0,Be.cancellationsFor)(ut,Al,e=>e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)','')),ds=(0,$e.cancelledTallyWords)(as,Gl?_l.toLowerCase():Nl?`on ${_l}`:'today'),cs=Bt.filter(e=>e.rid===rt&&e.date===Al&&!e.removedAt),us=(0,Ce.chartBands)(cs,60*Kl.getHours()+Kl.getMinutes(),60*ql.getHours()+ql.getMinutes()),hs=new Set((0,Ce.blockedHours)(us)),gs=yt.getHours()+(yt.getMinutes()>=30?1:0),bs=Tl.hours.filter(e=>e.hour>=gs&&!hs.has(e.hour)),ys=bs.reduce((e,t)=>e+t.coversHigh,0),ps=bs.reduce((e,t)=>e+t.coversLow,0),fs=Math.round((ps+ys)/2),xs=!Tl.example&&Tl.open&&Tl.enough&&ys>0?`Usually ${(0,c.coversRange)(fs,fs)} more`:void 0,ms=async(e,t)=>{const l=Rl[e]?.booking;if(!l||e===t)return;const s=Rl[t]?.status;if(s&&!['free','soon'].includes(s))return void xl('dirty'===s?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${le.STATUS[s].label.toLowerCase()}. Pick a free table.`);await Y.repo.bookings.update(l.id,{table:t});const i=$t?.[e]?.stage;te.useFloor.getState().setLive(rt,t,{stage:i??'seated',dirty:!1}),te.useFloor.getState().setLive(rt,e,{stage:void 0,dirty:!0}),xl(`${(0,ue.privName)(l,St)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`)},js=tl?ut.find(e=>e.id===tl.id):void 0,ws=tl&&js?(()=>{const e=js.walkIn?(0,ue.privName)(js,St):Ve(js.name),t=(0,fe.seatsOf)(Tt,tl.tables).total,l=(0,fe.seatLine)(t,js.partySize),s=(0,fe.pickClashes)(js,tl.tables,ut.filter(e=>e.date===js.date),dt.settings.turnMins),i=(0,fe.tableKey)(tl.tables)!==(0,fe.tableKey)((0,te.tablesOf)(js.table));return(0,Ae.jsxs)(A.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:Q.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:Q.colours.gold,padding:10},children:[(0,Ae.jsxs)(A.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Te.dayWord)(js.date,kt)} ${js.time}. Tap tables on the plan to add or take them off. ${(0,fe.tablesWords)(tl.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,Ae.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Te.dayWord)(js.date,kt)," ",js.time]}),(0,Ae.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[(0,fe.tablesWords)(tl.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,Ae.jsxs)(G.Row,{gap:8,wrap:!0,children:[(0,Ae.jsx)(G.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,fe.tablesWords)(tl.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(js){try{await(0,pe.saveBookingTables)(rt,js,tl.tables),xl((0,fe.savedWords)(e,js.partySize,tl.tables,t))}catch(t){xl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}ll(null)}else ll(null)}}),(0,Ae.jsx)(G.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>ll(null)})]})]})})():null,ks=Tt.areas.filter(e=>Tt.tables.some(t=>t.areaId===e.id)),Is=e=>{const t=Tt.tables.filter(t=>t.areaId===e);return Nl?`${t.filter(e=>!ts[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Rl[e.name]?.status??'free')).length}/${t.length} free`},Ds='all'===Mt||ks.some(e=>e.id===Mt)?Mt:'all',vs=e=>(0,Ae.jsx)(se.FloorCanvas,{plan:Tt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:tt,big:!0,view:ts,privacy:St,turnBase:dt.settings.turnMins,highlight:tl?tl.tables:Ot?[Ot]:void 0,onTap:e=>{return t=e.name,void(tl?ll(e=>e?{...e,tables:(0,fe.toggleTable)(e.tables,t)}:e):Nl?ss(t):Ot?(t!==Ot&&ms(Ot,t),At(null)):Et(t));var t},onDrop:(e,t)=>tl||Nl?void 0:ms(e.name,t.name)}),Ss=Ze?1:et||ks.length>2?2:1,Cs=e=>{const t=Tt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},Ts=[];for(let e=0;e{const t=(0,se.areaBounds)(Tt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,se.minReadableScale)(Tt,e.id)}}),nt.w,nt.h):null,Bs=e=>(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between',height:ie.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,children:Is(e.id)})]}),Rs=(0,Ae.jsx)(A.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-nt.w)>1||Math.abs(l-nt.h)>1)&&at({w:t,h:l})},children:$s?(0,Ae.jsx)(O.default,{style:{flex:1},scrollEnabled:$s.scroll,showsVerticalScrollIndicator:$s.scroll,contentContainerStyle:{gap:ie.GRID_GAP},children:$s.rows.map((e,t)=>(0,Ae.jsx)(A.default,{style:{height:$s.rowHeights[t],flexDirection:'row',gap:ie.GRID_GAP},children:e.map(e=>{const t=ks.find(t=>t.id===e);return(0,Ae.jsxs)(A.default,{testID:`area-cell-${e}`,style:{width:$s.cellW,gap:2},children:[Bs(t),(0,Ae.jsx)(A.default,{style:{flex:1},children:vs(e)})]},e)})},t))}):null}),Ls=(0,Ae.jsxs)(A.default,{testID:"venue-plan",style:{flex:Ze?void 0:1,gap:10,minWidth:0},children:[(0,Ae.jsx)(r.TableNumberWarning,{plan:Tt}),Tt.tables.length?null:(0,Ae.jsxs)(A.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ae.jsx)(G.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ae.jsx)(G.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS?(0,Ae.jsx)(G.Muted,{center:!0,testID:"display-venue-hours",children:(s.IS_WILDINGS?a.WILDINGS_GUIDE:s.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ae.jsx)(qe,{chipId:"all",compact:!Ze,label:"Whole venue",selected:'all'===Ds,onPress:()=>Ht('all')},"__all"),...ks.map(e=>(0,Ae.jsx)(qe,{chipId:e.id,compact:!Ze,label:`${e.name}${(0,oe.areaMarks)(e)}`,colour:(0,Q.brandColour)(e.colour),sub:Ze?$l.has(e.id)?'closed':Ds===e.id?Is(e.id):void 0:void 0,selected:Ds===e.id,onPress:()=>Ht(e.id)},e.id))];return Ze?(0,Ae.jsx)(A.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ae.jsx)(O.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;pl(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>pl(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:yl.view>0&&yl.content>0&&yl.content<=yl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:yl.view>0&&yl.content<=yl.view+1?'100%':void 0},children:e})})(),(0,Ae.jsx)(g.FloorLegend,{}),ws,Ot?(0,Ae.jsxs)(G.Row,{gap:8,style:{backgroundColor:Q.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ae.jsxs)(G.T,{weight:"semibold",colour:Q.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Ot),": tap the new table."]}),(0,Ae.jsx)(G.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>At(null)})]}):null,'all'===Ds&&tt?Rs:'all'===Ds?(0,Ae.jsx)(A.default,{style:{flex:Ze?void 0:1,gap:12,minHeight:lt?void 0:360},children:Ts.map((e,t)=>(0,Ae.jsxs)(A.default,{style:{flex:Ze?void 0:Math.max(.3,...e.map(e=>Cs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ae.jsxs)(A.default,{style:{flex:1,gap:2},children:[Ze?(0,Ae.jsxs)(A.default,{style:{alignItems:'center',gap:4},children:[(0,Ae.jsxs)(G.T,{center:!0,size:18,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{center:!0,size:14,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.Muted,{center:!0,children:Is(e.id)})]}):(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.Muted,{children:Is(e.id)})]}),(0,Ae.jsx)(A.default,{style:Ze?{height:Math.max(280,Math.round((Je-40)*Cs(e.id)))}:{flex:1},children:vs(e.id)})]},e.id)),e.length{if(Nl)return void el(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rl[t]?Et(t):Dl(e)}},Al)}),zs='timeline'===Rt,Ms=Wt?(0,Ae.jsx)(H.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>zt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ae.jsxs)(A.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:Q.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ae.jsx)(E.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>zt(!1),style:{minHeight:64,minWidth:Je<600?120:180,paddingHorizontal:Je<600?14:22,borderRadius:16,borderWidth:2,borderColor:Q.colours.goldLight,backgroundColor:Q.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(G.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ae.jsx)(A.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ae.jsx)(G.T,{size:22,weight:"semibold",colour:Q.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${Nl?(0,Te.dayLong)(Al):'Today'}`})}),Je<600?null:(0,Ae.jsx)(A.default,{style:{minWidth:180}})]}),Xl?Zl:(0,Ae.jsx)(A.default,{style:{flex:1,minHeight:0},children:(0,Ae.jsx)(re.Timeline,{hideNow:!0,fit:!0,plan:Tt,bookings:Nl?Vl:vl,now:Nl?Kl:yt,privacy:St,turnBase:dt.settings.turnMins,t0:Nl?(0,q.addMins)(Kl,-Kl.getMinutes()):Ml,t1:Nl?(0,q.addMins)(ql,30):Hl,pauses:Nl?Ql:El,blockedTables:Nl?[]:Ol,onOpen:e=>{if(zt(!1),Nl)return void el(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rl[t]?Et(t):Dl(e)}},`full-${Al}`)})]})}):null,Hs=Nl?(0,Ae.jsxs)(A.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:Q.colours.gold,backgroundColor:Q.colours.goldTint},children:[(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:Gl?`Showing ${_l} \xb7 ${(0,q.niceDate)((0,q.parseYmd)(Al))}`:`Showing ${(0,Te.dayWord)(Al,kt)}`}),(0,Ae.jsx)(A.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${ds}. Showing ${(0,Te.dayLong)(Al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ae.jsx)(G.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ll(null),nl(null)},style:{minHeight:44}})]}):null,Ps=(0,Ae.jsx)(A.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:Ze?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,l])=>{const i='timeline'===e===(zs||Wt);return(0,Ae.jsx)(E.default,{testID:l,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Lt('plan'),zt(!0)):(zt(!1),Lt('plan'))},style:{flex:Ze?1:void 0,minHeight:Ze?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?Q.colours.gold:'transparent',...We.look.web(i?{backgroundImage:s.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:s.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Ae.jsx)(G.T,{size:Ze?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Es='display'!==k.APP_VARIANT||e?Ps:(0,Ae.jsxs)(A.default,{testID:"display-view-row",style:{flexDirection:Ze?'column':'row',flexWrap:Ze?'nowrap':'wrap',gap:6,alignItems:Ze?'stretch':'center'},children:[Ps,(0,Ae.jsx)(w.DisplayRotaKitchenButtons,{phone:Ze,shifts:xt,staff:pt,today:kt})]}),Os=(0,h.useBookingWrite)(),As=e=>(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"Walk-in",onPress:Dt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint}),(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"New booking",onPress:Dt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint}),(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Ut(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint})]});(0,Oe.useDisplayNotices)(rt,!e);const Ns=Ze?180:168,[_s,Gs]=(0,T.useState)(Ns),Vs=$.default.useRef(Ns),Fs=$.default.useRef(null),Us=$.default.useRef(null),Ks=()=>{const e=Fs.current,t=Us.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Xe<820?8:12,o=44+(Xe<820?4:8),n=i>Vs.current?Math.ceil(i-Vs.current):Se.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Ns,Math.floor(t-s-l)-n-o));Math.abs(Vs.current-a)>=2&&(Vs.current=a,Gs(a))})})};$.default.useEffect(()=>{const e=setTimeout(Ks,60);return()=>clearTimeout(e)},[Je,Xe]);const qs=(0,Ae.jsxs)(A.default,{ref:Us,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ks()},style:{flexDirection:'row',flexWrap:Je>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ze?12:6,justifyContent:Ze?'center':void 0,borderTopWidth:1,borderTopColor:Q.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ae.jsx)(Ee.DisplayClockButton,{}),(0,Ae.jsx)(ae.HoldToEdit,{quiet:!0,onUnlock:()=>{Il(null),jl({at:Date.now()})},onHint:()=>xl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ae.jsx)(ve.BlockBookingsButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,display:!0,day:Al}),Tt.areas.some(e=>e.outdoor)?(0,Ae.jsx)(ve.CloseGardenButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,short:!0}):null,(0,Ae.jsx)(E.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>bl(!0),style:({pressed:e})=>({...We.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR?null:(0,Ae.jsx)(f.GiftQrButton,{rid:rt,venue:dt.name})]}),Ys=Cl.length?(0,Ae.jsxs)(A.default,{testID:"takeaway-panel",style:[We.look.panel,{overflow:'hidden'}],children:[(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ae.jsx)(G.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ae.jsxs)(G.T,{size:12,colour:Q.colours.muted,children:[Cl.length," live"]})]}),(0,Ae.jsx)(A.default,{style:{padding:10},children:(0,Ae.jsx)(Ye,{list:Cl,me:jt,compact:!0,bookings:ut})})]}):null,Qs=(Le.DueToday,Nl?Vl:vl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Js=Nl?Gl?`${_l}\u2019s guests`:`Guests ${_l}`:'Today\u2019s guests',Xs=(0,Ae.jsxs)(Ae.Fragment,{children:[0===Qs.length?(0,Ae.jsx)(G.Muted,{children:Nl?Al{const t=(0,J.isSeatedHighlight)(e.status,{otherDay:Nl}),l=(0,he.guestRowText)(e,{name:e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)',''),seated:t}),s=Q.colours.text,i=t?Q.colours.goldLight:Q.colours.muted,o=Q.colours.gold,n=l.depositWarn?Q.colours.amber:Q.colours.goldLight;return(0,Ae.jsxs)(E.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Nl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Xt(!1),el(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,J.seatedHighlightStyle)({backgroundColor:e?_e:Ne,borderColor:Q.colours.gold,borderLeftColor:Q.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:Q.colours.hairline,backgroundColor:e?Q.colours.tilePressed:'transparent'},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ae.jsx)(G.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Ae.jsx)(G.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Ae.jsx)(A.default,{style:{paddingTop:2},children:(0,Ae.jsx)(M.AllergyIcon,{text:l.allergy,size:22,colour:Q.colours.amber,ink:Q.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Ae.jsxs)(G.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ae.jsx)(G.T,{size:16,colour:s,children:l.people}),l.deposit?(0,Ae.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,Ae.jsx)(G.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Ae.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}),(0,Ae.jsx)(G.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,Ae.jsx)(G.T,{size:16,children:" "}):null,l.dog?(0,Ae.jsx)(A.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ae.jsx)(ge.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,Ae.jsx)(Re.CancellationsSection,{items:rs,dayWord:Nl?Gl?_l.toLowerCase():`on ${_l}`:'today'})]}),Zs=(0,Ae.jsx)(O.default,{testID:"display-guest-list",accessibilityLabel:Js,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Xs}),ei=P.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Xt(!1)}}),ti=(0,Ae.jsxs)(E.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Js}, ${Qs.length}`,accessibilityState:{expanded:Jt},'aria-expanded':Jt,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Xt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:Jt?Q.colours.gold:Q.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?Q.colours.tilePressed:Jt?Q.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ae.jsx)(G.T,{size:16,weight:"bold",colour:Q.colours.gold,children:Qs.length}),(0,Ae.jsx)(A.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(A.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ae.jsxs)(G.T,{size:13,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,children:[Js," ",Jt?'\u2039':'\u203a']})})})]}),li=Jt?(0,Ae.jsxs)(A.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ae.jsxs)(A.default,{testID:"guests-drawer",...ei.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Je)),backgroundColor:Q.colours.surface,borderRightWidth:1,borderColor:Q.colours.gold,borderRadius:14,...We.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ae.jsxs)(A.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Ae.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Js.toUpperCase()," (",Qs.length,")"]}),(0,Ae.jsx)(l.GoldClose,{testID:"guests-close",label:`Close ${Js}`,onPress:()=>Xt(!1),style:{marginRight:-6}})]}),as.count?(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,testID:"cancelled-day-tally-guests",children:ds}):null]}),Zs]}),(0,Ae.jsx)(E.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Js}`,accessibilityRole:"button",onPress:()=>Xt(!1),style:{flex:1}})]}):null,si=Xl?Zl:s.IS_KIRKTON&&!Object.values(dt.kitchenHours??{}).some(Boolean)?(0,Ae.jsxs)(A.default,{testID:"kirkton-hours-to-confirm",style:[We.look.panel,{padding:14,gap:8}],children:[(0,Ae.jsx)(G.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ae.jsx)(G.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ae.jsx)(Se.DayGraph,{busyThreshold:(0,t.venueBusy)(dt,ut,yt).busy,todays:Vl,open:Kl,close:ql,now:yt,turnBase:dt.settings.turnMins,blocks:cs,pauses:Ql,compact:Ze,dense:!Ze,fit:tt,tight:tt&&Xe<600,height:Ns,forecastNote:Nl?void 0:xs,emptyText:es,past:Al{Nl?Xt(!0):zt(!0)},ai=(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',padding:Xe<820?8:12,paddingTop:Xe<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[It?null:ti,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[It?null:Hs,It?(0,Ae.jsx)(O.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ae.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"})}):zs?Ws:Ls,Ms,li]}),(0,Ae.jsxs)(A.default,{testID:"display-side",style:{width:st,gap:Xe<820?4:8,minHeight:0},children:[(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:As(!1)}),(0,Ae.jsx)(A.default,{style:{flexShrink:0},children:Es}),It?null:(0,Ae.jsx)(A.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,compact:Xe<820,snug:Xe<820,tight:Xe<700,sound:(0,L.flapSoundOn)(),onPress:ni})}),It?null:(0,Ae.jsx)(A.default,{ref:Fs,testID:"day-graph-slot",onLayout:Ks,style:{flexGrow:0,flexShrink:1,flexBasis:Ns+52,minHeight:Xe<600?90:120,overflow:'visible'},children:ii}),(0,Ae.jsxs)(O.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Ae.jsx)(E.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>hl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ae.jsx)(G.T,{center:!0,weight:"semibold",children:"Reviews"})}),Ys,(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt})]})]})]});return(0,Ae.jsxs)(_.SafeAreaView,{style:{flex:1,backgroundColor:Q.colours.bg},onTouchStart:()=>{ol.current=Date.now()},onMouseDown:()=>{ol.current=Date.now()},children:[Ze?(0,Ae.jsxs)(A.default,{style:{flex:1},children:[(0,Ae.jsxs)(O.default,{ref:it,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ae.jsxs)(A.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ae.jsx)(A.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ae.jsx)(j.ExitButton,{})}),(0,Ae.jsx)(U.RestaurantLogo,{rid:rt,size:64}),(0,Ae.jsx)(G.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:dt.name}),(0,Ae.jsx)(U.PoweredBy,{}),(0,Ae.jsx)(C.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ae.jsx)(A.default,{accessible:!0,accessibilityLabel:`Current time ${(0,q.hm)(yt)}`,children:(0,Ae.jsx)(G.T,{center:!0,size:30,weight:"semibold",colour:Q.colours.goldLight,children:(0,q.hm)(yt)})}),(0,Ae.jsx)(Me.ShellfishChip,{rid:rt,by:jt,app:"display",size:"m"}),(0,Ae.jsx)(Me.SundayRoastChip,{rid:rt,by:jt,app:"display",size:"m"}),K]}),He,oi,(0,Ae.jsx)(A.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ae.jsx)(Ke,{phone:!0,split:ns,items:[{label:`Tables \xb7 ${_l}`,value:is.length,testID:'badge-tables'},{label:`Covers \xb7 ${_l}`,value:os,testID:'badge-covers'},{label:'Takeaway',value:Cl.length,alert:Cl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Vt(!0)}]})}),(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{gap:8},children:As(!0)}),(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),Es,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[zs?Ws:Ls,Ms]}),(0,Ae.jsxs)(A.default,{onLayout:e=>{ot.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[We.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ae.jsxs)(G.T,{center:!0,size:20,weight:"semibold",colour:Q.colours.goldLight,accessibilityRole:"header",children:[Js," (",Qs.length,")"]}),(0,Ae.jsx)(A.default,{testID:"display-guest-list",accessibilityLabel:Js,style:{gap:4},children:Xs})]}),Ys,ii,(0,Ae.jsx)(A.default,{testID:"covers-dock",children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,compact:!0,sound:(0,L.flapSoundOn)(),onPress:()=>it.current?.scrollTo({y:ot.current,animated:!0})})}),(0,Ae.jsxs)(A.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ae.jsx)(G.T,{center:!0,size:14,colour:St?Q.colours.muted:Q.colours.amber,children:St?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ae.jsx)(G.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Ae.jsx)(G.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>hl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),qs]}),e?null:(0,Ae.jsx)(A.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:Q.colours.hairline},children:(0,Ae.jsx)(z.VoiceSlot,{size:56})})]}):(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Je>=1e3?18:14,paddingVertical:Xe<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),...We.look.web({backgroundImage:s.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Ae.jsx)(A.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ae.jsx)(U.RestaurantBrand,{rid:dt.id,size:Je<900?32:40,beside:!0})}),(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ae.jsx)(G.T,{size:Je<900?18:21,weight:"semibold",colour:Q.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,q.hm)(yt)}),Je>=900?(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,children:(0,q.niceDate)(yt)}):null]})]}),It?(0,Ae.jsx)(A.default,{style:{width:220}}):(0,Ae.jsx)(A.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:oi}),(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ae.jsx)(Me.ShellfishChip,{rid:rt,by:jt,app:"display",size:Je<1200?'xs':Je<1280||Xe<700?'s':'m'}),(0,Ae.jsx)(E.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.muted,children:"?"})}),'simulated'===bt?(0,Ae.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>gt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(G.T,{size:11,colour:Q.colours.muted,children:"+15"})}):null,e?null:(0,Ae.jsx)(j.ExitButton,{}),K,Pe?null:(0,Ae.jsx)(z.VoiceSlot,{size:44})]})]}),He,It?null:(0,Ae.jsxs)(A.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,Ae.jsx)(Ke,{splitOnly:!0,split:ns,items:[]}),(0,Ae.jsx)(A.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Je>=1e3?18:14)+(e?0:52)+('simulated'===bt?52:0),zIndex:4},children:(0,Ae.jsx)(Me.SundayRoastChip,{rid:rt,by:jt,app:"display",size:Je<1100||Xe<700?'s':'m'})})]}),tt?ai:(ri=(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:As(!1)}),Es]}),(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),It?(0,Ae.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"}):(0,Ae.jsx)(Ae.Fragment,{children:(0,Ae.jsxs)(A.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[ti,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Hs,zs?Ws:Ls,Ms,li]})]})}),Ys,It?null:(0,Ae.jsx)(A.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,sound:(0,L.flapSoundOn)(),onPress:ni})}),It?null:(0,Ae.jsx)(A.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Ns+Se.DAY_GRAPH_CHROME},children:ii})]}),(0,Ae.jsx)(O.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:ri})),qs]}),(0,Ae.jsx)(I.SoldOutStrip,{rid:rt,by:wt,onOpen:()=>bl(!0)}),(0,Ae.jsx)(D.SoldOutSheet,{visible:gl,onClose:()=>bl(!1),rid:rt,by:wt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ae.jsx)(p.TableOrderCue,{rid:rt}),Dt.elements,Ft?(0,Ae.jsx)(y.EditBookingPicker,{rid:rt,today:kt,who:jt,hidePrivate:!0,onClose:()=>Ut(!1)}):null,Kt?(0,Ae.jsx)(y.EditBookingSheet,{rid:rt,id:Kt,who:jt,hidePrivate:!0,onClose:()=>qt(null)}):null,Pt?(0,Ae.jsx)(me.TableSheet,{rid:rt,name:Pt,view:Rl,plan:Tt,todays:vl,now:yt,privacy:St,turnBase:dt.settings.turnMins,onClose:()=>Et(null),onWalkIn:e=>Dt.openWalkInAt(e),onMove:e=>At(e),onDetails:Dl}):null,ls?(()=>{const e=ts[ls],t=e?.dayBookings??[];return(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>ss(null),title:`${(0,d.tableNumbers)(ls)} \xb7 ${Gl?_l:(0,Te.dayLong)(Al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ae.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${Gl?_l.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${Gl?_l.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ue.privName)(e,St):Ve(e.name);return(0,Ae.jsx)(G.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,fe.tablesWords)((0,te.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ss(null),el(e.id)},style:{minHeight:56}},e.id)}),(0,Ae.jsx)(G.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ss(null),style:{minHeight:56}})]})})():null,Zt?(()=>{const e=ut.find(e=>e.id===Zt);return e?(0,Ae.jsx)(be.GuestActionsSheet,{rid:rt,b:e,name:e.walkIn?(0,ue.privName)(e,St):Ve(e.name),view:Rl,now:yt,otherDay:e.date!==kt,turnBase:dt.settings.turnMins,onClose:()=>el(null),onDetails:Dl,onDone:xl,onPickOnPlan:(e,t)=>{Xt(!1),Lt('plan'),Ht('all'),ll({id:e.id,tables:t})}}):null})():null,Nt?(0,Ae.jsx)(me.DetailsPanel,{title:Nt.title,onClose:()=>_t(null),children:Nt.body}):null,Yt?(0,Ae.jsx)(me.ServiceSummary,{r:dt,todays:vl,orders:ct,waitlistAll:al,walkInCount:rl,onClose:()=>Qt(!1)}):null,dl?(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>cl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ae.jsx)(g.FloorLegend,{}),(0,Ae.jsx)(G.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>cl(!1)})]}):null,ul?(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>hl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ae.jsx)(V.ReviewsSection,{rid:rt,mode:"read",venueName:dt.name}),(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>hl(!1)})]}):null,Gt?(0,Ae.jsxs)(me.DetailsPanel,{title:"Takeaway",onClose:()=>Vt(!1),children:[(0,Ae.jsx)(G.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ae.jsx)(Ye,{list:Cl,me:jt,bookings:ut})]}):null,ml?(0,Ae.jsx)(A.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:Q.colours.bg},children:(0,Ae.jsx)(ne.PlanDesigner,{initial:Tt,venue:dt.name,mode:"display",startStep:"arrange",onActivity:()=>{wl.current=Date.now(),null!==kl&&Il(null)},notice:null!==kl?`Locking again in ${kl} s \xb7 touch to keep editing`:null,onSave:e=>{te.useFloor.getState().setPlan(rt,e),jl(null),xl('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{te.useFloor.getState().setPlan(rt,e),xl('Live seating plan updated on every screen.')},onCancel:()=>{jl(null),xl('No changes kept. Editing is locked again.')}},ml.at)}):null,e?null:(0,Ae.jsx)(de.Screensaver,{rid:rt,idleMins:vt.idleMins,pinOn:vt.pinOn,wake:vt,tonightCards:vt.tonightCards,cfg:Ct}),e?null:(0,Ae.jsx)(we.PrintHost,{rid:rt}),e?null:(0,Ae.jsx)(je.AlertHost,{variant:"display",rid:rt,skipTakeaway:!0}),e?null:(0,Ae.jsx)(W.SeatAllergenReminder,{rid:rt}),e?null:(0,Ae.jsx)(ke.TakeawayTakeover,{rid:rt,me:jt})]});var ri};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=e(T),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=_r(_d[30]),z=_r(_d[31]),M=_r(_d[32]),H=e(_r(_d[33])),P=e(_r(_d[34])),E=e(_r(_d[35])),O=e(_r(_d[36])),A=e(_r(_d[37])),N=e(_r(_d[38])),_=_r(_d[39]),G=_r(_d[40]),V=_r(_d[41]),F=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]),Pe=_r(_d[88]),Ee=_r(_d[89]),Oe=_r(_d[90]),Ae=_r(_d[91]);const Ne='#221C12',_e='#2E2618',Ge=12e4,Ve=e=>(e??'').replace(' (example)',''),Fe=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Ue=e=>e.slotTime?(0,q.hm)(new Date(e.slotTime)):'ASAP';function Ke({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,Ae.jsxs)(A.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Ae.jsx)(A.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,Ae.jsxs)(A.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,Ae.jsx)(G.T,{size:l?24:19,weight:"semibold",colour:e.alert?Q.colours.amber:Q.colours.text,children:e.value}),(0,Ae.jsx)(G.T,{size:l?14:12,colour:Q.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ae.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ae.jsx)($.default.Fragment,{children:i},e.testID)})}),s?(0,Ae.jsx)(A.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,Ae.jsx)(G.T,{size:14,colour:Q.colours.muted,children:"No Covers yet"}):(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ae.jsx)(G.T,{size:i?13:14,weight:"semibold",colour:Q.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,Ae.jsx)(G.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,Ae.jsxs)(A.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:Q.colours.gold},children:[(0,Ae.jsx)(A.default,{style:{width:`${s.walkInPct}%`,backgroundColor:Q.colours.gold}}),(0,Ae.jsx)(A.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function qe({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,Ae.jsxs)(E.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Ae.jsx)(A.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Ae.jsx)(G.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?Q.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,Ae.jsx)(G.T,{size:12,colour:Q.colours.muted,children:l}):null]})}function Ye({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,Pe.statusBlock)(e,t,(0,Pe.linkedBooking)(e,s));return e.length?(0,Ae.jsx)(A.default,{style:{gap:8},children:e.map(e=>(0,Ae.jsxs)(A.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:Q.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?Q.colours.ok:e.allergies.length?Q.colours.red:Q.colours.gold},children:[(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Ae.jsxs)(G.T,{size:l?16:18,weight:"bold",children:[Ue(e)," \xb7 ",Ve(e.customerName)]}),(0,Ae.jsx)(G.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,Ae.jsxs)(G.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,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:Q.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,K.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ae.jsx)(He.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ae.jsxs)(G.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ae.jsx)(G.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>Y.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Ae.jsx)(G.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Ae.jsx)(G.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Ae.jsx)(we.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ae.jsx)(G.Muted,{children:"No takeaway orders right now."})}function Qe({rid:e,id:t,turnBase:l}){const s=(0,Y.useBookings)(e).find(e=>e.id===t);return s?(0,Ae.jsx)(b.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1315,[1141,796,5,6,1316,828,853,1117,860,1140,1317,1318,1319,1114,1135,1320,1321,1326,1327,1328,872,1329,1153,980,1122,1330,34,1094,1178,1044,1110,1136,1331,395,380,402,295,102,426,36,794,1220,1224,873,861,858,874,821,1113,892,1119,1084,1025,1100,1127,1332,1126,1333,1340,1342,1345,1348,1344,1349,1351,1352,1132,1116,1118,878,1356,1209,1357,1219,1211,1022,1362,1370,1371,1097,1134,1373,1374,1375,1166,1376,1165,1159,869,1377,1378,25]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ge}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:b,headerExtra:K,subHeader:Me,noVoice:Pe=!1}={}){const Ue=(0,N.default)(),Je=b??Ue.width,Xe=Ue.height,Ze=Je<700,et=Je>=Xe,tt=!Ze&&et&&Je>=600,st=tt,lt=Math.round(Math.min(520,Math.max(Je>=1e3?448:280,.3*Je))),it=$.default.useRef(null),ot=$.default.useRef(0),[nt,at]=(0,T.useState)({w:0,h:0}),rt=(0,X.useOwner)(e=>e.site),dt=(0,Y.useRestaurant)(rt);(0,Ie.useAlertWatcher)(rt,{enabled:!e});const ct=(0,Y.useOrders)(rt),ut=(0,Y.useBookings)(rt),ht=(0,Y.useEvents)(rt),gt=(0,Y.useStore)(e=>e.skipMinutes),bt=(0,Y.useStore)(e=>e.clock.mode),yt=(0,Y.useNow)(5e3),pt=(0,X.useOwner)(e=>e.staff),ft=(0,X.useOwner)(e=>e.attendance),mt=(0,X.useOwner)(e=>e.shifts);$.default.useEffect(()=>{(0,ee.ensureAttendance)((0,q.ymd)(yt),yt)},[(0,q.ymd)(yt)]);const xt=ft.filter(e=>e.in&&!e.out&&yt.getTime()-new Date(e.in).getTime()<72e6&&yt.getTime()>=new Date(e.in).getTime()),jt=Fe(pt.find(e=>e.id===xt[0]?.staffId)?.name)||'Duty Manager',wt=k.IS_CAR?'Car':'Display';(0,D.useSoldOutLink)(!1,e?void 0:wt,!0);const kt=(0,q.ymd)(yt),It=(0,R.useTravelDay)('display',kt),vt=(0,Z.useFrontDoor)(kt,et),Dt=(0,te.useDisplaySettings)(rt),St=Dt.privacy,Ct=(0,ce.useSaverSync)(),Tt=(0,te.usePlan)(rt),$t=(0,te.useFloor)(e=>e.live[rt]),Bt=(0,ve.useBlocks)(e=>e.blocks),[Rt,Lt]=(0,T.useState)('plan'),[zt,Wt]=(0,T.useState)(!1),[Ht,Mt]=(0,T.useState)('all'),[Pt,Et]=(0,T.useState)(null),[At,Ot]=(0,T.useState)(null),[Nt,_t]=(0,T.useState)(null),[Gt,Ft]=(0,T.useState)(!1),[Vt,Ut]=(0,T.useState)(!1),[Kt,qt]=(0,T.useState)(null),[Yt,Qt]=(0,T.useState)(!1),[Jt,Xt]=(0,T.useState)(!1),[Zt,es]=(0,T.useState)(null),[ts,ss]=(0,T.useState)(null),[ls,is]=(0,T.useState)(null),os=$.default.useRef(0),ns=e=>{os.current=Date.now(),is(e)};$.default.useEffect(()=>{if(!ls)return;const e=setInterval(()=>{Date.now()-os.current>=Te.DAY_IDLE_MS&&is(null)},5e3);return()=>clearInterval(e)},[ls]);const as=(0,Y.useWaitlist)(rt),rs=(0,Y.useStore)(e=>e.walkIns[rt]??0),[ds,cs]=(0,T.useState)(!1),[us,hs]=(0,T.useState)(!1),[gs,bs]=(0,T.useState)(!1);(0,V.useReviewAlerts)(rt);const[ys,ps]=(0,T.useState)({view:0,content:0}),[fs,ms]=(0,T.useState)(null);$.default.useEffect(()=>{fs&&((0,S.notify)({id:`floor-note:${Date.now()}`,title:fs,timeoutMs:4500,big:!0,testID:'floor-toast'}),ms(null))},[fs]),$.default.useEffect(()=>{if(!e)return(0,L.setDisplaySilent)(!0),()=>(0,L.setDisplaySilent)(!1)},[e]);const[xs,js]=(0,T.useState)(null),ws=$.default.useRef(0),[ks,Is]=(0,T.useState)(null);$.default.useEffect(()=>{if(!xs)return;ws.current=Date.now();const e=setInterval(()=>{const e=Date.now()-ws.current;if(e>=Ge)return js(null),void ms('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Is(e>=105e3?Math.ceil((Ge-e)/1e3):null)},1e3);return()=>clearInterval(e)},[xs]);const vs=e=>e.date!==kt?_t({title:`Guest details \xb7 ${(0,Te.dayWord)(e.date,kt)} ${e.time}`,body:(0,Oe.jsxs)(Oe.Fragment,{children:[!e.walkIn&&e.date>kt?(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Te.dayWord)(e.date,kt)}, ${e.time}`,disabled:!Fl.ok,accessibilityHint:Fl.hint,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}):null,(0,xe.bookingDetails)(e)]})}):_t({title:`Guest details \xb7 ${e.time}`,body:(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsx)(Qe,{rid:rt,id:e.id,turnBase:dt.settings.turnMins}),e.walkIn?null:(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}),e.walkIn?(0,Oe.jsx)(ye.CancelWalkInButton,{rid:rt,b:e,big:!0,onDone:e=>{_t(null),ms(e)}}):null,e.walkIn?(0,Oe.jsx)(ye.ReinstateWalkInButton,{rid:rt,b:e,today:kt,onDone:e=>{_t(null),ms(e)}}):null,(0,xe.bookingDetails)(e)]})}),Ds=ut.filter(e=>e.date===kt).sort((e,t)=>e.time.localeCompare(t.time)),Ss=Ds.filter(e=>!['cancelled','noshow'].includes(e.status)),Cs=ct.filter(Ve).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ts=(0,T.useMemo)(()=>(0,c.forecastToday)(dt,ut,ct,ht,yt),[dt,ut,ct,ht,yt.getTime()/6e4|0]),$s=(0,ve.closedAreasAt)(Bt,rt,kt,(0,q.hm)(yt)),Bs=[...$s].join(','),Rs=(0,T.useMemo)(()=>(0,se.floorView)(Tt,ut,ct,$t??{},yt,dt.settings.turnMins,$s),[Tt,ut,ct,$t,yt.getTime(),Bs]),Ls=(0,me.hoursFor)(dt,yt),zs=Ls?.open??new Date(`${kt}T12:00:00`),Ws=Ls?.close??new Date(`${kt}T21:00:00`),Hs=(0,q.addMins)(zs,-zs.getMinutes()),Ms=(0,q.addMins)(Ws,30),Ps=e=>new Date(`${kt}T${e}:00`),Es=(0,ve.blocksOn)(Bt,rt,kt).map(e=>({from:Ps(e.from),to:Ps(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(dt,yt,kt)),As=Object.keys(Rs).filter(e=>'blocked'===Rs[e]?.status),Os=ls&&ls!==kt?ls:kt,Ns=Os!==kt,_s=(0,Te.dayWord)(Os,kt),Gs=/^(Today|Yesterday|Tomorrow)$/.test(_s),Fs=Ns?(0,Te.bookingsForDay)(ut,Os,kt).sort((e,t)=>e.time.localeCompare(t.time)):Ds,Vs=(0,q.parseYmd)(Os);Vs.setHours(12);const Us=Ns?(0,me.hoursFor)(dt,Vs):Ls,Ks=Us?.open??new Date(`${Os}T12:00:00`),qs=Us?.close??new Date(`${Os}T21:00:00`),Ys=e=>new Date(`${Os}T${e}:00`),Qs=[...Ns?(0,ve.blocksOn)(Bt,rt,Os).map(e=>({from:Ys(e.from),to:Ys(e.to),label:e.reason??'Paused'})):Es,...Ns?(0,o.queuedServicePauses)(dt,Vs,Os):[]],Js=(0,o.queuedServiceSessions)(dt,Vs),Xs=l.IS_QUEUED_VENUE&&(void 0===Js||!Js.length),Zs=(0,Oe.jsxs)(O.default,{testID:"queued-hours-gate",style:[ze.look.panel,{padding:14,gap:8}],children:[(0,Oe.jsx)(G.T,{weight:"semibold",children:void 0===Js?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Oe.jsx)(G.Muted,{children:i.queuedVenues[rt]?.hours.note})]}),el=Ns?Us||Fs.length?OsNs?(0,se.dayFloorView)(Tt,Fs,Os):Rs,[Ns,Tt,Fs,Os,Rs]),[sl,ll]=(0,T.useState)(null),[il,ol]=(0,T.useState)(null),[nl,al]=(0,T.useState)(null),rl=Ns?Fs.filter(e=>!['cancelled','noshow'].includes(e.status)):Ss,dl=rl.reduce((e,t)=>e+t.partySize,0),cl=(0,u.coversSplit)(rl,Os),ul=(0,$e.cancelledDayTally)(ut,Os),hl=(0,Be.cancellationsFor)(ut,Os,e=>e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)','')),gl=(0,$e.cancelledTallyWords)(ul,Gs?_s.toLowerCase():Ns?`on ${_s}`:'today'),bl=Bt.filter(e=>e.rid===rt&&e.date===Os&&!e.removedAt),yl=(0,Ce.chartBands)(bl,60*Ks.getHours()+Ks.getMinutes(),60*qs.getHours()+qs.getMinutes()),pl=new Set((0,Ce.blockedHours)(yl)),fl=yt.getHours()+(yt.getMinutes()>=30?1:0),ml=Ts.hours.filter(e=>e.hour>=fl&&!pl.has(e.hour)),xl=ml.reduce((e,t)=>e+t.coversHigh,0),jl=ml.reduce((e,t)=>e+t.coversLow,0),wl=Math.round((jl+xl)/2),kl=!Ts.example&&Ts.open&&Ts.enough&&xl>0?`Usually ${(0,c.coversRange)(wl,wl)} more`:void 0,Il=async(e,t)=>{const s=Rs[e]?.booking;if(!s||e===t)return;const l=Rs[t]?.status;if(l&&!['free','soon'].includes(l))return void ms('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${se.STATUS[l].label.toLowerCase()}. Pick a free table.`);await Y.repo.bookings.update(s.id,{table:t});const i=$t?.[e]?.stage;te.useFloor.getState().setLive(rt,t,{stage:i??'seated',dirty:!1}),te.useFloor.getState().setLive(rt,e,{stage:void 0,dirty:!0}),ms(`${(0,ue.privName)(s,St)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`)},vl=e=>{if(ts)return ol(null),void ss(t=>t?{...t,tables:(0,fe.toggleTable)(t.tables,e)}:t);Ns?ll(e):At?(e!==At&&Il(At,e),Ot(null)):Et(e)},Dl=ts?ut.find(e=>e.id===ts.id):void 0,Sl=ts&&Dl?(()=>{const e=Dl.walkIn?(0,ue.privName)(Dl,St):Fe(Dl.name),t=(0,fe.seatsOf)(Tt,ts.tables).total,s=(0,fe.seatLine)(t,Dl.partySize),l=(0,fe.pickClashes)(Dl,ts.tables,ut.filter(e=>e.date===Dl.date),dt.settings.turnMins),i=(0,fe.tableKey)(ts.tables)!==(0,fe.tableKey)((0,te.tablesOf)(Dl.table));return(0,Oe.jsxs)(O.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:Q.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:Q.colours.gold,padding:10},children:[(0,Oe.jsxs)(O.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Te.dayWord)(Dl.date,kt)} ${Dl.time}. Tap tables on the plan to add or take them off. ${(0,fe.tablesWords)(ts.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Te.dayWord)(Dl.date,kt)," ",Dl.time]}),(0,Oe.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[(0,fe.tablesWords)(ts.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),il?(0,Oe.jsx)(O.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:il,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:Q.colours.amber,backgroundColor:Q.colours.amberBg},children:(0,Oe.jsx)(G.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:il})}):null,(0,Oe.jsxs)(G.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Oe.jsx)(G.Button,{testID:il?'plan-pick-overcap-yes':'plan-pick-save',label:il?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${il?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,fe.tablesWords)(ts.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Dl)return void ss(null);const s=(0,fe.overCapacityAsk)(ts.tables,t,Dl.partySize);if(!s||il){ol(null);try{await(0,pe.saveBookingTables)(rt,Dl,ts.tables),ms((0,fe.savedWords)(e,Dl.partySize,ts.tables,t))}catch(t){ms(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}ss(null)}else ol(s)}}),(0,Oe.jsx)(G.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{ol(null),ss(null)}})]})]})})():null,Cl=Tt.areas.filter(e=>Tt.tables.some(t=>t.areaId===e.id)),Tl=e=>{const t=Tt.tables.filter(t=>t.areaId===e);return Ns?`${t.filter(e=>!tl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Rs[e.name]?.status??'free')).length}/${t.length} free`},$l='all'===Ht||Cl.some(e=>e.id===Ht)?Ht:'all',Bl=e=>(0,Oe.jsx)(le.FloorCanvas,{plan:Tt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:tt,big:!0,view:tl,privacy:St,turnBase:dt.settings.turnMins,highlight:ts?ts.tables:At?[At]:void 0,onTap:e=>vl(e.name),onDrop:(e,t)=>ts||Ns?void 0:Il(e.name,t.name)}),Rl=Ze?1:et||Cl.length>2?2:1,Ll=e=>{const t=Tt.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},zl=[];for(let e=0;e{const t=(0,le.areaBounds)(Tt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,le.minReadableScale)(Tt,e.id)}}),nt.w,nt.h):null,Hl=e=>(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between',height:ie.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,children:Tl(e.id)})]}),Ml=(0,Oe.jsx)(O.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-nt.w)>1||Math.abs(s-nt.h)>1)&&at({w:t,h:s})},children:Wl?(0,Oe.jsx)(A.default,{style:{flex:1},scrollEnabled:Wl.scroll,showsVerticalScrollIndicator:Wl.scroll,contentContainerStyle:{gap:ie.GRID_GAP},children:Wl.rows.map((e,t)=>(0,Oe.jsx)(O.default,{style:{height:Wl.rowHeights[t],flexDirection:'row',gap:ie.GRID_GAP},children:e.map(e=>{const t=Cl.find(t=>t.id===e);return(0,Oe.jsxs)(O.default,{testID:`area-cell-${e}`,style:{width:Wl.cellW,gap:2},children:[Hl(t),(0,Oe.jsx)(O.default,{style:{flex:1},children:Bl(e)})]},e)})},t))}):null}),Pl=(0,Oe.jsxs)(O.default,{testID:"venue-plan",style:{flex:Ze?void 0:1,gap:10,minWidth:0},children:[(0,Oe.jsx)(r.TableNumberWarning,{plan:Tt}),Tt.tables.length?null:(0,Oe.jsxs)(O.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Oe.jsx)(G.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Oe.jsx)(G.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,Oe.jsx)(G.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,Oe.jsx)(qe,{chipId:"all",compact:!Ze,label:"Whole venue",selected:'all'===$l,onPress:()=>Mt('all')},"__all"),...Cl.map(e=>(0,Oe.jsx)(qe,{chipId:e.id,compact:!Ze,label:`${e.name}${(0,oe.areaMarks)(e)}`,colour:(0,Q.brandColour)(e.colour),sub:Ze?$s.has(e.id)?'closed':$l===e.id?Tl(e.id):void 0:void 0,selected:$l===e.id,onPress:()=>Mt(e.id)},e.id))];return Ze?(0,Oe.jsx)(O.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Oe.jsx)(A.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;ps(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>ps(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:ys.view>0&&ys.content>0&&ys.content<=ys.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:ys.view>0&&ys.content<=ys.view+1?'100%':void 0},children:e})})(),(0,Oe.jsx)(g.FloorLegend,{}),Sl,At?(0,Oe.jsxs)(G.Row,{gap:8,style:{backgroundColor:Q.colours.goldTint,borderRadius:10,padding:8},children:[(0,Oe.jsxs)(G.T,{weight:"semibold",colour:Q.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(At),": tap the new table."]}),(0,Oe.jsx)(G.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ot(null)})]}):null,'all'===$l&&tt?Ml:'all'===$l?(0,Oe.jsx)(O.default,{style:{flex:Ze?void 0:1,gap:12,minHeight:st?void 0:360},children:zl.map((e,t)=>(0,Oe.jsxs)(O.default,{style:{flex:Ze?void 0:Math.max(.3,...e.map(e=>Ll(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Oe.jsxs)(O.default,{style:{flex:1,gap:2},children:[Ze?(0,Oe.jsxs)(O.default,{style:{alignItems:'center',gap:4},children:[(0,Oe.jsxs)(G.T,{center:!0,size:18,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{center:!0,size:14,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.Muted,{center:!0,children:Tl(e.id)})]}):(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.Muted,{children:Tl(e.id)})]}),(0,Oe.jsx)(O.default,{style:Ze?{height:Math.max(280,Math.round((Je-40)*Ll(e.id)))}:{flex:1},children:Bl(e.id)})]},e.id)),e.length{if(Ns)return void es(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rs[t]?Et(t):vs(e)}},Os)}),Al='timeline'===Rt,Ol=zt?(0,Oe.jsx)(M.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Wt(!1),supportedOrientations:['landscape','portrait'],children:(0,Oe.jsxs)(O.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:Q.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Oe.jsx)(E.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Wt(!1),style:{minHeight:64,minWidth:Je<600?120:180,paddingHorizontal:Je<600?14:22,borderRadius:16,borderWidth:2,borderColor:Q.colours.goldLight,backgroundColor:Q.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(G.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Oe.jsx)(O.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Oe.jsx)(G.T,{size:22,weight:"semibold",colour:Q.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${Ns?(0,Te.dayLong)(Os):'Today'}`})}),Je<600?null:(0,Oe.jsx)(O.default,{style:{minWidth:180}})]}),Xs?Zs:(0,Oe.jsx)(O.default,{style:{flex:1,minHeight:0},children:(0,Oe.jsx)(re.Timeline,{hideNow:!0,fit:!0,plan:Tt,bookings:Ns?Fs:Ds,now:Ns?Ks:yt,privacy:St,turnBase:dt.settings.turnMins,t0:Ns?(0,q.addMins)(Ks,-Ks.getMinutes()):Hs,t1:Ns?(0,q.addMins)(qs,30):Ms,pauses:Ns?Qs:Es,blockedTables:Ns?[]:As,onOpen:e=>{if(Wt(!1),Ns)return void es(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rs[t]?Et(t):vs(e)}},`full-${Os}`)})]})}):null,Nl=Ns?(0,Oe.jsxs)(O.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:Q.colours.gold,backgroundColor:Q.colours.goldTint},children:[(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:Gs?`Showing ${_s} \xb7 ${(0,q.niceDate)((0,q.parseYmd)(Os))}`:`Showing ${(0,Te.dayWord)(Os,kt)}`}),(0,Oe.jsx)(O.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${gl}. Showing ${(0,Te.dayLong)(Os)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Oe.jsx)(G.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ss(null),ns(null)},style:{minHeight:44}})]}):null,_l=(0,Oe.jsx)(O.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:Ze?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(Al||zt);return(0,Oe.jsx)(E.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?(Lt('plan'),Wt(!0)):(Wt(!1),Lt('plan'))},style:{flex:Ze?1:void 0,minHeight:Ze?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?Q.colours.gold:'transparent',...ze.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,Oe.jsx)(G.T,{size:Ze?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Gl='display'!==k.APP_VARIANT||e?_l:(0,Oe.jsxs)(O.default,{testID:"display-view-row",style:{flexDirection:Ze?'column':'row',flexWrap:Ze?'nowrap':'wrap',gap:6,alignItems:Ze?'stretch':'center'},children:[_l,(0,Oe.jsx)(w.DisplayRotaKitchenButtons,{phone:Ze,shifts:mt,staff:pt,today:kt})]}),Fl=(0,h.useBookingWrite)(),Vl=e=>(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsx)(We.BigAction,{premium:!0,label:"Walk-in",onPress:vt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint}),(0,Oe.jsx)(We.BigAction,{premium:!0,label:"New booking",onPress:vt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint}),(0,Oe.jsx)(We.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Ut(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint})]});(0,Ae.useDisplayNotices)(rt,!e);const Ul=Ze?180:168,[Kl,ql]=(0,T.useState)(Ul),Yl=$.default.useRef(Ul),Ql=$.default.useRef(null),Jl=$.default.useRef(null),Xl=()=>{const e=Ql.current,t=Jl.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,s,l,i)=>{t.measureInWindow((e,t)=>{const l=Xe<820?8:12,o=44+(Xe<820?4:8),n=i>Yl.current?Math.ceil(i-Yl.current):Se.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Ul,Math.floor(t-l-s)-n-o));Math.abs(Yl.current-a)>=2&&(Yl.current=a,ql(a))})})};$.default.useEffect(()=>{const e=setTimeout(Xl,60);return()=>clearTimeout(e)},[Je,Xe]);const Zl=(0,Oe.jsxs)(O.default,{ref:Jl,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xl()},style:{flexDirection:'row',flexWrap:Je>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ze?12:6,justifyContent:Ze?'center':void 0,borderTopWidth:1,borderTopColor:Q.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Oe.jsx)(Ee.DisplayClockButton,{}),(0,Oe.jsx)(ae.HoldToEdit,{quiet:!0,onUnlock:()=>{Is(null),js({at:Date.now()})},onHint:()=>ms('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Oe.jsx)(De.BlockBookingsButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,display:!0,day:Os}),Tt.areas.some(e=>e.outdoor)?(0,Oe.jsx)(De.CloseGardenButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,short:!0}):null,(0,Oe.jsx)(E.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>bs(!0),style:({pressed:e})=>({...ze.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR?null:(0,Oe.jsx)(f.GiftQrButton,{rid:rt,venue:dt.name})]}),ei=Cs.length?(0,Oe.jsxs)(O.default,{testID:"takeaway-panel",style:[ze.look.panel,{overflow:'hidden'}],children:[(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Oe.jsx)(G.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Oe.jsxs)(G.T,{size:12,colour:Q.colours.muted,children:[Cs.length," live"]})]}),(0,Oe.jsx)(O.default,{style:{padding:10},children:(0,Oe.jsx)(Ye,{list:Cs,me:jt,compact:!0,bookings:ut})})]}):null,ti=(Le.DueToday,Ns?Fs:Ds.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),si=Ns?Gs?`${_s}\u2019s guests`:`Guests ${_s}`:'Today\u2019s guests',li=(0,Oe.jsxs)(Oe.Fragment,{children:[0===ti.length?(0,Oe.jsx)(G.Muted,{children:Ns?Os{const t=(0,J.isSeatedHighlight)(e.status,{otherDay:Ns}),s=(0,he.guestRowText)(e,{name:e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)',''),seated:t}),l=Q.colours.text,i=t?Q.colours.goldLight:Q.colours.muted,o=Q.colours.gold,n=s.depositWarn?Q.colours.amber:Q.colours.goldLight;return(0,Oe.jsxs)(E.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:s.a11y,accessibilityHint:Ns?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Xt(!1),es(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,J.seatedHighlightStyle)({backgroundColor:e?_e:Ne,borderColor:Q.colours.gold,borderLeftColor:Q.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:Q.colours.hairline,backgroundColor:e?Q.colours.tilePressed:'transparent'},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Oe.jsx)(G.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:s.time}),(0,Oe.jsx)(G.T,{size:18,weight:"semibold",colour:l,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:s.name}),s.allergy?(0,Oe.jsx)(O.default,{style:{paddingTop:2},children:(0,Oe.jsx)(H.AllergyIcon,{text:s.allergy,size:22,colour:Q.colours.amber,ink:Q.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Oe.jsxs)(G.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Oe.jsx)(G.T,{size:16,colour:l,children:s.people}),s.deposit?(0,Oe.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}):null,s.deposit?(0,Oe.jsx)(G.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:s.deposit}):null,(0,Oe.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}),(0,Oe.jsx)(G.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===s.table?i:l,children:s.table}),s.dog?(0,Oe.jsx)(G.T,{size:16,children:" "}):null,s.dog?(0,Oe.jsx)(O.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Oe.jsx)(ge.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,Oe.jsx)(Re.CancellationsSection,{items:hl,dayWord:Ns?Gs?_s.toLowerCase():`on ${_s}`:'today'})]}),ii=(0,Oe.jsx)(A.default,{testID:"display-guest-list",accessibilityLabel:si,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:li}),oi=P.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Xt(!1)}}),ni=(0,Oe.jsxs)(E.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${si}, ${ti.length}`,accessibilityState:{expanded:Jt},'aria-expanded':Jt,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Xt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:Jt?Q.colours.gold:Q.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?Q.colours.tilePressed:Jt?Q.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Oe.jsx)(G.T,{size:16,weight:"bold",colour:Q.colours.gold,children:ti.length}),(0,Oe.jsx)(O.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(O.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Oe.jsxs)(G.T,{size:13,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,children:[si," ",Jt?'\u2039':'\u203a']})})})]}),ai=Jt?(0,Oe.jsxs)(O.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Oe.jsxs)(O.default,{testID:"guests-drawer",...oi.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Je)),backgroundColor:Q.colours.surface,borderRightWidth:1,borderColor:Q.colours.gold,borderRadius:14,...ze.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Oe.jsxs)(O.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[si.toUpperCase()," (",ti.length,")"]}),(0,Oe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${si}`,onPress:()=>Xt(!1),style:{marginRight:-6}})]}),ul.count?(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,testID:"cancelled-day-tally-guests",children:gl}):null]}),ii]}),(0,Oe.jsx)(E.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${si}`,accessibilityRole:"button",onPress:()=>Xt(!1),style:{flex:1}})]}):null,ri=Xs?Zs:l.IS_KIRKTON&&!Object.values(dt.kitchenHours??{}).some(Boolean)?(0,Oe.jsxs)(O.default,{testID:"kirkton-hours-to-confirm",style:[ze.look.panel,{padding:14,gap:8}],children:[(0,Oe.jsx)(G.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Oe.jsx)(G.Muted,{children:"No service hours have been set for this venue."})]}):(0,Oe.jsx)(Se.DayGraph,{busyThreshold:(0,t.venueBusy)(dt,ut,yt).busy,todays:Fs,open:Ks,close:qs,now:yt,turnBase:dt.settings.turnMins,blocks:bl,pauses:Qs,compact:Ze,dense:!Ze,fit:tt,tight:tt&&Xe<600,height:Ul,forecastNote:Ns?void 0:kl,emptyText:el,past:Os{Ns?Xt(!0):Wt(!0)},hi=(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',padding:Xe<820?8:12,paddingTop:Xe<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[It?null:ni,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[It?null:Nl,It?(0,Oe.jsx)(A.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Oe.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"})}):Al?El:Pl,Ol,ai]}),(0,Oe.jsxs)(O.default,{testID:"display-side",style:{width:lt,gap:Xe<820?4:8,minHeight:0},children:[(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Vl(!1)}),(0,Oe.jsx)(O.default,{style:{flexShrink:0},children:Gl}),It?null:(0,Oe.jsx)(O.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,compact:Xe<820,snug:Xe<820,tight:Xe<700,sound:(0,L.flapSoundOn)(),onPress:ui})}),It?null:(0,Oe.jsx)(O.default,{ref:Ql,testID:"day-graph-slot",onLayout:Xl,style:{flexGrow:0,flexShrink:1,flexBasis:Ul+52,minHeight:Xe<600?90:120,overflow:'visible'},children:di}),(0,Oe.jsxs)(A.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Oe.jsx)(E.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>hs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Oe.jsx)(G.T,{center:!0,weight:"semibold",children:"Reviews"})}),ei,(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt})]})]})]});return(0,Oe.jsxs)(_.SafeAreaView,{style:{flex:1,backgroundColor:Q.colours.bg},onTouchStart:()=>{os.current=Date.now()},onMouseDown:()=>{os.current=Date.now()},children:[Ze?(0,Oe.jsxs)(O.default,{style:{flex:1},children:[(0,Oe.jsxs)(A.default,{ref:it,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Oe.jsxs)(O.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Oe.jsx)(O.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Oe.jsx)(j.ExitButton,{})}),(0,Oe.jsx)(U.RestaurantLogo,{rid:rt,size:64}),(0,Oe.jsx)(G.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:dt.name}),(0,Oe.jsx)(U.PoweredBy,{}),(0,Oe.jsx)(C.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Oe.jsx)(O.default,{accessible:!0,accessibilityLabel:`Current time ${(0,q.hm)(yt)}`,children:(0,Oe.jsx)(G.T,{center:!0,size:30,weight:"semibold",colour:Q.colours.goldLight,children:(0,q.hm)(yt)})}),(0,Oe.jsx)(He.ShellfishChip,{rid:rt,by:jt,app:"display",size:"m"}),(0,Oe.jsx)(He.SundayRoastChip,{rid:rt,by:jt,app:"display",size:"m"}),K]}),Me,ci,(0,Oe.jsx)(O.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Oe.jsx)(Ke,{phone:!0,split:cl,items:[{label:`Tables \xb7 ${_s}`,value:rl.length,testID:'badge-tables'},{label:`Covers \xb7 ${_s}`,value:dl,testID:'badge-covers'},{label:'Takeaway',value:Cs.length,alert:Cs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Ft(!0)}]})}),(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{gap:8},children:Vl(!0)}),(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),Gl,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[Al?El:Pl,Ol]}),(0,Oe.jsxs)(O.default,{onLayout:e=>{ot.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[ze.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Oe.jsxs)(G.T,{center:!0,size:20,weight:"semibold",colour:Q.colours.goldLight,accessibilityRole:"header",children:[si," (",ti.length,")"]}),(0,Oe.jsx)(O.default,{testID:"display-guest-list",accessibilityLabel:si,style:{gap:4},children:li})]}),ei,di,(0,Oe.jsx)(O.default,{testID:"covers-dock",children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,compact:!0,sound:(0,L.flapSoundOn)(),onPress:()=>it.current?.scrollTo({y:ot.current,animated:!0})})}),(0,Oe.jsxs)(O.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Oe.jsx)(G.T,{center:!0,size:14,colour:St?Q.colours.muted:Q.colours.amber,children:St?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Oe.jsx)(G.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cs(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Oe.jsx)(G.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>hs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zl]}),e?null:(0,Oe.jsx)(O.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:Q.colours.hairline},children:(0,Oe.jsx)(W.VoiceSlot,{size:56})})]}):(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Je>=1e3?18:14,paddingVertical:Xe<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),...ze.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Oe.jsx)(O.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Oe.jsx)(U.RestaurantBrand,{rid:dt.id,size:Je<900?32:40,beside:!0})}),(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Oe.jsx)(G.T,{size:Je<900?18:21,weight:"semibold",colour:Q.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,q.hm)(yt)}),Je>=900?(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,children:(0,q.niceDate)(yt)}):null]})]}),It?(0,Oe.jsx)(O.default,{style:{width:220}}):(0,Oe.jsx)(O.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:ci}),(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Oe.jsx)(He.ShellfishChip,{rid:rt,by:jt,app:"display",size:Je<1200?'xs':Je<1280||Xe<700?'s':'m'}),(0,Oe.jsx)(E.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cs(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.muted,children:"?"})}),'simulated'===bt?(0,Oe.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>gt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(G.T,{size:11,colour:Q.colours.muted,children:"+15"})}):null,e?null:(0,Oe.jsx)(j.ExitButton,{}),K,Pe?null:(0,Oe.jsx)(W.VoiceSlot,{size:44})]})]}),Me,It?null:(0,Oe.jsxs)(O.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,Oe.jsx)(Ke,{splitOnly:!0,split:cl,items:[]}),(0,Oe.jsx)(O.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Je>=1e3?18:14)+(e?0:52)+('simulated'===bt?52:0),zIndex:4},children:(0,Oe.jsx)(He.SundayRoastChip,{rid:rt,by:jt,app:"display",size:Je<1100||Xe<700?'s':'m'})})]}),tt?hi:(gi=(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Vl(!1)}),Gl]}),(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),It?(0,Oe.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"}):(0,Oe.jsx)(Oe.Fragment,{children:(0,Oe.jsxs)(O.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[ni,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Nl,Al?El:Pl,Ol,ai]})]})}),ei,It?null:(0,Oe.jsx)(O.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,sound:(0,L.flapSoundOn)(),onPress:ui})}),It?null:(0,Oe.jsx)(O.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Ul+Se.DAY_GRAPH_CHROME},children:di})]}),(0,Oe.jsx)(A.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:gi})),Zl]}),(0,Oe.jsx)(I.SoldOutStrip,{rid:rt,by:wt,onOpen:()=>bs(!0)}),(0,Oe.jsx)(v.SoldOutSheet,{visible:gs,onClose:()=>bs(!1),rid:rt,by:wt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Oe.jsx)(p.TableOrderCue,{rid:rt}),vt.elements,Vt?(0,Oe.jsx)(y.EditBookingPicker,{rid:rt,today:kt,who:jt,hidePrivate:!0,onClose:()=>Ut(!1)}):null,Kt?(0,Oe.jsx)(y.EditBookingSheet,{rid:rt,id:Kt,who:jt,hidePrivate:!0,onClose:()=>qt(null)}):null,Pt?(0,Oe.jsx)(xe.TableSheet,{rid:rt,name:Pt,view:Rs,plan:Tt,todays:Ds,now:yt,privacy:St,turnBase:dt.settings.turnMins,onClose:()=>Et(null),onWalkIn:e=>vt.openWalkInAt(e),onMove:e=>Ot(e),onDetails:vs}):null,sl?(()=>{const e=tl[sl],t=e?.dayBookings??[];return(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>{al(null),ll(null)},title:`${(0,d.tableNumbersA11y)(sl)} \xb7 ${Gs?_s:(0,Te.dayLong)(Os)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Oe.jsxs)(G.T,{size:16,center:!0,colour:Q.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${Gs?_s.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${Gs?_s.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ue.privName)(e,St):Fe(e.name);return(0,Oe.jsx)(G.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,fe.tablesWords)((0,te.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ll(null),es(e.id)},style:{minHeight:56}},e.id)}),Os>=kt?(()=>{const t=e?.table.maxSeats??0,s=ut.filter(e=>e.date===Os&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,te.tablesOf)(e.table).includes(sl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Oe.jsxs)(O.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",center:!0,colour:Q.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(sl)]}),nl?(0,Oe.jsxs)(O.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:nl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:Q.colours.amber,backgroundColor:Q.colours.amberBg},children:[(0,Oe.jsx)(G.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:nl.ask}),(0,Oe.jsxs)(G.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Oe.jsx)(G.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!Fl.ok,accessibilityHint:Fl.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=ut.find(e=>e.id===nl.id);if(al(null),!e)return;const s=Fe(e.name);try{await(0,pe.saveBookingTables)(rt,e,[sl]),ms((0,fe.savedWords)(s,e.partySize,[sl],t))}catch(e){ms(`Couldn\u2019t save tables for ${s}: ${String(e?.message??e).slice(0,120)}`)}ll(null)}}),(0,Oe.jsx)(G.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>al(null)})]})]}):null,nl?null:s.slice(0,12).map(e=>{const s=Fe(e.name),l=e.partySize>t;return(0,Oe.jsx)(G.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:!Fl.ok,accessibilityHint:Fl.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(sl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{const l=(0,fe.overCapacityAsk)([sl],t,e.partySize);if(l)al({id:e.id,ask:l});else{try{await(0,pe.saveBookingTables)(rt,e,[sl]),ms((0,fe.savedWords)(s,e.partySize,[sl],t))}catch(e){ms(`Couldn\u2019t save tables for ${s}: ${String(e?.message??e).slice(0,120)}`)}ll(null)}},style:{minHeight:56}},e.id)})]}):null})():null,(0,Oe.jsx)(G.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{al(null),ll(null)},style:{minHeight:56}})]})})():null,Zt?(()=>{const e=ut.find(e=>e.id===Zt);return e?(0,Oe.jsx)(be.GuestActionsSheet,{rid:rt,b:e,name:e.walkIn?(0,ue.privName)(e,St):Fe(e.name),view:Rs,now:yt,otherDay:e.date!==kt,turnBase:dt.settings.turnMins,onClose:()=>es(null),onDetails:vs,onDone:ms,onEdit:e=>{es(null),qt(e.id)},onPickOnPlan:(e,t)=>{Xt(!1),Lt('plan'),Mt('all'),ss({id:e.id,tables:t})}}):null})():null,Nt?(0,Oe.jsx)(xe.DetailsPanel,{title:Nt.title,onClose:()=>_t(null),children:Nt.body}):null,Yt?(0,Oe.jsx)(xe.ServiceSummary,{r:dt,todays:Ds,orders:ct,waitlistAll:as,walkInCount:rs,onClose:()=>Qt(!1)}):null,ds?(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>cs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Oe.jsx)(g.FloorLegend,{}),(0,Oe.jsx)(G.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>cs(!1)})]}):null,us?(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>hs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Oe.jsx)(F.ReviewsSection,{rid:rt,mode:"read",venueName:dt.name}),(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>hs(!1)})]}):null,Gt?(0,Oe.jsxs)(xe.DetailsPanel,{title:"Takeaway",onClose:()=>Ft(!1),children:[(0,Oe.jsx)(G.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Oe.jsx)(Ye,{list:Cs,me:jt,bookings:ut})]}):null,xs?(0,Oe.jsx)(O.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:Q.colours.bg},children:(0,Oe.jsx)(ne.PlanDesigner,{initial:Tt,venue:dt.name,mode:"display",startStep:"arrange",onActivity:()=>{ws.current=Date.now(),null!==ks&&Is(null)},notice:null!==ks?`Locking again in ${ks} s \xb7 touch to keep editing`:null,onSave:e=>{te.useFloor.getState().setPlan(rt,e),js(null),ms('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{te.useFloor.getState().setPlan(rt,e),ms('Live seating plan updated on every screen.')},onCancel:()=>{js(null),ms('No changes kept. Editing is locked again.')}},xs.at)}):null,e?null:(0,Oe.jsx)(de.Screensaver,{rid:rt,idleMins:Dt.idleMins,pinOn:Dt.pinOn,wake:Dt,tonightCards:Dt.tonightCards,cfg:Ct}),e?null:(0,Oe.jsx)(we.PrintHost,{rid:rt}),e?null:(0,Oe.jsx)(je.AlertHost,{variant:"display",rid:rt,skipTakeaway:!0}),e?null:(0,Oe.jsx)(z.SeatAllergenReminder,{rid:rt}),e?null:(0,Oe.jsx)(ke.TakeawayTakeover,{rid:rt,me:jt})]});var gi};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),D=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=e(T),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),z=_r(_d[30]),W=_r(_d[31]),H=_r(_d[32]),M=e(_r(_d[33])),P=e(_r(_d[34])),E=e(_r(_d[35])),A=e(_r(_d[36])),O=e(_r(_d[37])),N=e(_r(_d[38])),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),me=_r(_d[69]),xe=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),ve=_r(_d[75]),De=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),ze=_r(_d[84]),We=_r(_d[85]),He=_r(_d[86]),Me=_r(_d[87]),Pe=_r(_d[88]),Ee=_r(_d[89]),Ae=_r(_d[90]),Oe=_r(_d[91]);const Ne='#221C12',_e='#2E2618',Ge=12e4,Fe=e=>(e??'').replace(' (example)',''),Ve=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Ue=e=>e.slotTime?(0,q.hm)(new Date(e.slotTime)):'ASAP';function Ke({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:o}){return(0,Oe.jsxs)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Oe.jsx)(O.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,Oe.jsxs)(O.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,Oe.jsx)(G.T,{size:s?24:19,weight:"semibold",colour:e.alert?Q.colours.amber:Q.colours.text,children:e.value}),(0,Oe.jsx)(G.T,{size:s?14:12,colour:Q.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Oe.jsx)(E.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,Oe.jsx)($.default.Fragment,{children:i},e.testID)})}),l?(0,Oe.jsx)(O.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Oe.jsx)(G.T,{size:14,colour:Q.colours.muted,children:"No Covers yet"}):(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Oe.jsx)(G.T,{size:i?13:14,weight:"semibold",colour:Q.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Oe.jsx)(G.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Oe.jsxs)(O.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:Q.colours.gold},children:[(0,Oe.jsx)(O.default,{style:{width:`${l.walkInPct}%`,backgroundColor:Q.colours.gold}}),(0,Oe.jsx)(O.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function qe({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:o,compact:n}){return(0,Oe.jsxs)(E.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Oe.jsx)(O.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Oe.jsx)(G.T,{size:n?12:14,weight:l?'semibold':'medium',colour:l?Q.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Oe.jsx)(G.T,{size:12,colour:Q.colours.muted,children:s}):null]})}function Ye({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Pe.statusBlock)(e,t,(0,Pe.linkedBooking)(e,l));return e.length?(0,Oe.jsx)(O.default,{style:{gap:8},children:e.map(e=>(0,Oe.jsxs)(O.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:Q.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?Q.colours.ok:e.allergies.length?Q.colours.red:Q.colours.gold},children:[(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Oe.jsxs)(G.T,{size:s?16:18,weight:"bold",children:[Ue(e)," \xb7 ",Fe(e.customerName)]}),(0,Oe.jsx)(G.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,Oe.jsxs)(G.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,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:Q.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,K.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Oe.jsx)(Me.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Oe.jsxs)(G.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Oe.jsx)(G.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>Y.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Oe.jsx)(G.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Oe.jsx)(G.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Oe.jsx)(we.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Oe.jsx)(G.Muted,{children:"No takeaway orders right now."})}function Qe({rid:e,id:t,turnBase:s}){const l=(0,Y.useBookings)(e).find(e=>e.id===t);return l?(0,Oe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1315,[1141,796,5,6,1316,828,853,1117,860,1140,1317,1318,1319,1114,1135,1320,1321,1326,1327,1328,872,1329,1153,980,1122,1330,34,1094,1178,1044,1110,1136,1331,395,380,402,295,102,426,36,794,1220,1224,873,861,858,874,821,1113,892,1119,1084,1025,1100,1127,1332,1126,1333,1340,1342,1345,1348,1344,1349,1351,1352,1132,1116,1118,878,1356,1209,1357,1219,1211,1022,1362,1370,1371,1097,1134,1373,1374,1375,1166,1376,1165,1159,869,1377,1378,25]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1317,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1318,[1023,1084]); @@ -1422,7 +1422,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.listSavedPlans=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))},_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const{data:c,error:u}=await(0,n.getSupabase)().from('table_plans').insert({venue_id:a,name:o.name,is_active:!1,areas:t.areas??[],tables:t.tables??[],joins:t.joins??[],sections:t.sections??[],fixtures:t.fixtures??[],updated_by:s()}).select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').single();if(u)throw u;return l(c)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return c(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:c(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}function c(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1339,[1338,1021,872,934,988]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1340,[34,236,402,102,821,794,1166,1341,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},1341,[]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return w}}),_e.Timeline=function({plan:e,bookings:T,now:C,privacy:S,onOpen:v,turnBase:I,t0:D,t1:E,height:z,pauses:L,blockedTables:R,hideNow:$,compact:_=!1,fit:O=!1}){const B=(0,o.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),W=T.filter(e=>!['cancelled','noshow'].includes(e.status)),[N,F]=(0,o.useState)(0),A=O&&!W.some(e=>!e.table)?B.filter(e=>'__none'!==e.key):B,P=O&&N>0?Math.max(w,Math.min(k,Math.floor(N/Math.max(1,A.length)))):k,H=P<44,Y=(0,o.useMemo)(()=>(0,c.clashes)(W,I),[W,I]),V=Math.max(1,Math.ceil((E.getTime()-D.getTime())/9e5)),[U,X]=(0,o.useState)(0),G=Math.max(30,U-M-2),q=Math.min(V,Math.max(1,Math.floor(G/j))),J=U>0?Math.max(j,Math.floor(G/q*100)/100):j,[K,Q]=(0,o.useState)(0),Z=Math.max(0,V-q),ee=Math.max(0,Math.min(Z,K)),te=(0,u.addMins)(D,15*ee),le=(0,u.addMins)(te,15*q),oe=e=>(e.getTime()-te.getTime())/9e5*J,[ie,ne]=(0,o.useState)(null),re=(0,o.useRef)(null);(0,o.useEffect)(()=>{const e=$?0:Math.floor((C.getTime()-D.getTime())/9e5)-Math.floor(q/3);Q(Math.max(0,Math.min(Z,e)))},[D.getTime(),q,Z,$]);const[se,ae]=(0,o.useState)(''),[de,ce]=(0,o.useState)(null),he=(0,o.useRef)(null);he.current=de,(0,o.useEffect)(()=>{if(!de)return;const e=setTimeout(()=>ce(null),s.ARM_MS);return()=>clearTimeout(e)},[de]);const ue=de?W.find(e=>e.id===de.id):void 0,be=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(he.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(he.current,e.id,Date.now()),onResponderGrant:e=>{re.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:l=>{if(!re.current||!(0,s.isArmed)(he.current,e.id,Date.now()))return;const o=l.nativeEvent.pageX-re.current.x,i=l.nativeEvent.pageY-re.current.y;(Math.abs(i)>=6||Math.abs(o)>=6)&&ne({id:e.id,row:t,dy:i})},onResponderRelease:l=>{const o=re.current;re.current=null,ne(null);const n=l.nativeEvent.pageX-(o?.x??0),r=l.nativeEvent.pageY-(o?.y??0),d=(0,s.releaseOn)(he.current,e.id,!(Math.abs(n)<6&&Math.abs(r)<6),Date.now());if(ce(d.arm),'select'===d.action){ae('');try{i.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void ae('');if('none'===d.action)return;ae('');const h=A.findIndex(e=>e.key===t),f=Math.max(0,Math.min(A.length-1,h+Math.round(r/P))),g=(0,b.dragTables)(e.table,t,A[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),ae(`${(0,p.privName)(e,S)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,u.hm)((0,c.startOf)(e))}`)):Math.abs(n)>=6&&Math.abs(r)

=600||se?(0,y.jsx)(r.default,{style:{flex:U>=600?1:void 0,flexBasis:U>=600?void 0:'100%',minWidth:0},children:(0,y.jsx)(x.T,{size:13,center:U<600,colour:g.colours.muted,numberOfLines:U>=600?1:2,testID:"timeline-hint",children:se||s.SELECT_HINT})}):null,L?.length?(0,y.jsxs)(x.Row,{gap:4,children:[(0,y.jsx)(r.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:13,children:"Blocked"})]}):null,(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.goldLight,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(r.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))})}),(0,y.jsx)(r.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})})]}):null]}):(0,y.jsxs)(y.Fragment,{children:[_?(0,y.jsxs)(r.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,y.jsx)(r.default,{style:{alignSelf:'center'},children:(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'})}),(0,y.jsx)(x.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),se?(0,y.jsx)(r.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:se})}):null]}):(0,y.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(x.Row,{gap:8,children:[(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'}),(0,y.jsx)(r.default,{style:{flex:1,minWidth:0},children:(0,y.jsx)(x.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,y.jsx)(r.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{size:13,colour:g.colours.goldLight,children:se})})]}),(0,y.jsxs)(x.T,{center:!0,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})]}):null,L?.length?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(r.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:14,children:"Blocked"})]}):null]}),(0,y.jsxs)(r.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-U)>1&&X(t)},style:{flex:z?void 0:1,height:z,flexShrink:_?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,y.jsxs)(r.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:g.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,y.jsx)(r.default,{testID:"timeline-table-head",style:{width:M,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:(0,y.jsx)(x.T,{size:13,weight:"semibold",colour:g.colours.goldLight,children:"Table"})}),(0,y.jsxs)(r.default,{style:{width:q*J,flexShrink:0},children:[Array.from({length:Math.ceil(q/4)},(e,t)=>(0,y.jsx)(r.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*J,top:26,bottom:0,width:1,backgroundColor:g.colours.border}},t)),Array.from({length:Math.ceil(q/4)},(e,t)=>{const l=4*t*J,o=Math.max(0,Math.min(q*J-56,l-28));return(0,y.jsx)(r.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:o,width:56,top:4,height:22,justifyContent:'center'},children:(0,y.jsx)(x.T,{size:15,weight:"semibold",colour:g.colours.goldLight,center:!0,numberOfLines:1,children:(0,u.hm)((0,u.addMins)(te,60*t))})},`l${t}`)})]})]}),(0,y.jsxs)(n.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-N)>1&&F(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,y.jsx)(r.default,{style:{width:M,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:A.map((e,t,l)=>(0,y.jsx)(r.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:P,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:H?(0,y.jsxs)(r.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,y.jsx)(r.default,{style:{width:q*J,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!he.current,onResponderRelease:()=>{ce(null),ae('')},children:(0,y.jsxs)(r.default,{style:{width:q*J},children:[(L??[]).map((e,t)=>{const l=Math.max(0,oe(e.from)),o=Math.min(q*J,oe(e.to));return o<=l?null:(0,y.jsx)(r.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,u.hm)(e.from)} to ${(0,u.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:o-l,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),A.map((e,o,i)=>{return(0,y.jsxs)(r.default,{testID:`tl-row-${e.key}`,style:{height:P,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:o>0&&i[o-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(q/4)},(e,l)=>(0,y.jsx)(r.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*J,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),R?.includes(e.key)?(0,y.jsx)(r.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,y.jsx)(x.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,W.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)te)).map(t=>{const o=ie?.id===t.id&&ie.row===e.key?ie:null,i=oe((0,c.startOf)(t)),n=Math.max(0,Math.min(q*J-44,i)),a=Math.min(q*J,oe((0,u.addMins)((0,c.startOf)(t),(0,c.durOf)(t,I)))),d=Math.min(q*J-n,Math.max(44,a-Math.max(0,i))),b=Y.has(t.id),j=de?.id===t.id;return(0,y.jsx)(r.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,p.privName)(t,S)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,u.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,I)} min${b?', clash':''}${(0,h.depositView)(t,!0)?`, ${(0,h.depositView)(t,!0).a11y}`:''}${j?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:j},accessibilityHint:j?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:j?'1':'0'},...be(t,e.key),style:[{position:'absolute',left:n,top:(H?2:4)+(o?o.dy:0),width:d,height:P-(H?4:8),borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:j?3:b?2.5:1,borderColor:j?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...j?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:o?40:j?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:j?'ns-resize':'pointer',touchAction:j?'none':'pan-y'},o?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,y.jsx)(x.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:H?1:2,style:{lineHeight:16},children:d<100?H&&d>=70?`${t.partySize} \xb7 ${(0,u.hm)((0,c.startOf)(t))}`:String(t.partySize):(0,y.jsxs)(y.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key||H?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,p.privName)(t,S)," \xb7 ",t.partySize,H?' \xb7 ':'\n',(0,u.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,h.depositView)(t,!0)?d>=150?` \xb7 ${(0,h.depositView)(t,!0).label}`:'Deposit paid'===(0,h.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&me>=0&&me<=q*J?(0,y.jsx)(r.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:me,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,y.jsx)(r.default,{style:{position:'absolute',top:0,left:Math.max(-me,Math.min(-18,q*J-me-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,y.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,u.hm)(C)})})}):null]})})]}),ue?(0,y.jsx)(r.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,y.jsxs)(x.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,y.jsx)(r.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,p.privName)(ue,S)} ${s.SELECTED_A11Y}`,children:(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,p.privName)(ue,S)," \xb7 ",ue.partySize]})}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{ce(null),v(ue)}}),(0,y.jsx)(x.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{ce(null),ae('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=_r(_d[2]),i=e(_r(_d[3]));_r(_d[4]);var n=e(_r(_d[5])),r=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),u=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),x=_r(_d[16]),p=_r(_d[17]),y=_r(_d[18]);const j=30,k=52,w=28,M=120},1342,[828,860,34,281,236,295,102,1128,874,1025,1100,14,858,1118,1343,821,794,1344,25]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return w}}),_e.Timeline=function({plan:e,bookings:T,now:C,privacy:S,onOpen:v,turnBase:I,t0:D,t1:z,height:E,pauses:$,blockedTables:L,hideNow:R,compact:_=!1,fit:O=!1}){const B=(0,o.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),W=T.filter(e=>!['cancelled','noshow'].includes(e.status)),[N,A]=(0,o.useState)(0),F=O&&!W.some(e=>!e.table)?B.filter(e=>'__none'!==e.key):B,P=O&&N>0?Math.max(w,Math.min(k,Math.floor(N/Math.max(1,F.length)))):k,H=P<44,Y=(0,o.useMemo)(()=>(0,c.clashes)(W,I),[W,I]),V=Math.max(1,Math.ceil((z.getTime()-D.getTime())/9e5)),[U,X]=(0,o.useState)(0),G=Math.max(30,U-M-2),q=Math.min(V,Math.max(1,Math.floor(G/j))),J=U>0?Math.max(j,Math.floor(G/q*100)/100):j,[K,Q]=(0,o.useState)(0),Z=Math.max(0,V-q),ee=Math.max(0,Math.min(Z,K)),te=(0,u.addMins)(D,15*ee),le=(0,u.addMins)(te,15*q),oe=e=>(e.getTime()-te.getTime())/9e5*J,[ie,re]=(0,o.useState)(null),ne=(0,o.useRef)(null);(0,o.useEffect)(()=>{const e=R?0:Math.floor((C.getTime()-D.getTime())/9e5)-Math.floor(q/3);Q(Math.max(0,Math.min(Z,e)))},[D.getTime(),q,Z,R]);const[se,ae]=(0,o.useState)(''),[de,ce]=(0,o.useState)(null),he=(0,o.useRef)(null);he.current=de,(0,o.useEffect)(()=>{if(!de)return;const e=setTimeout(()=>ce(null),s.ARM_MS);return()=>clearTimeout(e)},[de]);const ue=de?W.find(e=>e.id===de.id):void 0,be=(t,l)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(he.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(he.current,t.id,Date.now()),onResponderGrant:e=>{ne.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!ne.current||!(0,s.isArmed)(he.current,t.id,Date.now()))return;const o=e.nativeEvent.pageX-ne.current.x,i=e.nativeEvent.pageY-ne.current.y;(Math.abs(i)>=6||Math.abs(o)>=6)&&re({id:t.id,row:l,dy:i})},onResponderRelease:o=>{const r=ne.current;ne.current=null,re(null);const n=o.nativeEvent.pageX-(r?.x??0),d=o.nativeEvent.pageY-(r?.y??0),h=(0,s.releaseOn)(he.current,t.id,!(Math.abs(n)<6&&Math.abs(d)<6),Date.now());if(ce(h.arm),'select'===h.action){ae('');try{i.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void ae('');if('none'===h.action)return;ae('');const f=F.findIndex(e=>e.key===l),g=Math.max(0,Math.min(F.length-1,f+Math.round(d/P))),x=(0,b.dragTables)(t.table,l,F[g].key);if(x){a.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,b.overCapacityAsk)(x.split('+'),(0,b.seatsOf)(e,x.split('+')).total,t.partySize);ae(`${(0,p.privName)(t,S)} \u2192 ${(0,b.tablesWords)(x.split('+'))}, still ${(0,u.hm)((0,c.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`)}else Math.abs(n)>=6&&Math.abs(d)

=600||se?(0,y.jsx)(n.default,{style:{flex:U>=600?1:void 0,flexBasis:U>=600?void 0:'100%',minWidth:0},children:(0,y.jsx)(x.T,{size:13,center:U<600,colour:g.colours.muted,numberOfLines:U>=600?1:2,testID:"timeline-hint",children:se||s.SELECT_HINT})}):null,$?.length?(0,y.jsxs)(x.Row,{gap:4,children:[(0,y.jsx)(n.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:13,children:"Blocked"})]}):null,(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.goldLight,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(n.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))})}),(0,y.jsx)(n.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})})]}):null]}):(0,y.jsxs)(y.Fragment,{children:[_?(0,y.jsxs)(n.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,y.jsx)(n.default,{style:{alignSelf:'center'},children:(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'})}),(0,y.jsx)(x.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),se?(0,y.jsx)(n.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:se})}):null]}):(0,y.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(x.Row,{gap:8,children:[(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'}),(0,y.jsx)(n.default,{style:{flex:1,minWidth:0},children:(0,y.jsx)(x.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,y.jsx)(n.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{size:13,colour:g.colours.goldLight,children:se})})]}),(0,y.jsxs)(x.T,{center:!0,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})]}):null,$?.length?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(n.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:14,children:"Blocked"})]}):null]}),(0,y.jsxs)(n.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-U)>1&&X(t)},style:{flex:E?void 0:1,height:E,flexShrink:_?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,y.jsxs)(n.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:g.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,y.jsx)(n.default,{testID:"timeline-table-head",style:{width:M,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:(0,y.jsx)(x.T,{size:13,weight:"semibold",colour:g.colours.goldLight,children:"Table"})}),(0,y.jsxs)(n.default,{style:{width:q*J,flexShrink:0},children:[Array.from({length:Math.ceil(q/4)},(e,t)=>(0,y.jsx)(n.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*J,top:26,bottom:0,width:1,backgroundColor:g.colours.border}},t)),Array.from({length:Math.ceil(q/4)},(e,t)=>{const l=4*t*J,o=Math.max(0,Math.min(q*J-56,l-28));return(0,y.jsx)(n.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:o,width:56,top:4,height:22,justifyContent:'center'},children:(0,y.jsx)(x.T,{size:15,weight:"semibold",colour:g.colours.goldLight,center:!0,numberOfLines:1,children:(0,u.hm)((0,u.addMins)(te,60*t))})},`l${t}`)})]})]}),(0,y.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-N)>1&&A(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,y.jsx)(n.default,{style:{width:M,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:F.map((e,t,l)=>(0,y.jsx)(n.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:P,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:H?(0,y.jsxs)(n.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,y.jsx)(n.default,{style:{width:q*J,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!he.current,onResponderRelease:()=>{ce(null),ae('')},children:(0,y.jsxs)(n.default,{style:{width:q*J},children:[($??[]).map((e,t)=>{const l=Math.max(0,oe(e.from)),o=Math.min(q*J,oe(e.to));return o<=l?null:(0,y.jsx)(n.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,u.hm)(e.from)} to ${(0,u.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:o-l,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),F.map((e,o,i)=>{return(0,y.jsxs)(n.default,{testID:`tl-row-${e.key}`,style:{height:P,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:o>0&&i[o-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(q/4)},(e,l)=>(0,y.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*J,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),L?.includes(e.key)?(0,y.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,y.jsx)(x.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(r=e.key,W.filter(e=>('__none'===r?!e.table:(0,d.tablesOf)(e.table).includes(r))&&(0,c.startOf)(e)te)).map(t=>{const o=ie?.id===t.id&&ie.row===e.key?ie:null,i=oe((0,c.startOf)(t)),r=Math.max(0,Math.min(q*J-44,i)),a=Math.min(q*J,oe((0,u.addMins)((0,c.startOf)(t),(0,c.durOf)(t,I)))),d=Math.min(q*J-r,Math.max(44,a-Math.max(0,i))),b=Y.has(t.id),j=de?.id===t.id;return(0,y.jsx)(n.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,p.privName)(t,S)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,u.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,I)} min${b?', clash':''}${(0,h.depositView)(t,!0)?`, ${(0,h.depositView)(t,!0).a11y}`:''}${j?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:j},accessibilityHint:j?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:j?'1':'0'},...be(t,e.key),style:[{position:'absolute',left:r,top:(H?2:4)+(o?o.dy:0),width:d,height:P-(H?4:8),borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:j?3:b?2.5:1,borderColor:j?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...j?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:o?40:j?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:j?'ns-resize':'pointer',touchAction:j?'none':'pan-y'},o?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,y.jsx)(x.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:H?1:2,style:{lineHeight:16},children:d<100?H&&d>=70?`${t.partySize} \xb7 ${(0,u.hm)((0,c.startOf)(t))}`:String(t.partySize):(0,y.jsxs)(y.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key||H?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,p.privName)(t,S)," \xb7 ",t.partySize,H?' \xb7 ':'\n',(0,u.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,h.depositView)(t,!0)?d>=150?` \xb7 ${(0,h.depositView)(t,!0).label}`:'Deposit paid'===(0,h.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var r}),!R&&me>=0&&me<=q*J?(0,y.jsx)(n.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:me,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,y.jsx)(n.default,{style:{position:'absolute',top:0,left:Math.max(-me,Math.min(-18,q*J-me-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,y.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,u.hm)(C)})})}):null]})})]}),ue?(0,y.jsx)(n.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,y.jsxs)(x.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,y.jsx)(n.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,p.privName)(ue,S)} ${s.SELECTED_A11Y}`,children:(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,p.privName)(ue,S)," \xb7 ",ue.partySize]})}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{ce(null),v(ue)}}),(0,y.jsx)(x.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{ce(null),ae('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=_r(_d[2]),i=e(_r(_d[3]));_r(_d[4]);var r=e(_r(_d[5])),n=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),u=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),x=_r(_d[16]),p=_r(_d[17]),y=_r(_d[18]);const j=30,k=52,w=28,M=120},1342,[828,860,34,281,236,295,102,1128,874,1025,1100,14,858,1118,1343,821,794,1344,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1343,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1344,[]); __d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1345,[5,828,34,283,336,236,402,102,426,821,873,794,1026,1000,1326,1346,2,1347,1348,874,858,25]); @@ -1432,10 +1432,10 @@ __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.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1349,[860,14,1025,1350]); __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])},1350,[861]); __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])},1351,[34,102,797,821,25]); -__d(function(_g,r,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:S,name:D,view:P,now:I,onClose:L,onDetails:v,onDone:N,otherDay:T,turnBase:W=90,onPickOnPlan:H}){const[_,z]=(0,l.useState)(!1),M=(0,j.useBookingWrite)(),[A,G]=(0,l.useState)(!1),[O,F]=(0,l.useState)(!1),[R,q]=(0,l.useState)(!1),E=(0,k.guestRowText)(S,{name:D,seated:'seated'===S.status&&!T}),J='seated'===S.status&&!T,K=S.table?J?`Seated \xb7 ${(0,a.tableCardLabel)(S.table)}`:(0,a.tableCardLabel)(S.table):J?'Seated':'No table yet',Q=T?[]:(0,y.guestActions)(S,D,P,I).filter(e=>'details'!==e.id),U=(0,g.tableActions)(S,D),V={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},X=async t=>{const s={...S,table:t};t!==S.table&&await u.repo.bookings.update(S.id,{table:t}),await(0,b.seatBookingNow)(e,s),N(`${D} seated at ${(0,y.tableWords)(t)}.`),L()},Y=async t=>'seat'===t.id&&t.table?X(t.table):'pick'===t.id?z(e=>!e):'details'===t.id?(L(),v(S)):'finished'===t.id?('seated'===S.status?await(0,b.finishBookingNow)(e,S):await u.repo.bookings.setStatus(S.id,'finished'),N('seated'===S.status&&S.table?`${D} finished. ${(0,y.tableWords)(S.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),L()):'noshow'===t.id?(await u.repo.bookings.setStatus(S.id,'noshow'),N(`${D} marked as a no-show.`),L()):void 0,Z=_?(0,y.freeTablesNow)(P,S.partySize).slice(0,8):[];if(A)return(0,w.jsx)(h.TablePicker,{rid:e,booking:S,name:D,turnBase:W,onClose:L,onSaved:N,onPickOnPlan:H?e=>{L(),H(S,e)}:void 0});if(O)return(0,w.jsx)(f.CancelWalkInConfirm,{rid:e,b:S,onClose:L,onDone:N});if(R)return(0,w.jsx)(p.CancelBookingConfirm,{rid:e,b:S,name:D,onClose:L,onDone:N});const ee=[...Q];return(0,w.jsxs)(c.Sheet,{visible:!0,onClose:L,title:`${S.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,w.jsx)(o.default,{accessible:!0,accessibilityLabel:E.a11y,testID:"guest-actions-summary",children:(0,w.jsxs)(c.T,{size:18,children:[E.people,E.deposit?(0,w.jsxs)(c.T,{size:18,weight:"semibold",colour:E.depositWarn?x.colours.amber:x.colours.goldLight,children:[" \xb7 ",E.deposit]}):null," \xb7 ",K]})}),(0,w.jsx)(t.ShowNumberButton,{b:S}),(0,w.jsxs)(o.default,{style:{gap:10},children:[ee.map(e=>(0,w.jsxs)(n.default.Fragment,{children:[(0,w.jsx)(c.Button,{kind:B(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:M.hint,disabled:'details'!==e.id&&!M.ok,testID:`guest-act-${e.id}`,onPress:()=>Y(e),style:C}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,w.jsxs)(c.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&_?(0,w.jsxs)(o.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Z.length?(0,w.jsx)(c.Muted,{children:"No free tables right now."}):null,Z.map(e=>(0,w.jsx)(c.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:M.hint,disabled:!M.ok,testID:`guest-pick-${e.table}`,onPress:()=>X(e.table),style:C},e.table))]}):null]},e.id)),U.map(t=>(0,w.jsx)(c.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:M.hint,disabled:!M.ok,testID:`guest-act-${t.id}`,style:C,onPress:async()=>{if(M.ok){if('assign'===t.id)return G(!0);await(0,h.saveBookingTables)(e,S,[]),N(`${D}: table taken off.`),L()}}},t.id)),!T&&(0,f.canCancelWalkIn)(S)?(0,w.jsx)(c.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${S.ref}, ${S.partySize} Covers`,accessibilityHint:M.hint,disabled:!M.ok,testID:"guest-act-cancelwalkin",onPress:()=>F(!0),style:C}):null,(0,$.canCancelBooking)(S)?(0,w.jsx)(c.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${S.time}, ${S.partySize} Covers`,accessibilityHint:M.hint,disabled:!M.ok,testID:"guest-act-cancelbooking",onPress:()=>q(!0),style:C}):null,(0,w.jsx)(c.Button,{kind:"ghost",label:V.label,accessibilityLabel:V.a11y,testID:"guest-act-details",onPress:()=>Y(V),style:C})]}),(0,w.jsx)(c.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:L,style:C})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=e(l),o=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),j=r(d[16]),w=r(d[17]);const C={minHeight:64},B=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1352,[1353,860,1025,34,102,794,1119,874,1355,1349,1118,1116,1132,1133,1134,821,1318,25]); +__d(function(_g,r,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:D,name:v,view:I,now:P,onClose:L,onDetails:z,onDone:H,otherDay:N,turnBase:T=90,onPickOnPlan:W,onEdit:_}){const[A,E]=(0,l.useState)(null),[F,M]=(0,l.useState)(!1),R=(0,w.useBookingWrite)(),[G,O]=(0,l.useState)(!1),[U,q]=(0,l.useState)(!1),[J,K]=(0,l.useState)(!1),Q=(0,k.guestRowText)(D,{name:v,seated:'seated'===D.status&&!N}),V='seated'===D.status&&!N,X=D.table?V?`Seated \xb7 ${(0,a.tableCardLabel)(D.table)}`:(0,a.tableCardLabel)(D.table):V?'Seated':'No table yet',Y=N?[]:(0,y.guestActions)(D,v,I,P).filter(e=>'details'!==e.id),Z=(0,g.tableActions)(D,v),ee={id:'details',label:'Guest details',a11y:`Guest details, ${v}`},te=async t=>{const s={...D,table:t};t!==D.table&&await u.repo.bookings.update(D.id,{table:t}),await(0,b.seatBookingNow)(e,s),H(`${v} seated at ${(0,y.tableWords)(t)}.`),L()},se=async t=>'seat'===t.id&&t.table?te(t.table):'pick'===t.id?M(e=>!e):'details'===t.id?(L(),z(D)):'finished'===t.id?('seated'===D.status?await(0,b.finishBookingNow)(e,D):await u.repo.bookings.setStatus(D.id,'finished'),H('seated'===D.status&&D.table?`${v} finished. ${(0,y.tableWords)(D.table).replace(/^t/,'T')} needs clearing.`:`${v} finished.`),L()):'noshow'===t.id?(await u.repo.bookings.setStatus(D.id,'noshow'),H(`${v} marked as a no-show.`),L()):void 0,ae=F?(0,y.freeTablesNow)(I,D.partySize,!0).slice(0,12):[];if(G)return(0,C.jsx)(p.TablePicker,{rid:e,booking:D,name:v,turnBase:T,onClose:L,onSaved:H,onPickOnPlan:W?e=>{L(),W(D,e)}:void 0});if(U)return(0,C.jsx)(f.CancelWalkInConfirm,{rid:e,b:D,onClose:L,onDone:H});if(J)return(0,C.jsx)($.CancelBookingConfirm,{rid:e,b:D,name:v,onClose:L,onDone:H});const ie=[...Y];return(0,C.jsxs)(c.Sheet,{visible:!0,onClose:L,title:`${D.time} \xb7 ${v}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(o.default,{accessible:!0,accessibilityLabel:Q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(c.T,{size:18,children:[Q.people,Q.deposit?(0,C.jsxs)(c.T,{size:18,weight:"semibold",colour:Q.depositWarn?j.colours.amber:j.colours.goldLight,children:[" \xb7 ",Q.deposit]}):null," \xb7 ",X]})}),(0,C.jsx)(t.ShowNumberButton,{b:D}),(0,C.jsxs)(o.default,{style:{gap:10},children:[ie.map(e=>(0,C.jsxs)(n.default.Fragment,{children:[(0,C.jsx)(c.Button,{kind:B(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:R.hint,disabled:'details'!==e.id&&!R.ok,testID:`guest-act-${e.id}`,onPress:()=>se(e),style:S}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(c.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&F?(0,C.jsxs)(o.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ae.length?(0,C.jsx)(c.Muted,{children:"No free tables right now."}):null,A?(0,C.jsxs)(o.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:A.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[(0,C.jsx)(c.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:A.ask}),(0,C.jsx)(c.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!R.ok,accessibilityHint:R.hint,onPress:()=>{const e=A.table;E(null),te(e)},style:S}),(0,C.jsx)(c.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>E(null),style:S})]}):ae.map(e=>(0,C.jsx)(c.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,g.overCapacityAsk)([e.table],e.seats,D.partySize);t?E({table:e.table,ask:t}):te(e.table)},style:S},e.table))]}):null]},e.id)),Z.map(t=>(0,C.jsx)(c.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:R.hint,disabled:!R.ok,testID:`guest-act-${t.id}`,style:S,onPress:async()=>{if(R.ok){if('assign'===t.id)return O(!0);await(0,p.saveBookingTables)(e,D,[]),H(`${v}: table taken off.`),L()}}},t.id)),!N&&(0,f.canCancelWalkIn)(D)?(0,C.jsx)(c.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${D.ref}, ${D.partySize} Covers`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-cancelwalkin",onPress:()=>q(!0),style:S}):null,(0,x.canCancelBooking)(D)?(0,C.jsx)(c.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${v}, ${D.time}, ${D.partySize} Covers`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-cancelbooking",onPress:()=>K(!0),style:S}):null,!_||D.walkIn||['cancelled','noshow'].includes(D.status)||N&&!(D.date>=(0,h.ymd)(P))?null:(0,C.jsx)(c.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${v}, ${D.time}. Date, time, covers, table, anything.`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-edit",onPress:()=>{L(),_(D)},style:S}),(0,C.jsx)(c.Button,{kind:"ghost",label:ee.label,accessibilityLabel:ee.a11y,testID:"guest-act-details",onPress:()=>se(ee),style:S})]}),(0,C.jsx)(c.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:L,style:S})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=e(l),o=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),$=r(d[14]),x=r(d[15]),j=r(d[16]),w=r(d[17]),C=r(d[18]);const S={minHeight:64},B=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1352,[1353,860,1025,34,102,794,1119,874,1355,1349,1118,858,1116,1132,1133,1134,821,1318,25]); __d(function(g,r,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)(h.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(h.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=h.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,h.canShowNumber)(e,!y||(0,b.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 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,h.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,h.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]),b=r(d[7]),h=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1353,[34,379,402,102,874,1003,892,1023,1354,872,821,794,25]); __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')}`}},1354,[]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1355,[1025,1100]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a,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.maxSeatsc[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1355,[1025,1100]); __d(function(g,_r,_i,_a,_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 I}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const l=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,n.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,C.jsxs)(m.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,C.jsx)(x.T,{size:13,weight:"semibold",colour:T.colours.gold,children:"NEXT HOUR"}),(0,C.jsxs)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,C.jsx)(x.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,C.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?T.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?T.colours.amber:'#3C78B5'},children:[(0,C.jsx)(x.T,{size:13,weight:"semibold",children:e.time}),(0,C.jsxs)(x.T,{size:13,children:[(0,p.privName)(e,s)," \xb7 ",e.partySize]}),(0,C.jsx)(x.T,{size:12,colour:T.colours.muted,accessibilityLabel:e.table?(0,a.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,a.tableNumbers)(e.table)}`:'no table'}),(0,C.jsx)(x.T,{size:12,colour:t<0?T.colours.amber:T.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,C.jsx)(x.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,C.jsx)(x.T,{size:12,children:v.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,C.jsxs)(x.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,C.jsxs)(x.Row,{gap:4,children:[(0,C.jsx)(m.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:v.STATUS[e].colour}}),(0,C.jsx)(x.T,{size:12,colour:T.colours.muted,children:v.STATUS[e].label})]},e)),(0,C.jsx)(x.T,{size:12,colour:T.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,u.useState)(20);return(0,u.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,u.useEffect)(()=>{l<=0&&s()},[l]),(0,C.jsxs)(x.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,C.jsx)(x.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,C.jsx)(x.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return B}}),_e.TableSheet=function({rid:e,name:t,view:s,plan:i,todays:c,now:h,privacy:w,turnBase:S,onClose:I,onWalkIn:B,onMove:D,onDetails:z}){const M=s[t],N=j.useFloor.getState(),[P,R]=(0,u.useState)(!1),[L,A]=(0,u.useState)(M?.note??''),[W,O]=(0,u.useState)(!1),H=(0,$.useBookingWrite)();if(!M)return null;const F=M.booking,E=['seated','mains','dessert','bill'].includes(M.status),_=c.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,n.minsBetween)(h,(0,v.startOf)(e)))-Math.abs((0,n.minsBetween)(h,(0,v.startOf)(t)))),G=e=>e.partySize<=M.table.maxSeats,U=M.next??M.due,V=(0,v.turnFor)(M.covers||M.table.maxSeats,S);return(0,C.jsxs)(x.Sheet,{visible:!0,onClose:I,title:`${(0,a.tableNumbers)(t)} \xb7 ${v.STATUS[M.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===M.status?(0,C.jsx)(x.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{j.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,C.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(x.Badge,{kind:"neutral",label:`${M.table.minSeats}\u2013${M.table.maxSeats} seats`}),F?(0,C.jsx)(x.Badge,{kind:"gold",label:`${(0,p.privName)(F,w)} \xb7 ${F.partySize} \xb7 ${M.seatedMins}m`}):null,F?(0,C.jsx)(x.Badge,{kind:M.seatedMins>(0,v.durOf)(F,S)?'red':'neutral',label:`Turn about ${(0,v.durOf)(F,S)} min \xb7 free about ${(0,n.hm)((0,v.endOf)(F,S))} (est.)`}):(0,C.jsx)(x.Badge,{kind:"neutral",label:`Turn estimate for ${M.table.maxSeats}: about ${V} min`}),M.next?(0,C.jsx)(x.Badge,{kind:"blue",label:`Next: ${M.next.time} ${(0,p.privName)(M.next,w)} (${M.next.partySize})`}):null,M.allergy?(0,C.jsx)(x.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,C.jsx)(k.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,C.jsx)(o.BookingTableButton,{rid:e,booking:F??U,turnBase:S,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,C.jsx)(r.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,C.jsx)(r.ReinstateWalkInButton,{rid:e,b:F,today:(0,n.ymd)(new Date)}):null,!E&&'blocked'!==M.status&&U?(0,C.jsx)(x.Button,{label:`Seat ${(0,p.privName)(U,w)}`,accessibilityLabel:`Seat ${(0,p.privName)(U,w)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await y.repo.bookings.update(s.id,{table:s.table&&(0,j.tablesOf)(s.table).includes(t)?s.table:t}),await y.repo.bookings.setStatus(s.id,'seated'),(0,f.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==M.status&&U&&(0,v.startOf)(U)<=h?(0,C.jsxs)(x.Row,{gap:8,children:[(0,C.jsx)(x.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,p.privName)(U,w)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await y.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,C.jsx)(x.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,p.privName)(U,w)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await y.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===M.status?null:(0,C.jsxs)(x.Row,{gap:8,children:[(0,C.jsx)(x.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===M.status&&j.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,C.jsx)(x.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,C.jsxs)(m.default,{style:{gap:6},children:[0===_.length?(0,C.jsx)(x.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,C.jsxs)(b.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,p.privName)(s,w)} ${s.time}`,onPress:async()=>{await y.repo.bookings.update(s.id,{table:t}),await y.repo.bookings.setStatus(s.id,'seated'),(0,f.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?T.colours.border:T.colours.amber,backgroundColor:T.colours.surface2},children:[(0,C.jsxs)(x.T,{weight:"semibold",children:[s.time," \xb7 ",(0,p.privName)(s,w)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,a.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,C.jsxs)(x.T,{size:12,colour:T.colours.amber,children:["Bigger than this table (",M.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(x.T,{size:14,colour:T.colours.muted,children:"Course / status"}),(0,C.jsx)(x.Row,{wrap:!0,gap:6,children:v.STAGES.map(s=>(0,C.jsx)(x.Chip,{label:v.STAGE_LABEL[s],selected:M.status===s,onPress:()=>N.setLive(e,t,{stage:s})},s))}),(0,C.jsxs)(x.Row,{wrap:!0,gap:8,children:[F?(0,C.jsx)(x.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,C.jsx)(x.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await y.repo.bookings.setStatus(F.id,'finished'),N.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,C.jsxs)(x.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(x.Button,{kind:"secondary",label:'blocked'===M.status?'Unblock table':'Block table',onPress:()=>{N.setLive(e,t,{blocked:'blocked'!==M.status}),I()},testID:"block-table"}),(0,C.jsx)(x.Button,{kind:"ghost",label:M.note?'Edit note':'Note',onPress:()=>R(!P)}),F||U?(0,C.jsx)(x.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),z(F??U)},testID:"guest-details"}):null]}),P?(0,C.jsxs)(x.Row,{gap:6,children:[(0,C.jsx)(l.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[x.styles.input,{flex:1}]}),(0,C.jsx)(x.Button,{small:!0,label:"Save",onPress:()=>{N.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,w?(0,C.jsx)(x.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,i.joins.some(e=>e.tables.includes(t))?(0,C.jsxs)(x.Muted,{children:["Joins with ",i.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",i.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:a,todays:i,waiting:o,now:r,privacy:c,busy:h,onToast:w}){const[k,$]=(0,u.useState)(''),[B,D]=(0,u.useState)(2),z=(0,j.useFloor)(e=>e.smsLog);return(0,C.jsxs)(I,{title:`Waitlist (${o.length})`,right:(0,C.jsxs)(x.Muted,{children:["new party about ",(0,S.estimateWait)(o.length+1,t.settings.turnMins,h)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,C.jsx)(x.Muted,{children:"Nobody waiting."}):null,o.map((l,o)=>{const u=(0,v.suggestTable)(s,i,a,l.partySize,r,(0,v.turnFor)(l.partySize,t.settings.turnMins)),b=(0,S.estimateWait)(o+1,t.settings.turnMins,h),k=Math.max(0,(0,n.minsBetween)(new Date(l.joinedAt),r)),$=z.find(t=>t.rid===e&&t.text.includes(`#${l.number} `));return(0,C.jsxs)(m.default,{style:{backgroundColor:T.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(x.T,{weight:"semibold",children:["#",l.number," ",(0,p.pv)(l.name,c)," \xb7 ",l.partySize]}),(0,C.jsxs)(x.T,{size:12,colour:k>b?T.colours.amber:T.colours.muted,children:["waited ",k,"m \xb7 quoted about ",b,"m"]})]}),u?(0,C.jsxs)(x.T,{size:12,colour:u.clashes?T.colours.amber:T.colours.ok,children:["Best table: ",u.table," (",u.why,")"]}):(0,C.jsx)(x.T,{size:12,colour:T.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,C.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(x.Button,{small:!0,label:$||'notified'===l.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${l.number}`,onPress:()=>{j.useFloor.getState().logSms(e,r.toISOString(),`#${l.number} ${l.partySize}: Your table at ${t.name} is ready.`),y.repo.waitlist.setStatus(l.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),u?(0,C.jsx)(x.Button,{small:!0,kind:"success",label:`Seat at ${u.table}`,onPress:async()=>{await y.repo.waitlist.setStatus(l.id,'seated'),await y.repo.bookings.seatWalkIn(e,l.partySize,u.table,`From waitlist #${l.number}`),(0,f.resetTableLive)(e,u.table),w(`Waitlist #${l.number} seated at ${u.table}`)}}):null,(0,C.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>y.repo.waitlist.setStatus(l.id,'removed')})]}),'notified'===l.status?(0,C.jsx)(x.Badge,{kind:"ok",label:`Told table ready${$?` ${(0,n.hm)(new Date($.at))}`:''} `}):null]},l.id)}),(0,C.jsxs)(x.Row,{gap:6,children:[(0,C.jsx)(l.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:k,onChangeText:$,style:[x.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,C.jsx)(b.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:T.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(x.T,{weight:"bold",colour:T.colours.gold,children:B})}),(0,C.jsx)(x.Button,{small:!0,label:"Add",disabled:k.trim().length<2,onPress:()=>{y.repo.waitlist.join(e,k.trim(),B),$('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:l,now:a,walkInCount:o,staffOn:r,onSummary:u}){const c=o+l.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)),f=h?c/h:1,p=f>=1.1?T.colours.amber:f>=.85?T.colours.ok:T.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,n.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,n.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,v.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),k=y.filter(e=>e.future&&e.covers>j),S=t.nextHour?.covers??0,$=Math.ceil(S/16);return(0,C.jsxs)(I,{title:"Pace & kitchen",right:(0,C.jsx)(x.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,C.jsxs)(m.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${h}`,style:{gap:4},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{size:14,children:"Covers so far"}),(0,C.jsxs)(x.T,{weight:"bold",colour:p,children:[c," ",(0,C.jsxs)(x.T,{size:13,colour:T.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,C.jsx)(m.default,{style:{height:10,borderRadius:5,backgroundColor:(0,s.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,C.jsx)(m.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,C.jsxs)(x.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,i.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,C.jsx)(x.T,{size:13,colour:T.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,C.jsx)(m.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,C.jsxs)(m.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,C.jsx)(x.T,{size:10,colour:T.colours.muted,children:e.covers||''}),(0,C.jsx)(m.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?T.colours.red:e.future?'#6B5A3A':T.colours.gold}}),(0,C.jsx)(x.T,{size:9,colour:4===t?T.colours.gold:T.colours.muted,children:(0,n.hm)(e.from)})]},t))}),k.map(e=>(0,C.jsxs)(x.T,{size:13,colour:T.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,n.hm)(e.from),"\u2013",(0,n.hm)((0,n.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),$>r?(0,C.jsxs)(x.T,{size:13,colour:T.colours.amber,children:["\u26a0 Next hour about ",S," Covers with ",r," on: about ",$-r," more on the floor suggested."]}):(0,C.jsxs)(x.T,{size:13,colour:T.colours.ok,children:["Staffing looks OK for the next hour (",r," on)."]}),(0,C.jsx)(x.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),r=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,n.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,j.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{children:e}),(0,C.jsx)(x.T,{weight:"semibold",children:t})]},e);return(0,C.jsxs)(x.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(r)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,C.jsx)(x.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return j.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]),c=_r(d[9]);_r(d[10]);var b=e(_r(d[11])),h=e(_r(d[12])),m=e(_r(d[13])),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]),C=_r(d[25]);const I=({title:e,right:t,children:s,testID:l})=>(0,C.jsxs)(m.default,{testID:l,style:{backgroundColor:T.colours.surface,borderRadius:14,borderWidth:1,borderColor:T.colours.border,padding:10,gap:6},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{weight:"semibold",colour:T.colours.gold,children:e}),t]}),s]});const B=e=>(0,C.jsxs)(m.default,{style:{gap:6},children:[(0,C.jsxs)(x.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,C.jsxs)(x.Muted,{children:[e.time," \xb7 ",e.table?(0,j.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,C.jsx)(k.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,C.jsx)(c.BookingNeeds,{b:e,big:!0}),e.notes?(0,C.jsxs)(x.T,{children:["Notes: ",e.notes]}):(0,C.jsx)(x.Muted,{children:"No notes."}),e.allergies.length?(0,C.jsx)(m.default,{style:{backgroundColor:T.colours.redBg,borderRadius:8,padding:8},children:(0,C.jsxs)(x.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,w.allergenLabel)(e.allergen)} \u2014 ${(0,w.severityLabel)(e.severity)}`).join('; ')]})}):(0,C.jsx)(x.Muted,{children:"No allergies declared."}),(0,C.jsx)(t.ShowNumberButton,{b:e},`num-${e.id}`)]});const D=!0},1356,[1353,828,827,860,1140,1114,1132,858,34,1102,236,402,295,102,794,1119,1344,874,1025,861,1112,1100,1303,821,1318,25]); __d(function(g,_r,_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.']}]},1357,[827,34,236,402,102,794,874,1025,1358,821,1359,1361,25]); __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1358,[]); @@ -1501,7 +1501,7 @@ __d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModu __d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4);return(0,f.jsxs)(n.default,{style:{gap:14},children:[g.map(t=>{const u=b.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(n.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(o.default,{testID:`more-page-${t.id}`,accessibilityRole:"button",accessibilityLabel:t.title,onPress:()=>e('more',t.id),style:({pressed:e})=>({padding:12,borderTopWidth:l?1:0,borderColor:i.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,f.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),t.badge?(0,f.jsx)(s.Badge,{kind:"gold",label:t.badge}):null,(0,f.jsx)(s.T,{colour:i.colours.muted,children:"\u203a"})]})},t.id))})]},t):null}),(0,f.jsxs)(s.Muted,{center:!0,children:['staff'===l?'Staff app preview':'Managers app'," \xb7 ",t.APP_VERSION," \xb7 ",'live'===c.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});var t=r(d[0]);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),s=r(d[4]),l=r(d[5]),i=r(d[6]),u=r(d[7]),c=r(d[8]),f=r(d[9]);const b=[],p=e=>{e.forEach(e=>{b.some(t=>t.id===e.id)||b.push(e)})},g=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const h=e=>b.find(t=>t.id===e)},1418,[1015,34,402,102,794,892,821,1084,988,25]); __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'}},1419,[]); __d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1420,[860,34,102,794,892,1025,858,1087,1085,988,1086,5,1000,821,25]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=E,_e.signInWithText=H,_e.SignInWithLink=V,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return!h.IS_CAR&&(v.includes(h.APP_VARIANT)&&!b.PITCH&&!e&&!M())},_e.InviteGate=function(){const[e,H]=(0,u.useState)(p.useSession.persist.hasHydrated()),[D,F]=(0,u.useState)(p.START_INVITE||p.START_HANDOVER?'checking':'done'),[W,L]=(0,u.useState)(null),[K,U]=(0,u.useState)(0),[G,Y]=(0,u.useState)(!1),[$,B]=(0,u.useState)(null),X=(0,p.useSession)(e=>e.meId),Q=(0,p.useSession)(e=>!X||!!e.welcomed[X]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>H(!0));return p.useSession.persist.hasHydrated()&&H(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_HANDOVER&&!p.START_INVITE&&!z){z=!0;const n=await(0,I.claimChromeHandover)(p.START_HANDOVER);if(!t)return;if('ok'===n.status&&n.id.staffRef){R(N(n.id.staffRef)??E({id:n.id.staffRef,name:n.id.displayName||n.id.staffRef,role:'owner'===n.id.role?'owner':'manager'===n.id.role?'manager':'staff',level:'head_chef'===n.id.role?'Head Chef':void 0,job:'',active:!0}))}else if('refused'===n.status&&!e)return L(n.message),void F('done')}if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&L(e)});if(!t)return;if('refused'===e.kind)return L(e.message),void F('done');if('offline'===e.kind)return Y(!0),void(n=setTimeout(()=>{t&&U(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void F('bad')}const o=N(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),B(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}F('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,K]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!X){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t,{app:s,message:l})})}if(G)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===D)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!X&&!b.PITCH)return W&&/already been used/i.test(W)?j(x,'invite-app-used'):W&&(0,S.isPhoneLinked)(W)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):W?j(W,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===D)return(0,w.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,w.jsx)(T.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,w.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F('done')}),(0,w.jsx)(T.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(W&&!X&&(0,S.isPhoneLinked)(W))return(0,w.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:24,weight:"bold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,w.jsx)(T.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,w.jsx)(T.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(W&&!X)return(0,w.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,w.jsx)(T.Muted,{center:!0,children:W}),(0,w.jsx)(T.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,w.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>L(null)})]});if($&&!X)return(0,w.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,w.jsx)(T.Muted,{center:!0,children:$}),(0,w.jsx)(V,{})]});if(!X&&!b.PITCH&&!M())return(0,w.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:W?'This link can\u2019t be used here':'Sign in to CoverCharge'}),W?(0,w.jsx)(T.Muted,{center:!0,children:W}):null,(0,w.jsx)(T.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,w.jsx)(V,{})]});const q=(0,p.rosterPerson)(X);return q&&!Q&&_(q)?(0,w.jsx)(k.LaunchWelcome,{p:q,onDone:()=>p.useSession.getState().markWelcomed(q.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),m=_r(d[12]),k=_r(d[13]),T=_r(d[14]),I=_r(d[15]),b=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),w=_r(d[20]);const x='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,w.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const N=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return R(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=N(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=N(o.id.staffRef)??E({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return R(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function V(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,w.jsxs)(f.default,{style:{gap:6},children:[(0,w.jsx)(T.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsx)(T.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,w.jsx)(T.T,{size:13,colour:m.colours.red,children:t}):null]})}let z=!1;const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1421,[5,1422,1423,1424,1425,1426,34,236,41,102,872,1003,821,1427,794,988,2,1093,1002,892,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=E,_e.signInWithText=H,_e.SignInWithLink=V,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId),n=(0,T.useSync)(e=>'device'===e.kind&&!!e.venueId);return h.IS_CAR?!b.PITCH&&!n:j.includes(h.APP_VARIANT)&&!b.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,H]=(0,u.useState)(p.useSession.persist.hasHydrated()),[D,F]=(0,u.useState)(p.START_INVITE||p.START_HANDOVER?'checking':'done'),[W,L]=(0,u.useState)(null),[K,U]=(0,u.useState)(0),[G,Y]=(0,u.useState)(!1),[$,B]=(0,u.useState)(null),X=(0,p.useSession)(e=>e.meId),Q=(0,p.useSession)(e=>!X||!!e.welcomed[X]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>H(!0));return p.useSession.persist.hasHydrated()&&H(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!j.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_HANDOVER&&!p.START_INVITE&&!z){z=!0;const n=await(0,T.claimChromeHandover)(p.START_HANDOVER);if(!t)return;if('ok'===n.status&&n.id.staffRef){R(N(n.id.staffRef)??E({id:n.id.staffRef,name:n.id.displayName||n.id.staffRef,role:'owner'===n.id.role?'owner':'manager'===n.id.role?'manager':'staff',level:'head_chef'===n.id.role?'Head Chef':void 0,job:'',active:!0}))}else if('refused'===n.status&&!e)return L(n.message),void F('done')}if(p.START_INVITE&&!(e&&await(0,T.signedInHereAs)(e)&&await(0,T.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&L(e)});if(!t)return;if('refused'===e.kind)return L(e.message),void F('done');if('offline'===e.kind)return Y(!0),void(n=setTimeout(()=>{t&&U(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void F('bad')}const o=N(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,T.signedInHereAs)(o.id)){if(await(0,T.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),B(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}F('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,K]),!j.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!X){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t,{app:s,message:l})})}if(G)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===D)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!X&&!b.PITCH)return W&&/already been used/i.test(W)?v(x,'invite-app-used'):W&&(0,S.isPhoneLinked)(W)?v(S.PHONE_LINKED_TEXT,'invite-phone-linked'):W?v(W,'invite-app-refused'):v(P,'invite-app-notsetup');if('bad'===D)return(0,w.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,w.jsx)(I.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,w.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F('done')}),(0,w.jsx)(I.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(W&&!X&&(0,S.isPhoneLinked)(W))return(0,w.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:24,weight:"bold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,w.jsx)(I.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,w.jsx)(I.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(W&&!X)return(0,w.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,w.jsx)(I.Muted,{center:!0,children:W}),(0,w.jsx)(I.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,w.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>L(null)})]});if($&&!X)return(0,w.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,w.jsx)(I.Muted,{center:!0,children:$}),(0,w.jsx)(V,{})]});if(!X&&!b.PITCH&&!M())return(0,w.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:W?'This link can\u2019t be used here':'Sign in to CoverCharge'}),W?(0,w.jsx)(I.Muted,{center:!0,children:W}):null,(0,w.jsx)(I.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,w.jsx)(V,{})]});const q=(0,p.rosterPerson)(X);return q&&!Q&&_(q)?(0,w.jsx)(k.LaunchWelcome,{p:q,onDone:()=>p.useSession.getState().markWelcomed(q.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),m=_r(d[12]),k=_r(d[13]),I=_r(d[14]),T=_r(d[15]),b=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),w=_r(d[20]);const x='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,n)=>(0,w.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:e})}),j=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const N=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return R(t),_(t)?((0,T.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=N(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,T.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=N(o.id.staffRef)??E({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return R(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function V(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,w.jsxs)(f.default,{style:{gap:6},children:[(0,w.jsx)(I.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsx)(I.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,w.jsx)(I.T,{size:13,colour:m.colours.red,children:t}):null]})}let z=!1;const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1421,[5,1422,1423,1424,1425,1426,34,236,41,102,872,1003,821,1427,794,988,2,1093,1002,892,25]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1422,[34,102,873,794,5,6,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1423,[]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1424,[34,102,873,794,25]); diff --git a/chef-app/admin.html b/chef-app/admin.html index 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 4288cb9877810e6e45bce1c9edeb6f53a22126b4..fd8c498ff256b401966dc5f4835309fdcaf88d1b 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 dcdf3bc8817afe158e1c9afca69c37508689339e..c1615eb48fd776b2340fd0503ae544b1106e99a3 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-45c1431558"; +const V = "cc-chef-7d422143ac"; const BASE = "/chef-app/"; -const PRECACHE = ["/chef-app/apple-touch-icon.png", "/chef-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/chef-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/chef-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/chef-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/chef-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/chef-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/chef-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/chef-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/chef-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/chef-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/chef-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/chef-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/chef-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/chef-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/chef-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/chef-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/chef-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/chef-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/chef-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/chef-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/chef-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/chef-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/chef-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/chef-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/chef-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/chef-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/chef-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/chef-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/chef-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/chef-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/chef-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/chef-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/chef-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/chef-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/chef-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/chef-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/chef-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/chef-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/chef-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/chef-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/chef-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/chef-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/chef-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/chef-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/chef-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/chef-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/chef-app/brand-logo.png", "/chef-app/favicon.ico", "/chef-app/icon-192.png", "/chef-app/icon-512.png", "/chef-app/icon-maskable-192.png", "/chef-app/icon-maskable-512.png", "/chef-app/manifest.webmanifest", "/chef-app/index.html", "/chef-app/_expo/static/js/web/bundle.js?v=45c1431558d012ba13ba64ead0c83ec106159077165d35d2ef65208825996c71"]; +const PRECACHE = ["/chef-app/apple-touch-icon.png", "/chef-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/chef-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/chef-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/chef-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/chef-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/chef-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/chef-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/chef-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/chef-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/chef-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/chef-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/chef-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/chef-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/chef-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/chef-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/chef-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/chef-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/chef-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/chef-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/chef-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/chef-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/chef-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/chef-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/chef-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/chef-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/chef-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/chef-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/chef-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/chef-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/chef-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/chef-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/chef-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/chef-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/chef-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/chef-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/chef-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/chef-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/chef-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/chef-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/chef-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/chef-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/chef-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/chef-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/chef-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/chef-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/chef-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/chef-app/brand-logo.png", "/chef-app/favicon.ico", "/chef-app/icon-192.png", "/chef-app/icon-512.png", "/chef-app/icon-maskable-192.png", "/chef-app/icon-maskable-512.png", "/chef-app/manifest.webmanifest", "/chef-app/index.html", "/chef-app/_expo/static/js/web/bundle.js?v=7d422143ac36e64d040d2e32bae9b027b43121e51059008c44c3cdde7a537e58"]; // 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 848c4e419784930d8138da7abf62fc8c301ccdce..a7e04de694997af947300f6b6bfbabb9a057295c 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 e4ae69cf8f620576fa2ddf73a0450df9e2994d45..8467c0f6ead95defe10e2ad00963852ee2ba1b9c 100644 --- a/customer-app/_expo/static/js/web/bundle.js +++ b/customer-app/_expo/static/js/web/bundle.js @@ -1095,7 +1095,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()})},1012,[34,1013]); __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},1013,[1010,978,1014]); __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'}},1014,[1010]); -__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.155'},1015,[]); +__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.156'},1015,[]); __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});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:h}=await r.select();c&&s(c,h);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},h='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,h.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),h}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),h={...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:h})}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}}},1016,[1017,1018,934,978,1013]); __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())}}}},1018,[978]); @@ -1196,9 +1196,9 @@ __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,"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'},1113,[821]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},1114,[34,102,1115,821,1116,794,25]); __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 b={...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)(b)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(b,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}});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})},1115,[860,1100]); -__d(function(_g,r,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=$,_e.TablePicker=function({rid:e,booking:u,name:p,turnBase:k=90,onClose:v,onSaved:w,onPickOnPlan:T}){const C=(0,b.usePlan)(e),L=(0,c.useBookings)(e),[S,W]=(0,t.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),P=(0,t.useMemo)(()=>(0,h.pickGroups)(C),[C]),z=L.filter(e=>e.date===u.date),O=(0,h.seatsOf)(C,S),D=(0,h.seatLine)(O.total,u.partySize),I=(0,h.pickClashes)(u,S,z,k),B=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,M=(0,h.tableKey)(S)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),N=(0,f.useBlocks)(e=>e.blocks),R=(0,f.blockAt)(N,e,u.date,u.time),_=e=>W(s=>(0,h.toggleTable)(s,e)),Y=async s=>{try{await $(e,u,s),w?.((0,h.savedWords)(p,u.partySize,s,(0,h.seatsOf)(C,s).total)),v()}catch(e){w?.(`Couldn\u2019t save tables for ${p}: ${String(e?.message??e).slice(0,120)}`)}},G=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(S)} picked. ${D.text}.`,children:[(0,x.jsx)(y.T,{size:18,weight:"semibold",colour:g.colours.goldLight,children:(0,h.tablesWords)(S)}),(0,x.jsx)(y.T,{size:17,colour:g.colours.text,children:D.text})]}),R?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${R.from} to ${R.to}${R.reason?` (${R.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.goldMuted},children:(0,x.jsxs)(y.T,{size:16,colour:g.colours.goldLight,children:["New bookings paused ",R.from,"\u2013",R.to,R.reason?` \xb7 ${R.reason}`:'',". You can still save tables for this booking."]})}):null,I.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(I)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.gold},children:(0,x.jsxs)(y.T,{size:16,weight:"semibold",colour:g.colours.goldLight,children:[(0,h.clashWords)(I)," You can still save."]})}):null,(0,x.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(y.Button,{testID:"table-pick-save",label:I.length?'Save anyway':'Save tables',disabled:!M||!S.length,accessibilityLabel:`${I.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(S)} for ${p}. ${D.text}.${I.length?` ${(0,h.clashWords)(I)}`:''}`,onPress:()=>Y(S),style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(y.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${p}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(y.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:v,style:j})]})]});return(0,x.jsxs)(y.Sheet,{visible:!0,onClose:v,title:`Tables \xb7 ${u.time} ${p} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:G,children:[(0,x.jsx)(s.TableNumberWarning,{plan:C}),(0,x.jsx)(y.T,{size:16,colour:g.colours.text,children:"Tap one table, or several to join them. Tap again to take one off."}),T?(0,x.jsx)(y.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${p}`,onPress:()=>T(S),style:j}):null,P.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(y.T,{size:15,weight:"semibold",colour:g.colours.gold,children:e.area}),(0,x.jsx)(y.Row,{gap:8,wrap:!0,children:e.tables.map(e=>{const s=S.includes(e.name),t=B(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:s},'aria-checked':s,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,s,t),onPress:()=>_(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:s?2:1,borderColor:s?g.colours.gold:t?g.colours.goldMuted:g.colours.hairline,borderStyle:t&&!s?'dashed':'solid',backgroundColor:s?g.colours.gold:e?g.colours.tilePressed:g.colours.tile}),children:[(0,x.jsx)(y.T,{size:18,weight:"semibold",colour:s?g.colours.onGold:g.colours.text,children:(0,l.tableNumbers)(e.name)}),(0,x.jsxs)(y.T,{size:14,colour:s?g.colours.onGold:g.colours.muted,children:[e.seats," seats",t?' \xb7 booked':'']})]},e.name)})})]},e.area)),P.length?null:(0,x.jsx)(y.Muted,{children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var s=r(d[0]),l=r(d[1]),t=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),g=r(d[9]),p=r(d[10]),y=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function $(e,s,l){const t=(0,h.tableKey)(l),o=(0,b.tablesOf)(s.table);await c.repo.bookings.update(s.id,(0,u.tablePatch)(t||null)),'seated'===s.status&&s.date===(0,p.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(t).includes(e)).forEach(s=>b.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0})),t&&(0,k.resetTableLive)(e,t))}},1116,[1117,860,34,402,102,874,1025,1115,1118,821,858,794,1119,1022,25]); +__d(function(_g,r,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=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.amber,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(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?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.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=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1116,[1117,860,34,402,102,874,1025,1115,1118,821,858,794,1119,1022,25]); __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])},1117,[34,859,821,794,25]); -__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1118,[860,1100]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.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=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1118,[860,1100]); __d(function(g,_r,_i,_a,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 O}}),_e.useTableNames=N,_e.resetTableLive=M,_e.seatBookingNow=L,_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=F,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return R}}),_e.TablePicker=W,_e.WalkInSheet=E,_e.WalkInMatchPrompt=H,_e.AssignTableSheet=_,_e.undoNotice=Y,_e.NewBookingSheet=U,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[i,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,B.jsxs)(B.Fragment,{children:[s?(0,B.jsx)(E,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,B.jsx)(U,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,i?(0,B.jsx)(_,{booking:i.b,combine:i.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),i=_r(_d[5]),n=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),z=_r(_d[27]),B=_r(_d[28]);const O=Array.from({length:12},(e,t)=>String(t+1));function N(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function M(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}async function L(e,t){await f.repo.bookings.setStatus(t.id,'seated'),M(e,t.table)}function F(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=N(e),a=(0,S.useFloor)(t=>t.live[e])??{},i=(0,S.usePlan)(e),n=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(n,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(i.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,S.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,x.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const R=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function W({use:e,value:t,onPick:s,big:o,best:a,dense:i,bestSet:n,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=i?6:8,y=i?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(n??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,B.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],n=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!n,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,B.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?n?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:n,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:i?58:64,borderRadius:12,borderWidth:n||u?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:n||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:n?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||n?1:.55},children:[(0,B.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,B.jsx)(T.T,{weight:"bold",size:22,colour:n?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,B.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,B.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,B.jsx)(T.T,{size:i?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const A=[1,2,3,4,5,6,7,8];function E({onClose:e,onSeated:a,wide:i,initialTable:y}){const{rid:w,r:C,now:D}=(0,p.useCtx)(15e3),I=F(w,D),[$,P]=(0,r.useState)(2),[O,N]=(0,r.useState)(!1),[R,E]=(0,r.useState)(y??null),_=(0,S.usePlan)(w),Y=(0,f.useBookings)(w),U=(0,v.useBlocks)(e=>e.blocks),q=(0,v.closedAreasAt)(U,w,(0,x.ymd)(D),(0,x.hm)(D)),Q=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(I).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(_,Y.filter(e=>e.date===(0,x.ymd)(D)),e,$,D,(0,k.turnFor)($,C.settings.turnMins),90,void 0,{closed:q})?.table??null},[_,Y,I,$,q.size,D.getTime()]);(0,r.useEffect)(()=>{R&&(0,S.tablesOf)(R).some(e=>'Closed'===I[e]?.label)&&E(null)},[R,q.size]);const[V,G]=(0,r.useState)(!1),[K,X]=(0,r.useState)(''),J=(e,t=String(e),s=()=>{N(!1),P(e)})=>{const o='9+'===t?O:!O&&$===e;return(0,B.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:i?58:60,height:i?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,B.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},Z=(0,B.jsx)(s.PartySizeInput,{value:$,onChange:P,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),ee=(0,B.jsxs)(b.default,{style:{gap:8,width:i?256:void 0},children:[(0,B.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,B.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[A.map(e=>J(e)),J(9,'9+',()=>{N(!0),P(e=>e>=9?e:9)})]}),O?Z:null]}),[te,se]=(0,r.useState)(!1),[oe,le]=(0,r.useState)(null),ae=async(t=R,s=!1)=>{if(!te){if(!s){const e=(0,z.bookingsNearWalkIn)(Y,D,$);if(e.length)return void le({at:t,list:e})}se(!0);try{const s=await f.repo.bookings.seatWalkIn(w,$,t??void 0,K);M(w,t??void 0),a(s),e()}finally{se(!1)}}},ie=async(t,s)=>{if(!te){se(!0);try{const o=s??t.table??null;o&&o!==t.table&&await f.repo.bookings.assignTable(t.id,o),await L(w,{...t,table:o??void 0}),(0,n.notify)({id:`seated:${t.id}`,testID:'walkin-match-toast',timeoutMs:5e3,icon:'\u2713',title:`${t.name} seated \xb7 ${t.partySize} \xb7 ${o?(0,l.tableNumbers)(o):'table to assign'} (booking ${t.ref})`}),le(null),e()}finally{se(!1)}}},ne=(0,B.jsxs)(b.default,{style:{gap:8,flex:i?1:void 0,minWidth:0},children:[(0,B.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,B.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),R?(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>E(null)}):null]}),(0,B.jsx)(W,{use:I,value:R,onPick:e=>{I[e]&&!I[e].busy?ae(e):E(R===e?null:e)},big:i,dense:i,best:Q,bestSet:(0,u.bestTables)(_)}),(0,B.jsxs)(T.Muted,{children:["Tap a free table to seat them there",Q&&!R?` (suggested for ${$}: ${(0,l.tableNumbers)(Q)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(D)}`,maxWidth:i?1100:void 0,testID:"walkin-sheet",children:[(0,B.jsx)(T.Button,{label:`Seat walk-in \xb7 ${$} ${1===$?'person':'people'}${R?` \xb7 ${(0,l.tableNumbers)(R)}`:''}`,disabled:te,onPress:()=>{ae()},testID:"seat-walkin",style:{minHeight:52}}),i?(0,B.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[ee,ne]}):(0,B.jsxs)(B.Fragment,{children:[ee,ne]}),(0,B.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[V?(0,B.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:K,onChangeText:X,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,B.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,B.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]}),oe?(0,B.jsx)(H,{list:oe.list,busy:te,onYes:e=>{ie(e,oe.at)},onNo:()=>{const e=oe.at;le(null),ae(e,!0)},onClose:()=>le(null)}):null]})}function H({list:e,busy:t,onYes:s,onNo:o,onClose:a}){return(0,B.jsx)(T.Sheet,{visible:!0,onClose:a,title:"Booked party?",maxWidth:720,testID:"walkin-match",children:(0,B.jsxs)(b.default,{style:{gap:14},children:[e.map((e,o)=>(0,B.jsxs)(b.default,{testID:`walkin-match-${o}`,style:{gap:12,padding:16,borderRadius:16,borderWidth:2,borderColor:j.colours.gold,backgroundColor:'#15130F'},children:[(0,B.jsx)(b.default,{accessibilityRole:"header",accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:26,weight:"bold",colour:j.colours.goldLight,testID:"walkin-match-question",children:(0,z.walkInMatchQuestion)(e)})}),e.table?(0,B.jsxs)(T.T,{size:17,colour:j.colours.text,children:["Booked table ",(0,l.tableNumbers)(e.table)," \xb7 ",e.ref]}):(0,B.jsx)(T.T,{size:17,colour:j.colours.text,children:e.ref}),(0,B.jsx)(T.Button,{label:"Yes, seat booking",testID:"walkin-match-yes",disabled:t,accessibilityLabel:`Yes, seat ${e.name}'s booking, ${e.partySize} people`,onPress:()=>s(e),style:{minHeight:64}})]},e.id)),(0,B.jsx)(T.Button,{kind:"secondary",label:"No, new walk-in",testID:"walkin-match-no",disabled:t,onPress:o,style:{minHeight:64}})]})})}function _({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:i}=(0,p.useCtx)(15e3),n=F(o,i),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[n,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(i)),t,e.partySize,i,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,i.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),O=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&M(o,l),t()},L=C?(0,B.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,B.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,B.jsx)(b.default,{testID:"combine-short",children:(0,B.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,B.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,B.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>N(I)}),(0,B.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,B.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${R(e)}`,testID:"assign-table-sheet",footer:L,children:[v&&!C?(0,B.jsx)(b.default,{testID:"assign-suggested",children:(0,B.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,B.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,B.jsx)(W,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await N([e])}})]})}function Y(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${R(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function U({date:e,onClose:t,wide:n,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:O}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,L]=(0,r.useState)(ee.blocks),[W,A]=(0,r.useState)(!1),[E,H]=(0,r.useState)(''),[_,Y]=(0,r.useState)(2),[U,q]=(0,r.useState)(null),[Q,V]=(0,r.useState)(''),[G,K]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ie=(0,S.usePlan)(u),ne=(0,P.dogSetUp)(ie),re=!0===te.dog&&ne,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(_,c.settings.turnMins),be=F.filter(e=>e.date===M),he=e=>(0,k.freeTablesAt)(ie,be,_,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(R,u,M,e)}),ge=re&&U?he(U):[];(0,r.useEffect)(()=>{ae(null)},[re,U,_]);const pe=(0,y.bookingSlots)(c,ue,e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),_,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0),e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),me=(0,w.ukPhone)(G),[fe,ye]=(0,r.useState)(!1),ke=U?pe.find(e=>e.time===U):void 0,xe=ke&&ke.left<_?{left:Math.max(0,ke.left),time:ke.time}:null,je=ke&&null!=ke.partiesLeft&&ke.partiesLeft<1?{time:ke.time,cap:ke.partiesCap??0}:null,we=xe||je,Te=U?(0,v.blockAt)(R,u,M,U):void 0,Se='staff'!==z,ve=!!U&&!(0,D.dogTimeOk)(c,F,M,U,de),Ce=!oe.length&&E.trim().length>=2&&!!U&&(!we||fe)&&(0,o.validParty)(_)&&me.ok&&(0,w.emailOk)(X)&&(!Te||Se&&W)&&(!re||ge.length>0)&&!ve,De=te.wheelchair>0||te.stepFree;return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,B.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:_,audience:"staff"}),te.dog&&!ne?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,B.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(L(e),q(null),A(!1))}}),(0,B.jsxs)(T.Row,{gap:6,children:[(0,B.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,B.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,B.jsx)(T.Field,{label:"Name",value:E,onChangeText:H,placeholder:"e.g. Reid",testID:"nb-name"}),(0,B.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&G?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,B.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,B.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(T.T,{center:!0,children:"Covers"}),(0,B.jsx)(s.PartySizeInput,{value:_,onChange:e=>{Y(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!he(e.time).length||!(0,D.dogTimeOk)(c,F,M,e.time,de);return(0,B.jsx)(T.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,v.blockAt)(R,u,M,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:U===e.time,onPress:()=>{q(e.time),A(!1),ye(!1)}},e.time)})}),we?(0,B.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[xe?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(_,xe.left,xe.time)}):null,je?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overPartiesNote)(je.time,je.cap)}):null,(0,B.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&U?(0,B.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,B.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,B.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ie.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),ge.length?(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:ge.slice(0,10).map((e,t)=>(0,B.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${De&&(0,P.accessibleSetUp)(ie)&&!(0,P.isAccessible)(ie,e.table)?' \xb7 not step-free':''}`,selected:(le??ge[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",_," at ",U,". Try another time."]})]}):null,Te?(0,B.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,B.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",Te.from,"\u2013",Te.to,Te.reason?` (${Te.reason})`:'']}),Se?(0,B.jsx)(T.Chip,{label:W?'Manager override on':'Override and book anyway',selected:W,onPress:()=>A(e=>!e)}):(0,B.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,B.jsx)(b.default,{testID:"nb-closed",children:(0,B.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,B.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:_,date:M,time:U,today:(0,x.ymd)(h),bookings:F,audience:"staff",showTables:!1!==c.settings.tableRequests}),De&&!(0,P.accessibleSetUp)(ie)?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,B.jsx)(T.Field,{label:"Notes (optional)",value:Q,onChangeText:V,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,i.depositDue)((0,i.depositOf)(c.settings),_)?(0,B.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,i.depositDue)((0,i.depositOf)(c.settings),_))," (",(0,a.gbp)((0,i.depositOf)(c.settings).perPersonPence)," per person for ",(0,i.depositOf)(c.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,B.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),ve?(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",U,". Try another time: dogs are very welcome then."]}):null,(0,B.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Ce,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||ge.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:_,date:M,time:U,notes:Q.trim(),security:(0,i.depositDue)((0,i.depositOf)(c.settings),_)?'deposit':'none',depositPaid:0,...(0,i.depositDue)((0,i.depositOf)(c.settings),_)?{depositDue:(0,i.depositDue)((0,i.depositOf)(c.settings),_),depositPolicy:(0,i.depositWords)((0,i.depositOf)(c.settings),_,c.name).join(' '),depositRefundable:(0,i.depositOf)(c.settings).refundable,depositCutoffHours:(0,i.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===U)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??ge[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,O)).catch(()=>{}),d?.({date:M,time:U,name:E.trim()}),t()}})]})}},1119,[827,1120,1121,860,867,14,1122,34,859,402,102,872,1084,874,1123,1100,858,821,864,794,1025,1022,1124,1125,1130,1102,1096,1131,25]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,$]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{$(String(e))},[e]);const w=e=>p((0,s.clampParty)(e,b,y)),I=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>w(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:c.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(u.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:c.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?I(-10,'\u221210',"10 fewer people"):null,I(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{$(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&w((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);$(String(e)),w(e)},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:c.colours.border,color:c.colours.text,backgroundColor:c.colours.surface,textAlign:'center',fontSize:20,fontFamily:c.fonts.semibold}}),I(1,'+','One more person'),y-b>=20?I(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),c=r(_d[5]),u=r(_d[6]),d=r(_d[7])},1120,[34,402,412,102,1121,821,794,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return 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.`},1121,[]); @@ -1210,12 +1210,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}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"fitLabel",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"BIG_LABEL_MIN",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"OCC_LABEL_MIN",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"occupiedLabel",{enumerable:!0,get:function(){return S}}),_e.areaBounds=I,_e.minReadableScale=function(e,t){return Math.max(0,...e.tables.filter(e=>e.areaId===t).map(e=>{const t='round'===e.shape?.85:1,o=(7.4399999999999995*Math.max(1,(0,g.tableNumber)(e).length)+6)/(e.w*t),n=22/Math.min(e.w,e.h);return Math.max(o,n)}))},_e.seatSpots=R,_e.FixtureShape=T,_e.FloorCanvas=function(e){const[$,L]=(0,r.useState)({w:0,h:0}),z=e.plan.tables.filter(t=>t.areaId===e.areaId),E=e.crop&&z.length?I(e.plan,e.areaId):{x:0,y:0,w:l.PLAN_W,h:l.PLAN_H},F='live'===e.mode?[...new Map(z.flatMap(t=>{const o=e.view?.[t.name];if(!o?.group||o.group.length<2)return[];const n=[...o.group].sort().join('+');return[[n,{key:n,members:o.group,view:o}]]})).values()]:[],O=28*F.length,D={x:E.x,y:E.y,r:E.x+E.w,b:E.y+E.h},_=$.w?'width'===e.fit?Math.min($.w/l.PLAN_W,e.maxH?e.maxH/l.PLAN_H:9):Math.min($.w/E.w,Math.max(1,$.h-O)/E.h):0,B=e.fill&&'contain'===e.fit&&_>0&&$.h>0,N=B?($.w/_-E.w)/2:0,P=B?(($.h-O)/_-E.h)/2:0,W={x:D.x-N,y:D.y-P,r:D.r+N,b:D.b+P},H=W.r-W.x,G=W.b-W.y,[Y,X]=(0,r.useState)(null),U=(0,r.useRef)(null),[q,J]=(0,r.useState)(null),K=(0,r.useRef)(null);K.current=q,i.default.useEffect(()=>{if(!q)return;const e=setTimeout(()=>J(null),n.ARM_MS);return()=>clearTimeout(e)},[q]);const V='live'===e.mode&&!!e.onDrop,Q=e=>!V||(0,n.isArmed)(K.current,e.id,Date.now()),Z=t=>e.plan.sections.find(e=>e.id===t.sectionId),ee=t=>e.plan.joins.find(e=>e.tables.includes(t.name)),te=i.default.useMemo(()=>(0,g.numberClashes)(e.plan.tables).sameArea,[e.plan.tables]),oe=(t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>Q(t),onResponderTerminationRequest:()=>!Q(t),onResponderGrant:e=>{U.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,id:t.id,kind:o}},onResponderMove:n=>{const r=U.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,a=n.nativeEvent.pageY-r.y;Math.abs(i)+Math.abs(a)<6&&!Y||Q(t)&&('live'!==e.mode||e.onDrop&&e.view&&['seated','mains','dessert','bill'].includes(e.view[t.name]?.status)&&e.view[t.name]?.booking)&&X({id:t.id,dx:i,dy:a,kind:o})},onResponderRelease:r=>{const i=U.current;U.current=null;const s=r.nativeEvent.pageX-(i?.x??0),u=r.nativeEvent.pageY-(i?.y??0);if(X(null),Math.abs(s)+Math.abs(u)<6||!_){if('move'===o){if(V){const e=(0,n.releaseOn)(K.current,t.id,!1,Date.now());if(J(e.arm),'select'===e.action)try{a.default.announceForAccessibility(n.SELECTED_A11Y)}catch{}}e.onTap?.(t)}return}if(V){const e=(0,n.releaseOn)(K.current,t.id,!0,Date.now());if(J(e.arm),'move'!==e.action)return}const h=s/_,c=u/_;if('edit'===e.mode&&'move'===o)e.onMove?.(t,w(v(t.x+h,e.snapOn),0,l.PLAN_W-t.w),w(v(t.y+c,e.snapOn),0,l.PLAN_H-t.h));else if('edit'===e.mode&&'resize'===o)e.onResize?.(t,w(v(t.w+h,e.snapOn),50,400),w(v(t.h+c,e.snapOn),50,300));else if('live'===e.mode&&e.onDrop){const o=t.x+t.w/2+h,n=t.y+t.h/2+c,r=z.find(e=>e.id!==t.id&&o>=e.x-10&&o<=e.x+e.w+10&&n>=e.y-10&&n<=e.y+e.h+10);r&&e.onDrop(t,r)}}}),ne=e=>e*_,re=e=>ne(e-W.x),ie=e=>ne(e-W.y),ae='width'===e.fit?l.PLAN_H*_+O||200:void 0;return(0,x.jsxs)(s.default,{testID:"floor-canvas",onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),style:[{width:'100%',borderRadius:16,overflow:'hidden'},'contain'===e.fit?{flex:1}:{height:ae}],children:[F.map(e=>{const o=z.filter(t=>e.members.includes(t.name)),n=o.length?(Math.min(...o.map(e=>e.x))+Math.max(...o.map(e=>e.x+e.w)))/2:W.x+H/2,r=e.view.booking?.time??e.view.next?.time,i=`${A(e.members)}${r?` \xb7 ${'seated'===e.view.status?'Seated':'Booked'} ${r}`:''}`,a=Math.min(Math.max(0,$.w-8),260);return(0,x.jsx)(s.default,{testID:`joined-label-${e.key}`,accessible:!0,accessibilityLabel:`Joined tables ${i}`,pointerEvents:"none",style:{height:28,width:a,marginLeft:w(ne(n-W.x)-a/2,4,Math.max(4,$.w-a-4)),alignItems:'center',justifyContent:'center',overflow:'hidden',borderRadius:8,borderWidth:1,borderColor:h.colours.gold,backgroundColor:(0,t.soutersSurface)('#0B0B0B')},children:(0,x.jsx)(c.T,{size:16,weight:"bold",colour:h.colours.goldLight,center:!0,numberOfLines:1,children:i})},e.key)}),_?(0,x.jsx)(s.default,{style:{width:ne(H),height:ne(G),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0F0E0C'),borderRadius:16,borderWidth:1,borderColor:h.colours.border,overflow:'hidden'},children:(0,x.jsxs)(s.default,{style:{position:'absolute',left:0,top:0,width:ne(H),height:ne(G)},children:['edit'===e.mode?Array.from({length:l.PLAN_W/(2*l.GRID)},(e,o)=>(0,x.jsx)(s.default,{style:{position:'absolute',left:re(o*l.GRID*2),top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`v${o}`)):null,'edit'===e.mode?Array.from({length:l.PLAN_H/(2*l.GRID)},(e,o)=>(0,x.jsx)(s.default,{style:{position:'absolute',top:ie(o*l.GRID*2),left:0,right:0,height:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`h${o}`)):null,(e.plan.fixtures??[]).filter(t=>t.areaId===e.areaId).map(t=>(0,x.jsx)(T,{f:{...t,x:t.x-W.x,y:t.y-W.y},S:ne,live:'live'===e.mode},t.id)),e.plan.joins.map(e=>{const t=z.filter(t=>e.tables.includes(t.name));if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,x.jsx)(s.default,{testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:re((r+a)/2-u/2),top:ie((i+l)/2)-3,width:ne(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.55)',transform:[{rotate:`${h}rad`}]}},e.id)}),z.map(n=>{const r=e.view?.[n.name],a=r?u.STATUS[r.status]:u.STATUS.free,v=Y?.id===n.id,w=v&&'resize'===Y.kind?Math.max(50,n.w+Y.dx/_):n.w,$=v&&'resize'===Y.kind?Math.max(50,n.h+Y.dy/_):n.h,I=v&&'move'===Y.kind?n.x+Y.dx/_:n.x,T=v&&'move'===Y.kind?n.y+Y.dy/_:n.y,A=e.selected===n.id||e.highlight?.includes(n.name)||q?.id===n.id,L=Z(n),z='edit'===e.mode?'#2A2419':a.colour,E='edit'===e.mode?h.colours.text:a.fg,F='round'===n.shape?ne(Math.min(w,$))/2:ne(10),O='live'===e.mode?(0,g.liveTableLabel)(n,te):(0,l.tableLabel)(n),D=ne(Math.min(w,$))<64,B=r?r.covers>0?r.covers:'soon'===r.status?(r.next??r.dayBookings?.[0])?.partySize??0:0:0,N=e.big&&'live'===e.mode&&r&&!(r.group&&r.group.length>1)&&k.has(r.status)&&B>0,P=N?S(O,B):O,W=M(e.big?Math.max(13,Math.min(34,ne(Math.min(w,$))/3)):Math.max(11,Math.min(22,ne(Math.min(w,$))/4)),P,ne(w)*('round'===n.shape?.85:1),N?C:e.big?j:9),H=ne(w)*('round'===n.shape?.85:1),G=e=>e.length*W*.62+6,X=N&&G(P)>H,U=X&&Math.max(G(O),G(`(${B})`))<=H&&1.2*W*2<=ne($)-4,J=X&&!U,K=Math.max(e.big?11:12,Math.round(.62*W)),V=(ne($)-6-1.4*W)/(1.4*K),Q=V>=2&&ne(w)>=5*K?2:V>=1?1:0,ae=r?.booking&&void 0!==r.seatedMins?r.booking.time:void 0,se='soon'===r?.status?r.next?.time??r.dayBookings?.[0]?.time:void 0,le='edit'===e.mode?`Table ${(0,o.tableNumbers)(O)}, ${(0,l.shapeLabel)(n.shape).toLowerCase()}, ${n.minSeats}\u2013${n.maxSeats} seats${n.online?', bookable online':''}`:'soon'===r?.status?`Table ${(0,o.tableNumbers)(O)}, booked later${se?`, ${se}`:''}${r.group?`, combined with ${r.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`:`Table ${(0,o.tableNumbers)(O)}, ${a.label}${void 0!==r?.seatedMins?`, seated ${r.seatedMins} min`:''}${r?.covers?`, ${r.covers} Covers`:''}${r?.dayBookings?.length?`, booked: ${r.dayBookings.map(e=>`${e.time}, ${e.partySize} Covers`).join('; ')}`:''}${r?.group?`, combined with ${r.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`,de=void 0!==r?.seatedMins&&r.booking?Math.min(1.2,r.seatedMins/(r.booking.durationMins??(0,u.turnFor)(r.booking.partySize,e.turnBase))):null;return(0,x.jsxs)(i.default.Fragment,{children:[R({...n,w:w,h:$}).map((t,o)=>(0,x.jsx)(s.default,{pointerEvents:"none",style:[{position:'absolute',left:re(I+t.x)-Math.max(4,ne(8)),top:ie(T+t.y)-Math.max(4,ne(8)),width:Math.max(8,ne(16)),height:Math.max(8,ne(16)),borderRadius:99,backgroundColor:'edit'===e.mode?'#5A4C33':'rgba(255,255,255,0.16)',borderWidth:1,borderColor:'edit'===e.mode?h.colours.gold:'rgba(255,255,255,0.25)'},y()]},o)),'live'===e.mode&&(ne(w)<44||ne($)<44)?(0,x.jsx)(s.default,{accessible:!1,importantForAccessibility:"no-hide-descendants",'aria-hidden':!0,...oe(n,'move'),style:{position:'absolute',left:re(I+w/2)-Math.max(44,ne(w))/2,top:ie(T+$/2)-Math.max(44,ne($))/2,width:Math.max(44,ne(w)),height:Math.max(44,ne($)),zIndex:2}}):null,(0,x.jsxs)(s.default,{testID:`table-${n.name}`,accessibilityRole:"button",accessibilityLabel:le,onAccessibilityTap:()=>e.onTap?.(n),onKeyDown:t=>{'Enter'!==t?.key&&' '!==t?.key||e.onTap?.(n)},tabIndex:0,...oe(n,'move'),style:[{position:'absolute',left:re(I),top:ie(T),width:ne(w),height:ne($),borderRadius:F,backgroundColor:z,alignItems:'center',justifyContent:'center',padding:2,overflow:J?'visible':'hidden',borderWidth:A?3:e.sectionColours&&L?2.5:1.5,borderColor:A?'#FFFFFF':e.sectionColours&&L?(0,h.brandColour)(L.colour):'edit'===e.mode?h.colours.gold:'rgba(0,0,0,0.35)',transform:[{scale:v?1.06:1}],zIndex:v?50:J?4:3,opacity:v&&'live'===e.mode?.85:1,shadowColor:'#000',shadowOpacity:v?.6:.3,shadowRadius:v?14:6,cursor:'edit'===e.mode?'grab':'pointer',touchAction:'none'},v?null:y()],children:[(0,x.jsxs)(s.default,{style:J?{alignItems:'center',justifyContent:'center',overflow:'visible'}:{alignItems:'center',justifyContent:'center',maxWidth:'100%',maxHeight:'100%',overflow:'hidden'},pointerEvents:"none",children:[N?(0,x.jsx)(c.T,{testID:`table-label-${n.name}`,style:U?{flexShrink:0,lineHeight:Math.round(1.2*W),maxWidth:Math.max(20,H-4)}:J?{...p,whiteSpace:'nowrap',textShadowColor:'rgba(0,0,0,0.9)',textShadowRadius:3,textShadowOffset:{width:0,height:0}}:p,weight:"bold",size:W,colour:J?'#FFFFFF':E,center:!0,numberOfLines:U?2:1,children:P}):(0,x.jsx)(c.T,{style:p,weight:"bold",size:W,colour:E,center:!0,numberOfLines:1,children:O}),'live'===e.mode&&'blocked'===r?.status?(0,x.jsx)(c.T,{style:f,size:Math.max(10,Math.round(.5*W)),weight:"semibold",colour:E,center:!0,numberOfLines:1,children:"Blocked"}):null,N||'live'===e.mode&&r?.group&&r.group.length>1?null:e.big&&'live'===e.mode&&r&&1===Q?'free'!==r.status&&'soon'!==r.status&&(r.covers||ae)?(0,x.jsx)(c.T,{style:f,size:K,weight:"bold",colour:E,center:!0,numberOfLines:1,children:[r.covers?`${r.covers}`:'',ae??''].filter(Boolean).join(' \xb7 ')}):null:e.big&&'live'===e.mode&&r&&2===Q?(0,x.jsxs)(x.Fragment,{children:['soon'!==r.status&&r.covers?(0,x.jsxs)(c.T,{style:f,size:K,weight:"semibold",colour:E,center:!0,children:[r.covers," ",1===r.covers?'Cover':'Covers']}):'free'!==r.status||D?null:(0,x.jsxs)(c.T,{style:f,size:K,colour:E,center:!0,children:[n.minSeats,"\u2013",n.maxSeats]}),'free'!==r.status&&'soon'!==r.status&&ae?(0,x.jsx)(c.T,{style:f,size:K,weight:"bold",colour:E,center:!0,children:ae}):'dirty'===r.status?(0,x.jsx)(c.T,{style:f,size:K,colour:E,center:!0,children:"Clear"}):null]}):e.big&&'live'===e.mode?null:'edit'===e.mode?D?null:(0,x.jsxs)(c.T,{style:f,size:11,colour:h.colours.muted,center:!0,children:[n.minSeats,"\u2013",n.maxSeats,n.online?' \xb7 online':'']}):r?(0,x.jsxs)(x.Fragment,{children:['free'!==r.status||D?null:(0,x.jsxs)(c.T,{style:f,size:11,colour:E,center:!0,children:[n.minSeats,"\u2013",n.maxSeats," seats"]}),void 0!==r.seatedMins?(0,x.jsxs)(c.T,{style:f,size:12,weight:"semibold",colour:E,center:!0,children:[r.seatedMins,"m \xb7 ",r.covers,"\ud83d\udc65"]}):r.orderOnly?(0,x.jsx)(c.T,{style:f,size:11,colour:E,center:!0,children:"Open order"}):null,'dirty'!==r.status||D?null:(0,x.jsx)(c.T,{style:f,size:11,colour:E,center:!0,children:"Clear"}),!D||r.allergy||r.vip?(0,x.jsxs)(c.T,{style:f,size:11,colour:E,center:!0,children:[r.allergy?'\u26a0':'',r.vip?'VIP'===r.vip?'\u2605':'\u2665':'',r.occasion?u.OCCASION_ICON[r.occasion]:'',r.note?'\u270e':'']}):null]}):null]}),null,'live'===e.mode&&r&&!D&&(r.booking??r.next)&&(0,b.needsIcons)(r.booking??r.next).replace('\u26a0\ufe0f','').trim()?(0,x.jsx)(s.default,{pointerEvents:"none",testID:`needs-${n.name}`,style:{position:'absolute',bottom:e.big?-Math.max(9,.55*K):2,right:e.big?-6:4,backgroundColor:(0,t.soutersSurface)('rgba(11,11,11,0.85)'),borderRadius:8,paddingHorizontal:4,borderWidth:1,borderColor:'rgba(255,255,255,0.15)'},children:(0,x.jsx)(c.T,{size:e.big?Math.max(11,.75*K):10,children:(0,b.needsIcons)(r.booking??r.next).replace('\u26a0\ufe0f','').trim()})}):null,L&&'live'===e.mode&&e.sectionColours&&!D&&!e.big?(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:3,right:6,backgroundColor:(0,h.brandColour)(L.colour),borderRadius:6,paddingHorizontal:3},children:(0,x.jsx)(c.T,{size:9,weight:"bold",colour:"#0B0B0B",children:L.server})}):null,null===de||D?null:(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:'15%',right:'15%',bottom:5,height:4,borderRadius:2,backgroundColor:'rgba(0,0,0,0.25)'},children:(0,x.jsx)(s.default,{style:{width:`${Math.min(100,100*de)}%`,height:4,borderRadius:2,backgroundColor:de>=1?'#B3261E':'rgba(0,0,0,0.6)'}})}),ee(n)&&'edit'===e.mode?(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',bottom:2,left:4},children:(0,x.jsx)(c.T,{size:10,colour:h.colours.gold,children:"\u26d3"})}):null]}),'edit'===e.mode&&e.selected===n.id?(0,x.jsx)(s.default,{testID:"resize-handle",accessibilityLabel:"Resize table",...oe(n,'resize'),style:{position:'absolute',left:re(I+w)-14,top:ie(T+$)-14,width:28,height:28,borderRadius:14,backgroundColor:h.colours.gold,borderWidth:2,borderColor:'#fff',zIndex:60,cursor:'nwse-resize',touchAction:'none'}}):null]},n.id)}),0===z.length?(0,x.jsx)(s.default,{style:{position:'absolute',left:0,right:0,top:'45%'},children:(0,x.jsxs)(c.T,{center:!0,colour:h.colours.muted,children:["No tables in this area yet",'edit'===e.mode?' \u2014 add some in Tables':'',"."]})}):null]})}):null]})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),i=e(r),a=e(_r(d[4]));_r(d[5]);var s=e(_r(d[6])),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),c=_r(d[10]),b=_r(d[11]),g=_r(d[12]),x=_r(d[13]);const f={flexShrink:0},p={flexShrink:0,maxWidth:'none'},y=(e=250)=>({transitionProperty:'background-color, border-color, transform, left, top, width, height',transitionDuration:`${e}ms`}),v=(e,t=!0)=>t?Math.round(e/l.GRID)*l.GRID:Math.round(e),w=(e,t,o)=>Math.max(t,Math.min(o,e)),M=(e,t,o,n=9)=>Math.max(n,Math.min(e,(o-6)/(.62*Math.max(1,t.length)))),j=12,C=11,k=new Set(['soon','seated','mains','dessert','bill']),S=(e,t)=>`${e} (${t})`,$=46;function I(e,t){const o=e.tables.filter(e=>e.areaId===t);if(!o.length)return{x:0,y:0,w:l.PLAN_W,h:l.PLAN_H};const n=Math.max(0,Math.min(...o.map(e=>e.x))-$),r=Math.max(0,Math.min(...o.map(e=>e.y))-$);return{x:n,y:r,w:Math.min(l.PLAN_W,Math.max(...o.map(e=>e.x+e.w))+$)-n,h:Math.min(l.PLAN_H,Math.max(...o.map(e=>e.y+e.h))+$)-r}}function R(e){const t=Math.max(1,e.maxSeats),o=[];if('round'===e.shape){const n=e.w/2+9.6,r=e.h/2+9.6;for(let i=0;ie.w,r=Math.ceil(t/2),i=t-r;if(n){for(let t=0;te.w,a=n?{borderColor:'#FFFFFF',borderWidth:2}:null;return'bar'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#2A2216':'#3A2E1C',borderRadius:8,borderWidth:1.5,borderColor:o?'#5A4A30':h.colours.gold},a],children:(0,x.jsx)(c.T,{size:Math.max(9,Math.min(14,t(e.h)/2.4)),weight:"semibold",colour:h.colours.goldLight,children:"BAR"})}):'wall'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#3A3631':'#5C574F',borderRadius:2},a]}):'window'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:'rgba(226,196,137,0.16)',borderColor:'rgba(226,196,137,0.6)',borderWidth:1,borderRadius:2},a],children:!o&&t(i?e.h:e.w)>60?(0,x.jsx)(c.T,{size:9,colour:"#BFDDFF",style:i?{transform:[{rotate:'90deg'}]}:void 0,children:"WINDOW"}):null}):(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{borderColor:o?'#7A6440':h.colours.gold,borderWidth:1.5,borderStyle:'dashed',borderRadius:3,backgroundColor:'rgba(207,164,95,0.08)'},a],children:t(i?e.h:e.w)>40?(0,x.jsx)(c.T,{size:9,colour:h.colours.goldLight,style:i?{transform:[{rotate:'90deg'}]}:void 0,children:"DOOR"}):null})}function A(e){return(0,l.tablesLabel)(e.join('+')).replace(/^Tables? /,'').replace(/ \+ /g,'+')}},1127,[828,860,1128,34,281,236,102,1025,1100,821,794,1102,859,25]); __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])},1129,[34,402,102,874,861,863,821,794,25]); -__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 a}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return o}}),_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 d}}),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 l}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return f}}),_e.changedFields=P,_e.historyText=O,_e.editPatch=function(t,a,s,o=(new Date).toISOString()){const n=P(t,a);if(!n.length)return{};const d={};for(const c of n)switch(c){case'partySize':d.partySize=(0,e.clampParty)(Number(a.partySize));break;case'phone':case'email':case'table':d[c]=String(a[c]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[c]=String(a[c]??'').trim();break;case'area':d.area=(a.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(a.dogs??0)),d.dog=Number(a.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(a.highChairs??0))||void 0;break;case'wheelchair':d.access={...t.access??{},wheelchair:Math.max(0,Number(a.wheelchair??0))||void 0};break;case'occasion':d.occasion=a.occasion||void 0;break;case'allergies':d.allergies=[...a.allergies??[]],d.allergyNone=!!a.allergyNone&&!(a.allergies??[]).length,d.allergyNote=(a.allergyNote??'').trim()||void 0,(a.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(a.vegan??0)||void 0,vegetarian:Number(a.vegetarian??0)||void 0};break;case'deposit':if(!a.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(a.depositDue??0))),a.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(a.depositDate??'')?a.depositDate:o.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(a.depositAmount??0))),depositPaidBy:s.by.slice(0,80),depositPaidAt:e===o.slice(0,10)?o:`${e}T12:00:00.000Z`,depositMethod:a.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=a.status,'seated'!==a.status||t.seatedAt||(d.seatedAt=o),'finished'!==a.status||t.finishedAt||(d.finishedAt=o),'confirmed'!==a.status&&'pending'!==a.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=a.source||void 0;break;case'tags':d.tags=[...(t.tags??[]).filter(e=>!p.includes(e)),...a.tags??[]];break;case'duration':d.durationMins=Number(a.duration??0)>=15?Number(a.duration):void 0}n.includes('table')&&(d.tableSetHere=!0);const c=t;return d.locallyEdited=!0,d.editedFields=[...new Set([...c.editedFields??[],...n])],d.editLog=[...c.editLog??[],{at:o,by:s.by.slice(0,80),app:s.app,fields:n,text:O(t,a,n,s.by.slice(0,80),o)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>b[e]??e).join(', ')} changed by ${e.by} ${N(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,a,s,o,n=90,d){const c=[];if(!P(e,a).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return c;const u={...e,date:a.date,time:a.time,partySize:a.partySize,...Number(a.duration??0)>=15?{durationMins:Number(a.duration)}:{}};if(a.table){const e=(0,t.tableOverlaps)(u,a.table,s.filter(e=>e.date===a.date),n);if(e.length&&c.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),d){const e=a.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>d.tables.find(t=>t.name===e)).filter(Boolean),t=e.reduce((e,t)=>e+t.maxSeats,0);e.length&&td.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(a.dogs??0)>0&&s.length&&c.push(`Dogs aren\u2019t allowed in ${s[0].name}. Pick a dog-friendly table.`)}}o&&c.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return c},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return k}}),_e.bookingExtras=function(e){const t=e,a=e.dogs??(e.dog?1:0),s=[];a&&s.push(w(a,'dog','dogs'));t.highChairs&&s.push(w(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&s.push(w(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&s.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&s.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&s.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&s.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&s.push(`Deposit by ${t.depositMethod}`);return s.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]);const a='For example: birthday, high chair, dog, window seat',s='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.',o=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')},d=['date','time','partySize','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration'],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'}],l=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],h=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],p=['VIP','Regular'],b={date:'date',time:'time',partySize:'covers',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'},f=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:(a=e.depositPaidAt,a?a.slice(0,10):''),depositDue:e.depositDue??0,status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>p.includes(e)).sort(),duration:e.durationMins??0};var a},y=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),$=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'']:[!1]);function v(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return y(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return $(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':return Number(t[e]??0);default:return String(t[e]??'').trim()}}function P(e,t){const a=f(e);return d.filter(e=>v(e,a)!==v(e,t))}const S=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,N=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},w=(e,t,a)=>`${e} ${1===e?t:a}`;function O(e,t,a,s,o){const n=f(e),d=[];for(const e of[...a].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))'deposit'===e?t.depositOn?t.depositPaid&&!n.depositPaid?d.push(`deposit marked paid (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&n.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${S(Number(t.depositDue??0))}`):d.push('deposit taken off'):'dogs'===e?d.push(!n.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?w(Number(t.dogs),'dog','dogs'):'no dog now'):'highChairs'===e?d.push(t.highChairs?w(Number(t.highChairs),'high chair','high chairs'):'no high chair now'):'wheelchair'===e?d.push(t.wheelchair?w(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now'):'partySize'===e?d.push(`covers ${n.partySize} to ${t.partySize}`):'time'===e?d.push(`time ${n.time} to ${t.time}`):'date'===e?d.push(`date ${n.date} to ${t.date}`):'table'===e?d.push(t.table?`table ${t.table}`:'table taken off'):'status'===e?d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`):'occasion'===e?d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off'):'area'===e?d.push(t.area?`area ${t.area}`:'any area'):'duration'===e?d.push(t.duration?`table time ${t.duration} min`:'table time as usual'):d.push(`${b[e]} changed`);const c=d.join(', ');return`${c.charAt(0).toUpperCase()}${c.slice(1)} by ${s} ${N(o)}`}const k=e=>e.map(e=>b[e]).join(', ')},1130,[1121,1115]); +__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 n}}),_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 d}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return l}}),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}}),_e.changedFields=N,_e.historyText=k,_e.editPatch=function(t,a,s,o=(new Date).toISOString()){const n=N(t,a);if(!n.length)return{};const d={};for(const c of n)switch(c){case'partySize':d.partySize=(0,e.clampParty)(Number(a.partySize));break;case'phone':case'email':case'table':d[c]=String(a[c]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[c]=String(a[c]??'').trim();break;case'area':d.area=(a.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(a.dogs??0)),d.dog=Number(a.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(a.highChairs??0))||void 0;break;case'wheelchair':d.access={...t.access??{},wheelchair:Math.max(0,Number(a.wheelchair??0))||void 0};break;case'occasion':d.occasion=a.occasion||void 0;break;case'allergies':d.allergies=[...a.allergies??[]],d.allergyNone=!!a.allergyNone&&!(a.allergies??[]).length,d.allergyNote=(a.allergyNote??'').trim()||void 0,(a.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(a.vegan??0)||void 0,vegetarian:Number(a.vegetarian??0)||void 0};break;case'deposit':if(!a.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(a.depositDue??0))),a.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(a.depositDate??'')?a.depositDate:o.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(a.depositAmount??0))),depositPaidBy:s.by.slice(0,80),depositPaidAt:e===o.slice(0,10)?o:`${e}T12:00:00.000Z`,depositMethod:a.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=a.status,'seated'!==a.status||t.seatedAt||(d.seatedAt=o),'finished'!==a.status||t.finishedAt||(d.finishedAt=o),'confirmed'!==a.status&&'pending'!==a.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=a.source||void 0;break;case'tags':d.tags=[...(t.tags??[]).filter(e=>!b.includes(e)),...a.tags??[]];break;case'duration':d.durationMins=Number(a.duration??0)>=15?Number(a.duration):void 0}n.includes('table')&&(d.tableSetHere=!0);const c=t;return d.locallyEdited=!0,d.editedFields=[...new Set([...c.editedFields??[],...n])],d.editLog=[...c.editLog??[],{at:o,by:s.by.slice(0,80),app:s.app,fields:n,text:k(t,a,n,s.by.slice(0,80),o)}].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} ${w(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,s,o,n,d=90,c){const u=[];if(!N(e,s).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return u;const l={...e,date:s.date,time:s.time,partySize:s.partySize,...Number(s.duration??0)>=15?{durationMins:Number(s.duration)}:{}};if(s.table){const e=(0,t.tableOverlaps)(l,s.table,o.filter(e=>e.date===s.date),d);if(e.length&&u.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),c){const e=s.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>c.tables.find(t=>t.name===e)).filter(Boolean),t=e.reduce((e,t)=>e+t.maxSeats,0),o=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),t,s.partySize):null;o&&u.push(o);const n=e.map(e=>c.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(s.dogs??0)>0&&n.length&&u.push(`Dogs aren\u2019t allowed in ${n[0].name}. Pick a dog-friendly table.`)}}n&&u.push(`Bookings are paused ${n.from} to ${n.to}${n.reason?` (${n.reason})`:''}.`);return u},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return M}}),_e.bookingExtras=function(e){const t=e,a=e.dogs??(e.dog?1:0),s=[];a&&s.push(O(a,'dog','dogs'));t.highChairs&&s.push(O(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&s.push(O(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&s.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&s.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&s.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&s.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&s.push(`Deposit by ${t.depositMethod}`);return s.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),a=r(_d[2]);const s='For example: birthday, high chair, dog, window seat',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.',n=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const d=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},c=['date','time','partySize','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration'],u=['card','cash','bank transfer','website','other'],l=[{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',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'},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:(a=e.depositPaidAt,a?a.slice(0,10):''),depositDue:e.depositDue??0,status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0};var a},v=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),$=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'']:[!1]);function P(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return v(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return $(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':return Number(t[e]??0);default:return String(t[e]??'').trim()}}function N(e,t){const a=y(e);return c.filter(e=>P(e,a)!==P(e,t))}const S=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},O=(e,t,a)=>`${e} ${1===e?t:a}`;function k(e,t,a,s,o){const n=y(e),d=[];for(const e of[...a].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))'deposit'===e?t.depositOn?t.depositPaid&&!n.depositPaid?d.push(`deposit marked paid (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&n.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${S(Number(t.depositDue??0))}`):d.push('deposit taken off'):'dogs'===e?d.push(!n.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?O(Number(t.dogs),'dog','dogs'):'no dog now'):'highChairs'===e?d.push(t.highChairs?O(Number(t.highChairs),'high chair','high chairs'):'no high chair now'):'wheelchair'===e?d.push(t.wheelchair?O(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now'):'partySize'===e?d.push(`covers ${n.partySize} to ${t.partySize}`):'time'===e?d.push(`time ${n.time} to ${t.time}`):'date'===e?d.push(`date ${n.date} to ${t.date}`):'table'===e?d.push(t.table?`table ${t.table}`:'table taken off'):'status'===e?d.push(`status ${l.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`):'occasion'===e?d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off'):'area'===e?d.push(t.area?`area ${t.area}`:'any area'):'duration'===e?d.push(t.duration?`table time ${t.duration} min`:'table time as usual'):d.push(`${f[e]} changed`);const c=d.join(', ');return`${c.charAt(0).toUpperCase()}${c.slice(1)} by ${s} ${w(o)}`}const M=e=>e.map(e=>f[e]).join(', ')},1130,[1121,1115,1118]); __d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WALKIN_MATCH_MINS",{enumerable:!0,get:function(){return t}}),e.bookingsNearWalkIn=function(s,o,u,d=3){const c=n(o);return s.filter(t=>t.date===c&&!t.walkIn&&('confirmed'===t.status||'pending'===t.status)&&/^\d{2}:\d{2}/.test(t.time||'')).map(t=>({b:t,d:Math.abs((new Date(`${t.date}T${t.time.slice(0,5)}:00`).getTime()-o.getTime())/6e4)})).filter(n=>n.d<=t).sort((t,n)=>(u?Number(n.b.partySize===u)-Number(t.b.partySize===u):0)||t.d-n.d).slice(0,d).map(t=>t.b)},e.walkInMatchQuestion=function(t){return`Is this ${t.name}, ${t.time.slice(0,5)}, ${t.partySize} ${1===t.partySize?'person':'people'}?`};const t=45,n=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1131,[]); __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 y}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return h}}),_e.cancelWalkInWords=x,_e.reinstateWalkInWords=p,_e.cancelWalkInNow=$,_e.reinstateWalkInNow=I,_e.CancelWalkInButton=function({rid:e,b:t,onDone:l,small:s,big:o}){const[c,u]=(0,n.useState)(!1);return y(t)?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(f.Button,{kind:"secondary",small:s,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>u(!0),style:o?{minHeight:64}:s?{minHeight:44}:w}),c?(0,k.jsx)(j,{rid:e,b:t,onClose:()=>u(!1),onDone:l}):null]}):null},_e.CancelWalkInConfirm=j,_e.ReinstateWalkInButton=function({rid:e,b:t,today:l,onDone:o,small:c}){const[u,y]=(0,n.useState)(!1);if(!h(t,l))return null;const x=p(t);if(!u)return(0,k.jsx)(f.Button,{kind:"ghost",small:c,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>y(!0),style:c?{minHeight:44}:w});return(0,k.jsxs)(f.Sheet,{visible:!0,onClose:()=>y(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,k.jsx)(s.default,{accessible:!0,accessibilityLabel:x,children:(0,k.jsx)(f.T,{size:18,colour:b.colours.text,children:x})}),(0,k.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(f.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[w,{flexGrow:1}],onPress:async()=>{await I(e,t),y(!1),o?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,k.jsx)(f.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>y(!1),style:w})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=(e=l)&&e.__esModule?e:{default:e},o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]);const w={minHeight:56},y=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),h=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function x(e){const t=(0,c.tablesOf)(e.table),n=(0,u.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 p(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 $(e,n){await o.repo.bookings.setStatus(n.id,'cancelled'),await o.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,c.tablesOf)(n.table).forEach(t=>c.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function I(e,t){await o.repo.bookings.setStatus(t.id,'seated'),(0,c.tablesOf)(t.table).forEach(t=>c.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function j({rid:e,b:t,onClose:n,onDone:l}){const o=x(t);return(0,k.jsxs)(f.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,k.jsx)(s.default,{accessible:!0,accessibilityLabel:o,children:(0,k.jsx)(f.T,{size:18,colour:b.colours.text,children:o})}),(0,k.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(f.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[w,{flexGrow:1}],onPress:async()=>{await $(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,c.tablesOf)(t.table).length?` ${(0,u.tablesWords)((0,c.tablesOf)(t.table))} free.`:''}`)}}),(0,k.jsx)(f.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:w})]})]})}},1132,[1133,34,102,874,1025,1118,821,794,25]); __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})]})]})}},1133,[34,102,874,1025,1115,1134,1118,821,1003,892,872,794,25]); __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))}},1134,[]); -__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:a,inStaffApp:n,shiftManager:l,big:o,testID:d}){const[r,u]=(0,t.useState)(!1),x=(0,p.useSession)(e=>e.meId),j=(0,b.useOwner)(e=>e.staff.find(e=>e.id===x&&e.active));return s.walkIn||!(0,h.canEditBooking)({variant:c.APP_VARIANT,inStaffApp:n,role:a,shiftManager:l})||x&&!(0,m.canChangeBookings)(j)?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.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}}),r?(0,T.jsx)(B,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:a,hidePrivate:n}){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,60);return o?(0,T.jsx)(B,{rid:e,id:o,who:i,hidePrivate:n,onClose:a}):(0,T.jsxs)(f.Sheet,{visible:!0,onClose:a,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,T.jsx)(f.T,{size:16,colour:j.colours.text,children:"Tip: tap the booking you want to change."}),r.length?r.map(e=>(0,T.jsx)(f.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${e.date===s?'Today':e.date} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${e.date===s?'today':e.date}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56,alignItems:'flex-start'}},e.id)):(0,T.jsx)(f.Muted,{children:"No bookings to edit from today on."}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:a,style:{minHeight:44}})]})},_e.EditBookingSheet=B;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),a=_r(_d[3]),n=(e=a)&&e.__esModule?e:{default:e},l=_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]),j=_r(_d[15]),y=_r(_d[16]),D=_r(_d[17]),C=_r(_d[18]),I=_r(_d[19]),f=_r(_d[20]),T=_r(_d[21]);const v=/^([01]\d|2[0-3]):[0-5]\d$/,w=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const k=e=>e?(e/100).toFixed(e%100?2:0):'',S=e=>{const t=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(t)&&t>=0?Math.round(100*t):NaN},P=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',$=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')}`:''},N=e=>e.charAt(0).toUpperCase()+e.slice(1);function E({title:e,children:t,testID:s}){return(0,T.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,T.jsx)(f.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const z=({label:e,value:t,onChange:s,max:i=20,testID:a})=>(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:e}),(0,T.jsx)(f.Stepper,{testID:a,value:t,min:0,max:i,onChange:s,label:e})]});function B({rid:e,id:a,who:p,onClose:b,hidePrivate:m='display'===c.APP_VARIANT}){const B=(0,l.useBookings)(e),A=B.find(e=>e.id===a),O=(0,r.useRestaurant)(e),R=(0,o.usePlan)(e),L=(0,d.useBlocks)(e=>e.blocks),[F,W]=(0,t.useState)(A?(0,h.draftOf)(A):null),[M,_]=(0,t.useState)(null),[H,V]=(0,t.useState)(null),[Y,G]=(0,t.useState)(k(A?(0,h.draftOf)(A).depositDue:0)),[U,X]=(0,t.useState)(k(A?(0,h.draftOf)(A).depositAmount:0)),[q,J]=(0,t.useState)(P(A?(0,h.draftOf)(A).depositDate:''));if(!A||!F||!O)return null;const K=e=>{_(null),V(null),W({...F,...e})},Q=w(F.time),Z=v.test(Q),ee=F.area?R.areas.filter(e=>e.name===F.area).map(e=>e.id):null,te=e=>!ee||e.split('+').every(e=>ee.includes(R.tables.find(t=>t.name===e)?.areaId??'')),se=(0,x.tableOptions)(R,B.filter(e=>e.date===F.date),F.table).filter(e=>te(e)||e===F.table),ie=!(F.depositOn&&(Number.isNaN(S(Y||'0'))||F.depositPaid&&(Number.isNaN(S(U||'0'))||q.trim()&&!$(q)))),ae={...F,time:Q,depositDue:S(Y||'0')||0,depositAmount:S(U||'0')||0,depositDate:$(q)},ne=(0,h.changedFields)(A,ae),le=O.settings.turnMins??90,oe=async()=>{const t=(0,h.editPatch)(A,ae,{by:p||'Team member',app:c.APP_VARIANT});if(Object.keys(t).length&&await l.repo.bookings.update(A.id,t),'seated'===A.status&&'table'in t&&t.table!==A.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(A.table),a=s(t.table),n=o.useFloor.getState(),l=i.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!a.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),a.forEach(t=>n.setLive(e,t,{stage:l,dirty:!1}))}V(`Saved. Changed: ${(0,h.editedWords)(ne)}.`),_(null),b()},de=F.allergies??[],re=e=>K({allergyNone:!1,allergies:de.some(t=>t.allergen===e)?de.filter(t=>t.allergen!==e):[...de,{allergen:e,severity:'allergy'}]}),ce=(0,h.historyLines)(A);return(0,T.jsxs)(f.Sheet,{visible:!0,onClose:b,title:`Edit booking \xb7 ${A.name} \xb7 ${A.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,T.jsx)(n.default,{style:{alignItems:'center'},children:(0,T.jsx)(C.DepositChip,{b:A,money:!0,big:!0,testID:"edit-deposit"})}),(0,h.isWixBooking)(A)?(0,T.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:h.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:h.WIX_EDIT_NOTE})}):null,(0,T.jsx)(f.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,T.jsxs)(E,{title:"Deposit",testID:"edit-section-deposit",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No deposit",selected:!F.depositOn,testID:"edit-deposit-none",onPress:()=>K({depositOn:!1,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit due",selected:!!F.depositOn&&!F.depositPaid,testID:"edit-deposit-due",onPress:()=>K({depositOn:!0,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit paid",selected:!!F.depositOn&&!!F.depositPaid,testID:"edit-deposit-paid",onPress:()=>{U||X(Y),q||J(P((0,y.ymd)(new Date))),K({depositOn:!0,depositPaid:!0})}})]}),F.depositOn?(0,T.jsx)(f.Field,{label:"Deposit due (\xa3)",value:Y,onChangeText:e=>{G(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,F.depositOn&&F.depositPaid?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Amount paid (\xa3)",value:U,onChangeText:e=>{X(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"How was it paid?"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.DEPOSIT_METHODS.map(e=>(0,T.jsx)(f.Chip,{label:N(e),selected:F.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>K({depositMethod:e})},e))}),(0,T.jsx)(f.Field,{label:"Date paid (DD/MM/YYYY)",value:q,onChangeText:e=>{J((0,s.slashDate)(e,q)),K({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),q.trim()&&!$(q)?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,ie?null:(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,T.jsx)(f.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,T.jsxs)(E,{title:"When",testID:"edit-section-when",children:[(0,T.jsx)(D.BookingDatePicker,{r:O,today:new Date,value:F.date,onChange:e=>K({date:e})}),(0,T.jsx)(f.Field,{label:"Time (24-hour, for example 19:15)",value:F.time,onChangeText:e=>K({time:e}),testID:"edit-time"}),Z?null:(0,T.jsx)(f.T,{size:15,colour:j.colours.amber,children:"Write the time like 19:15."}),(0,T.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,T.jsx)(f.T,{size:18,center:!0,children:"Covers"}),(0,T.jsx)(i.PartySizeInput,{value:F.partySize,onChange:e=>K({partySize:e}),label:"Covers",testID:"edit-covers"})]}),(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:"Table time"}),(0,T.jsx)(f.Stepper,{testID:"edit-duration",value:F.duration||0,min:0,max:360,step:15,onChange:e=>K({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,T.jsxs)(E,{title:"Where",testID:"edit-section-where",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"Any area",selected:!F.area,testID:"edit-area-any",onPress:()=>K({area:''})}),R.areas.map(e=>(0,T.jsx)(f.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:F.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>K({area:e.name})},e.id))]}),(0,T.jsx)(f.T,{size:18,weight:"semibold",center:!0,children:(0,x.tableButtonLabel)(F.table)}),(0,T.jsxs)(f.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Button,{kind:F.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(F.table?'':', chosen'),onPress:()=>K({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),se.map(e=>(0,T.jsx)(f.Button,{kind:e===F.table?'primary':'secondary',label:(0,x.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,x.tableButtonLabel)(e)}${e===F.table?', chosen':''}`,onPress:()=>K({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,T.jsxs)(E,{title:"Guest",testID:"edit-section-guest",children:[(0,T.jsx)(f.Field,{label:"Name",value:F.name,onChangeText:e=>K({name:e}),testID:"edit-name"}),m?(0,T.jsx)(f.Muted,{center:!0,children:"Phone and email can be changed in the Managers app. Use Show number on the booking to see the number."}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Phone",value:F.phone,onChangeText:e=>K({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,T.jsx)(f.Field,{label:"Email",value:F.email,onChangeText:e=>K({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Booked by"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.SOURCES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>K({source:e.id})},e.id))}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.TAGS.map(e=>{const t=(F.tags??[]).includes(e);return(0,T.jsx)(f.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>K({tags:t?(F.tags??[]).filter(t=>t!==e):[...F.tags??[],e].sort()})},e)})})]}),(0,T.jsxs)(E,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,T.jsx)(z,{label:"Dogs",value:F.dogs??0,max:6,onChange:e=>K({dogs:e}),testID:"edit-dogs"}),(0,T.jsx)(z,{label:"High chairs",value:F.highChairs??0,max:10,onChange:e=>K({highChairs:e}),testID:"edit-high-chairs"}),(0,T.jsx)(z,{label:"Wheelchair users",value:F.wheelchair??0,max:10,onChange:e=>K({wheelchair:e}),testID:"edit-wheelchair"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Occasion"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.OCCASIONS.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:(F.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>K({occasion:e.id})},e.id||'none'))})]}),(0,T.jsxs)(E,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No allergies",selected:!!F.allergyNone&&!de.length,testID:"edit-allergy-none",onPress:()=>K({allergyNone:!0,allergies:[]})}),u.ALLERGENS.map(e=>(0,T.jsx)(f.Chip,{label:e.short,selected:de.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>re(e.id)},e.id))]}),de.map(e=>(0,T.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,T.jsxs)(f.T,{size:15,center:!0,children:[u.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:u.SEVERITIES.map(t=>(0,T.jsx)(f.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>K({allergies:de.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,T.jsx)(f.Field,{label:"Anything else about allergies",value:F.allergyNote,onChangeText:e=>K({allergyNote:e}),testID:"edit-allergy-note"}),ne.includes('allergies')&&de.length?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,T.jsx)(z,{label:"Vegan",value:F.vegan??0,max:F.partySize,onChange:e=>K({vegan:e}),testID:"edit-vegan"}),(0,T.jsx)(z,{label:"Vegetarian",value:F.vegetarian??0,max:F.partySize,onChange:e=>K({vegetarian:e}),testID:"edit-vegetarian"})]}),'cancelled'!==A.status?(0,T.jsxs)(E,{title:"Status",testID:"edit-section-status",children:[(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.EDIT_STATUSES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>K({status:e.id})},e.id))}),(0,T.jsx)(f.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,T.jsx)(E,{title:"Notes",testID:"edit-section-notes",children:(0,T.jsx)(f.Field,{label:"Notes",value:F.notes,onChangeText:e=>K({notes:e}),placeholder:h.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),M?(0,T.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:[M.map(e=>(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,H?(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:H}):null,(0,T.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,T.jsx)(f.Button,{label:M?'Save anyway':'Save changes',testID:"edit-save",disabled:!Z||!ie||F.name.trim().length<1||!ne.length,onPress:()=>{const t=Z?(0,d.blockAt)(L,e,F.date,Q):void 0,s=(0,h.editWarnings)(A,ae,B,t,le,R);!s.length||M?oe():_(s)},style:{minHeight:56,flex:1}}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:b,style:{minHeight:56}})]}),ce.length?(0,T.jsx)(E,{title:"Changes",testID:"edit-history",children:ce.slice(0,12).map((e,t)=>(0,T.jsx)(f.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,T.jsx)(I.CancelBookingButton,{rid:e,b:A,name:A.name,big:!0,onDone:()=>b()}),(0,T.jsx)(I.ReinstateBookingButton,{b:A,name:A.name,today:(0,y.ymd)(new Date),onDone:()=>b()})]})}},1135,[34,1059,1120,102,874,1025,1022,876,872,1130,861,1003,892,1023,1115,821,858,1124,1112,1133,794,25]); +__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:a,inStaffApp:n,shiftManager:l,big:o,testID:r}){const[d,u]=(0,t.useState)(!1),x=(0,p.useSession)(e=>e.meId),j=(0,b.useOwner)(e=>e.staff.find(e=>e.id===x&&e.active));return s.walkIn||!(0,h.canEditBooking)({variant:c.APP_VARIANT,inStaffApp:n,role:a,shiftManager:l})||x&&!(0,m.canChangeBookings)(j)?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:r??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),d?(0,T.jsx)(B,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:a,hidePrivate:n}){const[o,r]=(0,t.useState)(null),d=(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,T.jsx)(B,{rid:e,id:o,who:i,hidePrivate:n,onClose:a}):(0,T.jsxs)(f.Sheet,{visible:!0,onClose:a,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),d.length?d.map(e=>(0,T.jsx)(f.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${k(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}, ${k(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>r(e.id),style:{minHeight:56}},e.id)):(0,T.jsx)(f.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:a,style:{minHeight:44}})]})},_e.EditBookingSheet=B;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),a=_r(_d[3]),n=(e=a)&&e.__esModule?e:{default:e},l=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),j=_r(_d[15]),y=_r(_d[16]),D=_r(_d[17]),C=_r(_d[18]),I=_r(_d[19]),f=_r(_d[20]),T=_r(_d[21]);const v=/^([01]\d|2[0-3]):[0-5]\d$/,w=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const k=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,y.ymd)(s)?'Tomorrow':$(e)};const S=e=>e?(e/100).toFixed(e%100?2:0):'',P=e=>{const t=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(t)&&t>=0?Math.round(100*t):NaN},$=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',N=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=>e.charAt(0).toUpperCase()+e.slice(1);function z({title:e,children:t,testID:s}){return(0,T.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,T.jsx)(f.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const A=({label:e,value:t,onChange:s,max:i=20,testID:a})=>(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:e}),(0,T.jsx)(f.Stepper,{testID:a,value:t,min:0,max:i,onChange:s,label:e})]});function B({rid:e,id:a,who:p,onClose:b,hidePrivate:m='display'===c.APP_VARIANT}){const k=(0,l.useBookings)(e),B=k.find(e=>e.id===a),O=(0,d.useRestaurant)(e),R=(0,o.usePlan)(e),L=(0,r.useBlocks)(e=>e.blocks),[F,W]=(0,t.useState)(B?(0,h.draftOf)(B):null),[M,_]=(0,t.useState)(null),[H,V]=(0,t.useState)(null),[Y,G]=(0,t.useState)(S(B?(0,h.draftOf)(B).depositDue:0)),[U,X]=(0,t.useState)(S(B?(0,h.draftOf)(B).depositAmount:0)),[q,J]=(0,t.useState)($(B?(0,h.draftOf)(B).depositDate:''));if(!B||!F||!O)return null;const K=e=>{_(null),V(null),W({...F,...e})},Q=w(F.time),Z=v.test(Q),ee=F.area?R.areas.filter(e=>e.name===F.area).map(e=>e.id):null,te=e=>!ee||e.split('+').every(e=>ee.includes(R.tables.find(t=>t.name===e)?.areaId??'')),se=(0,x.tableOptions)(R,k.filter(e=>e.date===F.date),F.table).filter(e=>te(e)||e===F.table),ie=!(F.depositOn&&(Number.isNaN(P(Y||'0'))||F.depositPaid&&(Number.isNaN(P(U||'0'))||q.trim()&&!N(q)))),ae={...F,time:Q,depositDue:P(Y||'0')||0,depositAmount:P(U||'0')||0,depositDate:N(q)},ne=(0,h.changedFields)(B,ae),le=O.settings.turnMins??90,oe=async()=>{const t=(0,h.editPatch)(B,ae,{by:p||'Team member',app:c.APP_VARIANT});if(Object.keys(t).length&&await l.repo.bookings.update(B.id,t),'seated'===B.status&&'table'in t&&t.table!==B.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(B.table),a=s(t.table),n=o.useFloor.getState(),l=i.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!a.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),a.forEach(t=>n.setLive(e,t,{stage:l,dirty:!1}))}V(`Saved. Changed: ${(0,h.editedWords)(ne)}.`),_(null),b()},re=F.allergies??[],de=e=>K({allergyNone:!1,allergies:re.some(t=>t.allergen===e)?re.filter(t=>t.allergen!==e):[...re,{allergen:e,severity:'allergy'}]}),ce=(0,h.historyLines)(B);return(0,T.jsxs)(f.Sheet,{visible:!0,onClose:b,title:`Edit booking \xb7 ${B.name} \xb7 ${B.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,T.jsx)(n.default,{style:{alignItems:'center'},children:(0,T.jsx)(C.DepositChip,{b:B,money:!0,big:!0,testID:"edit-deposit"})}),(0,h.isWixBooking)(B)?(0,T.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:h.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:h.WIX_EDIT_NOTE})}):null,(0,T.jsx)(f.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,T.jsxs)(z,{title:"Deposit",testID:"edit-section-deposit",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No deposit",selected:!F.depositOn,testID:"edit-deposit-none",onPress:()=>K({depositOn:!1,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit due",selected:!!F.depositOn&&!F.depositPaid,testID:"edit-deposit-due",onPress:()=>K({depositOn:!0,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit paid",selected:!!F.depositOn&&!!F.depositPaid,testID:"edit-deposit-paid",onPress:()=>{U||X(Y),q||J($((0,y.ymd)(new Date))),K({depositOn:!0,depositPaid:!0})}})]}),F.depositOn?(0,T.jsx)(f.Field,{label:"Deposit due (\xa3)",value:Y,onChangeText:e=>{G(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,F.depositOn&&F.depositPaid?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Amount paid (\xa3)",value:U,onChangeText:e=>{X(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"How was it paid?"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.DEPOSIT_METHODS.map(e=>(0,T.jsx)(f.Chip,{label:E(e),selected:F.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>K({depositMethod:e})},e))}),(0,T.jsx)(f.Field,{label:"Date paid (DD/MM/YYYY)",value:q,onChangeText:e=>{J((0,s.slashDate)(e,q)),K({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),q.trim()&&!N(q)?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,ie?null:(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,T.jsx)(f.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,T.jsxs)(z,{title:"When",testID:"edit-section-when",children:[(0,T.jsx)(D.BookingDatePicker,{r:O,today:new Date,value:F.date,onChange:e=>K({date:e})}),(0,T.jsx)(f.Field,{label:"Time (24-hour, for example 19:15)",value:F.time,onChangeText:e=>K({time:e}),testID:"edit-time"}),Z?null:(0,T.jsx)(f.T,{size:15,colour:j.colours.amber,children:"Write the time like 19:15."}),(0,T.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,T.jsx)(f.T,{size:18,center:!0,children:"Covers"}),(0,T.jsx)(i.PartySizeInput,{value:F.partySize,onChange:e=>K({partySize:e}),label:"Covers",testID:"edit-covers"})]}),(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:"Table time"}),(0,T.jsx)(f.Stepper,{testID:"edit-duration",value:F.duration||0,min:0,max:360,step:15,onChange:e=>K({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,T.jsxs)(z,{title:"Where",testID:"edit-section-where",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"Any area",selected:!F.area,testID:"edit-area-any",onPress:()=>K({area:''})}),R.areas.map(e=>(0,T.jsx)(f.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:F.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>K({area:e.name})},e.id))]}),(0,T.jsx)(f.T,{size:18,weight:"semibold",center:!0,children:(0,x.tableButtonLabel)(F.table)}),(0,T.jsxs)(f.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Button,{kind:F.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(F.table?'':', chosen'),onPress:()=>K({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),se.map(e=>(0,T.jsx)(f.Button,{kind:e===F.table?'primary':'secondary',label:(0,x.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,x.tableButtonLabel)(e)}${e===F.table?', chosen':''}`,onPress:()=>K({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,T.jsxs)(z,{title:"Guest",testID:"edit-section-guest",children:[(0,T.jsx)(f.Field,{label:"Name",value:F.name,onChangeText:e=>K({name:e}),testID:"edit-name"}),m?(0,T.jsx)(f.Muted,{center:!0,children:"Phone and email can be changed in the Managers app. Use Show number on the booking to see the number."}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Phone",value:F.phone,onChangeText:e=>K({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,T.jsx)(f.Field,{label:"Email",value:F.email,onChangeText:e=>K({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Booked by"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.SOURCES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>K({source:e.id})},e.id))}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.TAGS.map(e=>{const t=(F.tags??[]).includes(e);return(0,T.jsx)(f.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>K({tags:t?(F.tags??[]).filter(t=>t!==e):[...F.tags??[],e].sort()})},e)})})]}),(0,T.jsxs)(z,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,T.jsx)(A,{label:"Dogs",value:F.dogs??0,max:6,onChange:e=>K({dogs:e}),testID:"edit-dogs"}),(0,T.jsx)(A,{label:"High chairs",value:F.highChairs??0,max:10,onChange:e=>K({highChairs:e}),testID:"edit-high-chairs"}),(0,T.jsx)(A,{label:"Wheelchair users",value:F.wheelchair??0,max:10,onChange:e=>K({wheelchair:e}),testID:"edit-wheelchair"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Occasion"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.OCCASIONS.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:(F.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>K({occasion:e.id})},e.id||'none'))})]}),(0,T.jsxs)(z,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No allergies",selected:!!F.allergyNone&&!re.length,testID:"edit-allergy-none",onPress:()=>K({allergyNone:!0,allergies:[]})}),u.ALLERGENS.map(e=>(0,T.jsx)(f.Chip,{label:e.short,selected:re.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>de(e.id)},e.id))]}),re.map(e=>(0,T.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,T.jsxs)(f.T,{size:15,center:!0,children:[u.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:u.SEVERITIES.map(t=>(0,T.jsx)(f.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>K({allergies:re.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,T.jsx)(f.Field,{label:"Anything else about allergies",value:F.allergyNote,onChangeText:e=>K({allergyNote:e}),testID:"edit-allergy-note"}),ne.includes('allergies')&&re.length?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,T.jsx)(A,{label:"Vegan",value:F.vegan??0,max:F.partySize,onChange:e=>K({vegan:e}),testID:"edit-vegan"}),(0,T.jsx)(A,{label:"Vegetarian",value:F.vegetarian??0,max:F.partySize,onChange:e=>K({vegetarian:e}),testID:"edit-vegetarian"})]}),'cancelled'!==B.status?(0,T.jsxs)(z,{title:"Status",testID:"edit-section-status",children:[(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.EDIT_STATUSES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>K({status:e.id})},e.id))}),(0,T.jsx)(f.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,T.jsx)(z,{title:"Notes",testID:"edit-section-notes",children:(0,T.jsx)(f.Field,{label:"Notes",value:F.notes,onChangeText:e=>K({notes:e}),placeholder:h.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),M?(0,T.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:[M.map(e=>(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,H?(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:H}):null,(0,T.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,T.jsx)(f.Button,{label:M?'Save anyway':'Save changes',testID:"edit-save",disabled:!Z||!ie||F.name.trim().length<1||!ne.length,onPress:()=>{const t=Z?(0,r.blockAt)(L,e,F.date,Q):void 0,s=(0,h.editWarnings)(B,ae,k,t,le,R);!s.length||M?oe():_(s)},style:{minHeight:56,flex:1}}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:b,style:{minHeight:56}})]}),ce.length?(0,T.jsx)(z,{title:"Changes",testID:"edit-history",children:ce.slice(0,12).map((e,t)=>(0,T.jsx)(f.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,T.jsx)(I.CancelBookingButton,{rid:e,b:B,name:B.name,big:!0,onDone:()=>b()}),(0,T.jsx)(I.ReinstateBookingButton,{b:B,name:B.name,today:(0,y.ymd)(new Date),onDone:()=>b()})]})}},1135,[34,1059,1120,102,874,1025,1022,876,872,1130,861,1003,892,1023,1115,821,858,1124,1112,1133,794,25]); __d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceSlot",{enumerable:!0,get:function(){return w}}),_e.voiceAppFor=h,_e.useVoiceTarget=p,_e.VoiceSlot=function({size:e=56,layer:t=0}){const u=p(),c=(0,n.useRef)(null),l=(0,n.useRef)(y++).current,{width:f,height:h,fontScale:v}=(0,o.default)(),A=()=>{if(t{if(c.current!==e||!s||tu+.5?w.getState().owner===l&&w.setState({rect:null,owner:0}):w.setState({rect:{x:n,y:o,size:s},owner:l})})},W=(0,n.useRef)(A);return W.current=A,(0,n.useLayoutEffect)(()=>{if(u?.on)return S.set(l,{layer:t,measure:()=>W.current()}),()=>{S.delete(l),w.getState().owner===l&&w.setState({rect:null,owner:0}),requestAnimationFrame(b)}},[u?.on,t]),(0,n.useLayoutEffect)(()=>{A();const e=requestAnimationFrame(A);return()=>cancelAnimationFrame(e)},[f,h,v,u?.on]),(0,n.useEffect)(()=>{const e=c.current;if(!u?.on||'undefined'==typeof ResizeObserver||!e?.parentElement)return;const t=new ResizeObserver(A);return t.observe(e.parentElement),e.parentElement.parentElement&&t.observe(e.parentElement.parentElement),()=>t.disconnect()},[u?.on]),(0,n.useEffect)(()=>()=>{w.getState().owner===l&&w.setState({rect:null,owner:0})},[]),(0,n.useEffect)(()=>{u?.on||w.getState().owner!==l||w.setState({rect:null,owner:0})},[u?.on]),u?.on?(0,m.jsx)(s.default,{ref:c,testID:"voice-slot",onLayout:A,style:{width:e,height:e,flexShrink:0}}):null};var t=r(d[0]),n=r(d[1]),o=e(r(d[2])),s=e(r(d[3])),u=r(d[4]),c=r(d[5]),l=r(d[6]),f=r(d[7]),m=r(d[8]);const w=(0,u.create)(()=>({rect:null,owner:0}));function h(e){return'customer'===c.APP_VARIANT||/^\/(customer|table|demo)/.test(e)?null:e.startsWith('/owner')||e.startsWith('/admin')?'owner':e.startsWith('/team')?'staff':e.startsWith('/kitchen')?'chef':e.startsWith('/display')?'display':null}function p(){const e=(0,t.usePathname)()||'/',n=(0,l.useCtx)(6e4),o=(0,f.useVoiceSettings)(e=>e.enabled),s=h(e);if(!s)return null;const u='owner'===s?'owner'===n.role?'owner':'manager'===n.role?'manager':'staff':s;return{app:s,role:u,actions:'staff'===u?'staff':s,on:(0,f.voiceOn)(o,n.rid,u)}}let y=1;const S=new Map,E=()=>{let e=-1;return S.forEach(t=>{t.layer>e&&(e=t.layer)}),e};function b(){const e=E();S.forEach(t=>{t.layer===e&&t.measure()})}},1136,[30,34,426,102,846,872,1084,1137,25]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_ROLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"VOICE_ROLE_LABEL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useVoiceSettings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"voiceOn",{enumerable:!0,get:function(){return f}}),_e.micExplainedFor=function(e){try{if('1'===b()?.getItem(s(e)))return!0}catch{}return u.getState().micExplained},_e.setMicExplainedFor=function(e){try{b()?.setItem(s(e),'1')}catch{}u.getState().setMicExplained(!0)};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},c=r(d[1]),l=r(d[2]);const o=['owner','manager','staff','chef','display'],p={owner:'Owner (Managers app)',manager:'Managers (Managers app)',staff:'Staff app (full voice assistant, no money or HR)',chef:'Head Chef app',display:'Main Display'},u=(0,c.create)()((0,l.persist)(e=>({enabled:{},micExplained:!1,setEnabled:(n,t,c)=>e(e=>({enabled:{...e.enabled,[n]:{...e.enabled[n]??{},[t]:c}}})),setMicExplained:n=>e({micExplained:n})}),{name:'covercharge-voice-v1',version:4,storage:(0,l.createJSONStorage)(()=>t.default),migrate:(e,n)=>({enabled:n<2?{}:e?.enabled??{},micExplained:!!e?.micExplained}),merge:(e,n)=>({...n,enabled:e?.enabled??n.enabled,micExplained:e?.micExplained??n.micExplained}),partialize:e=>({enabled:e.enabled,micExplained:e.micExplained})})),f=(e,n,t)=>!1!==e[n]?.[t],s=e=>`cc-voice-mic-explained-${e}`,b=()=>{try{return'undefined'!=typeof window?window.localStorage:void 0}catch{return}}},1137,[839,846,849]); __d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VAT",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return n}}),e.dishCost=i,Object.defineProperty(e,"gpPct",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"priceForTarget",{enumerable:!0,get:function(){return c}}),e.costings=function(r,c,s,u){const d=(0,t.dishStats)(r);return c.map(t=>{const c=r.find(r=>r.id===t.dishId);if(!c||null==c.price)return null;const p=i(t,s),l=n(c.price),f=o(p,c.price),b=d.find(t=>t.item.id===c.id)?.sold??0;return{item:c,recipe:t,cost:p,priceInc:c.price,priceEx:l,gp:f,cashGp:l-p,below:ft.prevCost&&t.prevCost!==t.cost).map(s=>{const u=(s.cost-(s.prevCost??s.cost))/(s.prevCost??1)*100,d=r.filter(t=>t.lines.some(t=>t.ing===s.id)).map(r=>{const u=t.find(t=>t.id===r.dishId);if(!u||null==u.price)return null;const d=o(i(r,n,{ing:s.id,cost:s.prevCost}),u.price),p=o(i(r,n),u.price);return{item:u,before:d,after:p,dropped:d>=c&&pt.dropped),below:d.filter(t=>t.below)}})},e.weekGp=function(t,r,n){const i=t.reduce((t,r)=>t+r.priceEx*r.soldWeek,0),o=t.reduce((t,r)=>t+r.cost*r.soldWeek,0),c=o+r+Math.max(0,n);return{sales:i,theoCost:o,actualCost:c,theo:i?(i-o)/i*100:0,actual:i?(i-c)/i*100:0}},Object.defineProperty(e,"fmtQty",{enumerable:!0,get:function(){return s}});var t=_r(_d[0]);const r=.2,n=t=>Math.round(t/1.2);function i(t,r,n){return Math.round(t.lines.reduce((t,i)=>{const o=r.find(t=>t.id===i.ing);return t+(n&&n.ing===i.ing?n.cost:o?.cost??0)*i.qty},0))}const o=(t,r)=>{const i=n(r);return i>0?(i-t)/i*100:0},c=(t,r)=>50*Math.ceil(t/(1-r/100)*1.2/50);const s=(t,r)=>`${Number.isInteger(t)?t:t.toFixed(t<1?3:2).replace(/0+$/,'').replace(/\.$/,'')} ${'each'===r?'':r}`.trim()},1138,[1139]); @@ -1384,7 +1384,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}},1301,[827,860,34,102,794,861,867,1154,1302,874,821,25]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1302,[934,988,1154]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1303,[30,34,872,1304,1368,25]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ge}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:b,headerExtra:K,subHeader:He,noVoice:Pe=!1}={}){const Ue=(0,N.default)(),Je=b??Ue.width,Xe=Ue.height,Ze=Je<700,et=Je>=Xe,tt=!Ze&&et&&Je>=600,lt=tt,st=Math.round(Math.min(520,Math.max(Je>=1e3?448:280,.3*Je))),it=$.default.useRef(null),ot=$.default.useRef(0),[nt,at]=(0,T.useState)({w:0,h:0}),rt=(0,X.useOwner)(e=>e.site),dt=(0,Y.useRestaurant)(rt);(0,Ie.useAlertWatcher)(rt,{enabled:!e});const ct=(0,Y.useOrders)(rt),ut=(0,Y.useBookings)(rt),ht=(0,Y.useEvents)(rt),gt=(0,Y.useStore)(e=>e.skipMinutes),bt=(0,Y.useStore)(e=>e.clock.mode),yt=(0,Y.useNow)(5e3),pt=(0,X.useOwner)(e=>e.staff),ft=(0,X.useOwner)(e=>e.attendance),xt=(0,X.useOwner)(e=>e.shifts);$.default.useEffect(()=>{(0,ee.ensureAttendance)((0,q.ymd)(yt),yt)},[(0,q.ymd)(yt)]);const mt=ft.filter(e=>e.in&&!e.out&&yt.getTime()-new Date(e.in).getTime()<72e6&&yt.getTime()>=new Date(e.in).getTime()),jt=Ve(pt.find(e=>e.id===mt[0]?.staffId)?.name)||'Duty Manager',wt=k.IS_CAR?'Car':'Display';(0,v.useSoldOutLink)(!1,e?void 0:wt,!0);const kt=(0,q.ymd)(yt),It=(0,R.useTravelDay)('display',kt),Dt=(0,Z.useFrontDoor)(kt,et),vt=(0,te.useDisplaySettings)(rt),St=vt.privacy,Ct=(0,ce.useSaverSync)(),Tt=(0,te.usePlan)(rt),$t=(0,te.useFloor)(e=>e.live[rt]),Bt=(0,De.useBlocks)(e=>e.blocks),[Rt,Lt]=(0,T.useState)('plan'),[Wt,zt]=(0,T.useState)(!1),[Mt,Ht]=(0,T.useState)('all'),[Pt,Et]=(0,T.useState)(null),[Ot,At]=(0,T.useState)(null),[Nt,_t]=(0,T.useState)(null),[Gt,Vt]=(0,T.useState)(!1),[Ft,Ut]=(0,T.useState)(!1),[Kt,qt]=(0,T.useState)(null),[Yt,Qt]=(0,T.useState)(!1),[Jt,Xt]=(0,T.useState)(!1),[Zt,el]=(0,T.useState)(null),[tl,ll]=(0,T.useState)(null),[sl,il]=(0,T.useState)(null),ol=$.default.useRef(0),nl=e=>{ol.current=Date.now(),il(e)};$.default.useEffect(()=>{if(!sl)return;const e=setInterval(()=>{Date.now()-ol.current>=Te.DAY_IDLE_MS&&il(null)},5e3);return()=>clearInterval(e)},[sl]);const al=(0,Y.useWaitlist)(rt),rl=(0,Y.useStore)(e=>e.walkIns[rt]??0),[dl,cl]=(0,T.useState)(!1),[ul,hl]=(0,T.useState)(!1),[gl,bl]=(0,T.useState)(!1);(0,F.useReviewAlerts)(rt);const[yl,pl]=(0,T.useState)({view:0,content:0}),[fl,xl]=(0,T.useState)(null);$.default.useEffect(()=>{fl&&((0,S.notify)({id:`floor-note:${Date.now()}`,title:fl,timeoutMs:4500,big:!0,testID:'floor-toast'}),xl(null))},[fl]),$.default.useEffect(()=>{if(!e)return(0,L.setDisplaySilent)(!0),()=>(0,L.setDisplaySilent)(!1)},[e]);const[ml,jl]=(0,T.useState)(null),wl=$.default.useRef(0),[kl,Il]=(0,T.useState)(null);$.default.useEffect(()=>{if(!ml)return;wl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-wl.current;if(e>=Ge)return jl(null),void xl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Il(e>=105e3?Math.ceil((Ge-e)/1e3):null)},1e3);return()=>clearInterval(e)},[ml]);const Dl=e=>e.date!==kt?_t({title:`Guest details \xb7 ${(0,Te.dayWord)(e.date,kt)} ${e.time}`,body:(0,Ae.jsx)(Ae.Fragment,{children:(0,me.bookingDetails)(e)})}):_t({title:`Guest details \xb7 ${e.time}`,body:(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(Qe,{rid:rt,id:e.id,turnBase:dt.settings.turnMins}),e.walkIn?null:(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ae.jsx)(ye.CancelWalkInButton,{rid:rt,b:e,big:!0,onDone:e=>{_t(null),xl(e)}}):null,e.walkIn?(0,Ae.jsx)(ye.ReinstateWalkInButton,{rid:rt,b:e,today:kt,onDone:e=>{_t(null),xl(e)}}):null,(0,me.bookingDetails)(e)]})}),vl=ut.filter(e=>e.date===kt).sort((e,t)=>e.time.localeCompare(t.time)),Sl=vl.filter(e=>!['cancelled','noshow'].includes(e.status)),Cl=ct.filter(Fe).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Tl=(0,T.useMemo)(()=>(0,c.forecastToday)(dt,ut,ct,ht,yt),[dt,ut,ct,ht,yt.getTime()/6e4|0]),$l=(0,De.closedAreasAt)(Bt,rt,kt,(0,q.hm)(yt)),Bl=[...$l].join(','),Rl=(0,T.useMemo)(()=>(0,le.floorView)(Tt,ut,ct,$t??{},yt,dt.settings.turnMins,$l),[Tt,ut,ct,$t,yt.getTime(),Bl]),Ll=(0,xe.hoursFor)(dt,yt),Wl=Ll?.open??new Date(`${kt}T12:00:00`),zl=Ll?.close??new Date(`${kt}T21:00:00`),Ml=(0,q.addMins)(Wl,-Wl.getMinutes()),Hl=(0,q.addMins)(zl,30),Pl=e=>new Date(`${kt}T${e}:00`),El=(0,De.blocksOn)(Bt,rt,kt).map(e=>({from:Pl(e.from),to:Pl(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(dt,yt,kt)),Ol=Object.keys(Rl).filter(e=>'blocked'===Rl[e]?.status),Al=sl&&sl!==kt?sl:kt,Nl=Al!==kt,_l=(0,Te.dayWord)(Al,kt),Gl=/^(Today|Yesterday|Tomorrow)$/.test(_l),Vl=Nl?(0,Te.bookingsForDay)(ut,Al,kt).sort((e,t)=>e.time.localeCompare(t.time)):vl,Fl=(0,q.parseYmd)(Al);Fl.setHours(12);const Ul=Nl?(0,xe.hoursFor)(dt,Fl):Ll,Kl=Ul?.open??new Date(`${Al}T12:00:00`),ql=Ul?.close??new Date(`${Al}T21:00:00`),Yl=e=>new Date(`${Al}T${e}:00`),Ql=[...Nl?(0,De.blocksOn)(Bt,rt,Al).map(e=>({from:Yl(e.from),to:Yl(e.to),label:e.reason??'Paused'})):El,...Nl?(0,o.queuedServicePauses)(dt,Fl,Al):[]],Jl=(0,o.queuedServiceSessions)(dt,Fl),Xl=s.IS_QUEUED_VENUE&&(void 0===Jl||!Jl.length),Zl=(0,Ae.jsxs)(A.default,{testID:"queued-hours-gate",style:[We.look.panel,{padding:14,gap:8}],children:[(0,Ae.jsx)(G.T,{weight:"semibold",children:void 0===Jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ae.jsx)(G.Muted,{children:i.queuedVenues[rt]?.hours.note})]}),es=Nl?Ul||Vl.length?AlNl?(0,le.dayFloorView)(Tt,Vl,Al):Rl,[Nl,Tt,Vl,Al,Rl]),[ls,ss]=(0,T.useState)(null),is=Nl?Vl.filter(e=>!['cancelled','noshow'].includes(e.status)):Sl,os=is.reduce((e,t)=>e+t.partySize,0),ns=(0,u.coversSplit)(is,Al),as=(0,$e.cancelledDayTally)(ut,Al),rs=(0,Be.cancellationsFor)(ut,Al,e=>e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)','')),ds=(0,$e.cancelledTallyWords)(as,Gl?_l.toLowerCase():Nl?`on ${_l}`:'today'),cs=Bt.filter(e=>e.rid===rt&&e.date===Al&&!e.removedAt),us=(0,Ce.chartBands)(cs,60*Kl.getHours()+Kl.getMinutes(),60*ql.getHours()+ql.getMinutes()),hs=new Set((0,Ce.blockedHours)(us)),gs=yt.getHours()+(yt.getMinutes()>=30?1:0),bs=Tl.hours.filter(e=>e.hour>=gs&&!hs.has(e.hour)),ys=bs.reduce((e,t)=>e+t.coversHigh,0),ps=bs.reduce((e,t)=>e+t.coversLow,0),fs=Math.round((ps+ys)/2),xs=!Tl.example&&Tl.open&&Tl.enough&&ys>0?`Usually ${(0,c.coversRange)(fs,fs)} more`:void 0,ms=async(e,t)=>{const l=Rl[e]?.booking;if(!l||e===t)return;const s=Rl[t]?.status;if(s&&!['free','soon'].includes(s))return void xl('dirty'===s?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${le.STATUS[s].label.toLowerCase()}. Pick a free table.`);await Y.repo.bookings.update(l.id,{table:t});const i=$t?.[e]?.stage;te.useFloor.getState().setLive(rt,t,{stage:i??'seated',dirty:!1}),te.useFloor.getState().setLive(rt,e,{stage:void 0,dirty:!0}),xl(`${(0,ue.privName)(l,St)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`)},js=tl?ut.find(e=>e.id===tl.id):void 0,ws=tl&&js?(()=>{const e=js.walkIn?(0,ue.privName)(js,St):Ve(js.name),t=(0,fe.seatsOf)(Tt,tl.tables).total,l=(0,fe.seatLine)(t,js.partySize),s=(0,fe.pickClashes)(js,tl.tables,ut.filter(e=>e.date===js.date),dt.settings.turnMins),i=(0,fe.tableKey)(tl.tables)!==(0,fe.tableKey)((0,te.tablesOf)(js.table));return(0,Ae.jsxs)(A.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:Q.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:Q.colours.gold,padding:10},children:[(0,Ae.jsxs)(A.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Te.dayWord)(js.date,kt)} ${js.time}. Tap tables on the plan to add or take them off. ${(0,fe.tablesWords)(tl.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,Ae.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Te.dayWord)(js.date,kt)," ",js.time]}),(0,Ae.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[(0,fe.tablesWords)(tl.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,Ae.jsxs)(G.Row,{gap:8,wrap:!0,children:[(0,Ae.jsx)(G.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,fe.tablesWords)(tl.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(js){try{await(0,pe.saveBookingTables)(rt,js,tl.tables),xl((0,fe.savedWords)(e,js.partySize,tl.tables,t))}catch(t){xl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}ll(null)}else ll(null)}}),(0,Ae.jsx)(G.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>ll(null)})]})]})})():null,ks=Tt.areas.filter(e=>Tt.tables.some(t=>t.areaId===e.id)),Is=e=>{const t=Tt.tables.filter(t=>t.areaId===e);return Nl?`${t.filter(e=>!ts[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Rl[e.name]?.status??'free')).length}/${t.length} free`},Ds='all'===Mt||ks.some(e=>e.id===Mt)?Mt:'all',vs=e=>(0,Ae.jsx)(se.FloorCanvas,{plan:Tt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:tt,big:!0,view:ts,privacy:St,turnBase:dt.settings.turnMins,highlight:tl?tl.tables:Ot?[Ot]:void 0,onTap:e=>{return t=e.name,void(tl?ll(e=>e?{...e,tables:(0,fe.toggleTable)(e.tables,t)}:e):Nl?ss(t):Ot?(t!==Ot&&ms(Ot,t),At(null)):Et(t));var t},onDrop:(e,t)=>tl||Nl?void 0:ms(e.name,t.name)}),Ss=Ze?1:et||ks.length>2?2:1,Cs=e=>{const t=Tt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},Ts=[];for(let e=0;e{const t=(0,se.areaBounds)(Tt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,se.minReadableScale)(Tt,e.id)}}),nt.w,nt.h):null,Bs=e=>(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between',height:ie.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,children:Is(e.id)})]}),Rs=(0,Ae.jsx)(A.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-nt.w)>1||Math.abs(l-nt.h)>1)&&at({w:t,h:l})},children:$s?(0,Ae.jsx)(O.default,{style:{flex:1},scrollEnabled:$s.scroll,showsVerticalScrollIndicator:$s.scroll,contentContainerStyle:{gap:ie.GRID_GAP},children:$s.rows.map((e,t)=>(0,Ae.jsx)(A.default,{style:{height:$s.rowHeights[t],flexDirection:'row',gap:ie.GRID_GAP},children:e.map(e=>{const t=ks.find(t=>t.id===e);return(0,Ae.jsxs)(A.default,{testID:`area-cell-${e}`,style:{width:$s.cellW,gap:2},children:[Bs(t),(0,Ae.jsx)(A.default,{style:{flex:1},children:vs(e)})]},e)})},t))}):null}),Ls=(0,Ae.jsxs)(A.default,{testID:"venue-plan",style:{flex:Ze?void 0:1,gap:10,minWidth:0},children:[(0,Ae.jsx)(r.TableNumberWarning,{plan:Tt}),Tt.tables.length?null:(0,Ae.jsxs)(A.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ae.jsx)(G.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ae.jsx)(G.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS?(0,Ae.jsx)(G.Muted,{center:!0,testID:"display-venue-hours",children:(s.IS_WILDINGS?a.WILDINGS_GUIDE:s.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ae.jsx)(qe,{chipId:"all",compact:!Ze,label:"Whole venue",selected:'all'===Ds,onPress:()=>Ht('all')},"__all"),...ks.map(e=>(0,Ae.jsx)(qe,{chipId:e.id,compact:!Ze,label:`${e.name}${(0,oe.areaMarks)(e)}`,colour:(0,Q.brandColour)(e.colour),sub:Ze?$l.has(e.id)?'closed':Ds===e.id?Is(e.id):void 0:void 0,selected:Ds===e.id,onPress:()=>Ht(e.id)},e.id))];return Ze?(0,Ae.jsx)(A.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ae.jsx)(O.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;pl(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>pl(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:yl.view>0&&yl.content>0&&yl.content<=yl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:yl.view>0&&yl.content<=yl.view+1?'100%':void 0},children:e})})(),(0,Ae.jsx)(g.FloorLegend,{}),ws,Ot?(0,Ae.jsxs)(G.Row,{gap:8,style:{backgroundColor:Q.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ae.jsxs)(G.T,{weight:"semibold",colour:Q.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Ot),": tap the new table."]}),(0,Ae.jsx)(G.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>At(null)})]}):null,'all'===Ds&&tt?Rs:'all'===Ds?(0,Ae.jsx)(A.default,{style:{flex:Ze?void 0:1,gap:12,minHeight:lt?void 0:360},children:Ts.map((e,t)=>(0,Ae.jsxs)(A.default,{style:{flex:Ze?void 0:Math.max(.3,...e.map(e=>Cs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ae.jsxs)(A.default,{style:{flex:1,gap:2},children:[Ze?(0,Ae.jsxs)(A.default,{style:{alignItems:'center',gap:4},children:[(0,Ae.jsxs)(G.T,{center:!0,size:18,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{center:!0,size:14,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.Muted,{center:!0,children:Is(e.id)})]}):(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.Muted,{children:Is(e.id)})]}),(0,Ae.jsx)(A.default,{style:Ze?{height:Math.max(280,Math.round((Je-40)*Cs(e.id)))}:{flex:1},children:vs(e.id)})]},e.id)),e.length{if(Nl)return void el(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rl[t]?Et(t):Dl(e)}},Al)}),zs='timeline'===Rt,Ms=Wt?(0,Ae.jsx)(H.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>zt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ae.jsxs)(A.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:Q.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ae.jsx)(E.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>zt(!1),style:{minHeight:64,minWidth:Je<600?120:180,paddingHorizontal:Je<600?14:22,borderRadius:16,borderWidth:2,borderColor:Q.colours.goldLight,backgroundColor:Q.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(G.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ae.jsx)(A.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ae.jsx)(G.T,{size:22,weight:"semibold",colour:Q.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${Nl?(0,Te.dayLong)(Al):'Today'}`})}),Je<600?null:(0,Ae.jsx)(A.default,{style:{minWidth:180}})]}),Xl?Zl:(0,Ae.jsx)(A.default,{style:{flex:1,minHeight:0},children:(0,Ae.jsx)(re.Timeline,{hideNow:!0,fit:!0,plan:Tt,bookings:Nl?Vl:vl,now:Nl?Kl:yt,privacy:St,turnBase:dt.settings.turnMins,t0:Nl?(0,q.addMins)(Kl,-Kl.getMinutes()):Ml,t1:Nl?(0,q.addMins)(ql,30):Hl,pauses:Nl?Ql:El,blockedTables:Nl?[]:Ol,onOpen:e=>{if(zt(!1),Nl)return void el(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rl[t]?Et(t):Dl(e)}},`full-${Al}`)})]})}):null,Hs=Nl?(0,Ae.jsxs)(A.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:Q.colours.gold,backgroundColor:Q.colours.goldTint},children:[(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:Gl?`Showing ${_l} \xb7 ${(0,q.niceDate)((0,q.parseYmd)(Al))}`:`Showing ${(0,Te.dayWord)(Al,kt)}`}),(0,Ae.jsx)(A.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${ds}. Showing ${(0,Te.dayLong)(Al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ae.jsx)(G.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ll(null),nl(null)},style:{minHeight:44}})]}):null,Ps=(0,Ae.jsx)(A.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:Ze?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,l])=>{const i='timeline'===e===(zs||Wt);return(0,Ae.jsx)(E.default,{testID:l,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Lt('plan'),zt(!0)):(zt(!1),Lt('plan'))},style:{flex:Ze?1:void 0,minHeight:Ze?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?Q.colours.gold:'transparent',...We.look.web(i?{backgroundImage:s.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:s.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Ae.jsx)(G.T,{size:Ze?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Es='display'!==k.APP_VARIANT||e?Ps:(0,Ae.jsxs)(A.default,{testID:"display-view-row",style:{flexDirection:Ze?'column':'row',flexWrap:Ze?'nowrap':'wrap',gap:6,alignItems:Ze?'stretch':'center'},children:[Ps,(0,Ae.jsx)(w.DisplayRotaKitchenButtons,{phone:Ze,shifts:xt,staff:pt,today:kt})]}),Os=(0,h.useBookingWrite)(),As=e=>(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"Walk-in",onPress:Dt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint}),(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"New booking",onPress:Dt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint}),(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Ut(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint})]});(0,Oe.useDisplayNotices)(rt,!e);const Ns=Ze?180:168,[_s,Gs]=(0,T.useState)(Ns),Vs=$.default.useRef(Ns),Fs=$.default.useRef(null),Us=$.default.useRef(null),Ks=()=>{const e=Fs.current,t=Us.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Xe<820?8:12,o=44+(Xe<820?4:8),n=i>Vs.current?Math.ceil(i-Vs.current):Se.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Ns,Math.floor(t-s-l)-n-o));Math.abs(Vs.current-a)>=2&&(Vs.current=a,Gs(a))})})};$.default.useEffect(()=>{const e=setTimeout(Ks,60);return()=>clearTimeout(e)},[Je,Xe]);const qs=(0,Ae.jsxs)(A.default,{ref:Us,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ks()},style:{flexDirection:'row',flexWrap:Je>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ze?12:6,justifyContent:Ze?'center':void 0,borderTopWidth:1,borderTopColor:Q.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ae.jsx)(Ee.DisplayClockButton,{}),(0,Ae.jsx)(ae.HoldToEdit,{quiet:!0,onUnlock:()=>{Il(null),jl({at:Date.now()})},onHint:()=>xl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ae.jsx)(ve.BlockBookingsButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,display:!0,day:Al}),Tt.areas.some(e=>e.outdoor)?(0,Ae.jsx)(ve.CloseGardenButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,short:!0}):null,(0,Ae.jsx)(E.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>bl(!0),style:({pressed:e})=>({...We.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR?null:(0,Ae.jsx)(f.GiftQrButton,{rid:rt,venue:dt.name})]}),Ys=Cl.length?(0,Ae.jsxs)(A.default,{testID:"takeaway-panel",style:[We.look.panel,{overflow:'hidden'}],children:[(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ae.jsx)(G.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ae.jsxs)(G.T,{size:12,colour:Q.colours.muted,children:[Cl.length," live"]})]}),(0,Ae.jsx)(A.default,{style:{padding:10},children:(0,Ae.jsx)(Ye,{list:Cl,me:jt,compact:!0,bookings:ut})})]}):null,Qs=(Le.DueToday,Nl?Vl:vl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Js=Nl?Gl?`${_l}\u2019s guests`:`Guests ${_l}`:'Today\u2019s guests',Xs=(0,Ae.jsxs)(Ae.Fragment,{children:[0===Qs.length?(0,Ae.jsx)(G.Muted,{children:Nl?Al{const t=(0,J.isSeatedHighlight)(e.status,{otherDay:Nl}),l=(0,he.guestRowText)(e,{name:e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)',''),seated:t}),s=Q.colours.text,i=t?Q.colours.goldLight:Q.colours.muted,o=Q.colours.gold,n=l.depositWarn?Q.colours.amber:Q.colours.goldLight;return(0,Ae.jsxs)(E.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Nl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Xt(!1),el(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,J.seatedHighlightStyle)({backgroundColor:e?_e:Ne,borderColor:Q.colours.gold,borderLeftColor:Q.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:Q.colours.hairline,backgroundColor:e?Q.colours.tilePressed:'transparent'},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ae.jsx)(G.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Ae.jsx)(G.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Ae.jsx)(A.default,{style:{paddingTop:2},children:(0,Ae.jsx)(M.AllergyIcon,{text:l.allergy,size:22,colour:Q.colours.amber,ink:Q.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Ae.jsxs)(G.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ae.jsx)(G.T,{size:16,colour:s,children:l.people}),l.deposit?(0,Ae.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,Ae.jsx)(G.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Ae.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}),(0,Ae.jsx)(G.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,Ae.jsx)(G.T,{size:16,children:" "}):null,l.dog?(0,Ae.jsx)(A.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ae.jsx)(ge.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,Ae.jsx)(Re.CancellationsSection,{items:rs,dayWord:Nl?Gl?_l.toLowerCase():`on ${_l}`:'today'})]}),Zs=(0,Ae.jsx)(O.default,{testID:"display-guest-list",accessibilityLabel:Js,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Xs}),ei=P.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Xt(!1)}}),ti=(0,Ae.jsxs)(E.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Js}, ${Qs.length}`,accessibilityState:{expanded:Jt},'aria-expanded':Jt,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Xt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:Jt?Q.colours.gold:Q.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?Q.colours.tilePressed:Jt?Q.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ae.jsx)(G.T,{size:16,weight:"bold",colour:Q.colours.gold,children:Qs.length}),(0,Ae.jsx)(A.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(A.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ae.jsxs)(G.T,{size:13,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,children:[Js," ",Jt?'\u2039':'\u203a']})})})]}),li=Jt?(0,Ae.jsxs)(A.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ae.jsxs)(A.default,{testID:"guests-drawer",...ei.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Je)),backgroundColor:Q.colours.surface,borderRightWidth:1,borderColor:Q.colours.gold,borderRadius:14,...We.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ae.jsxs)(A.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Ae.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Js.toUpperCase()," (",Qs.length,")"]}),(0,Ae.jsx)(l.GoldClose,{testID:"guests-close",label:`Close ${Js}`,onPress:()=>Xt(!1),style:{marginRight:-6}})]}),as.count?(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,testID:"cancelled-day-tally-guests",children:ds}):null]}),Zs]}),(0,Ae.jsx)(E.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Js}`,accessibilityRole:"button",onPress:()=>Xt(!1),style:{flex:1}})]}):null,si=Xl?Zl:s.IS_KIRKTON&&!Object.values(dt.kitchenHours??{}).some(Boolean)?(0,Ae.jsxs)(A.default,{testID:"kirkton-hours-to-confirm",style:[We.look.panel,{padding:14,gap:8}],children:[(0,Ae.jsx)(G.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ae.jsx)(G.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ae.jsx)(Se.DayGraph,{busyThreshold:(0,t.venueBusy)(dt,ut,yt).busy,todays:Vl,open:Kl,close:ql,now:yt,turnBase:dt.settings.turnMins,blocks:cs,pauses:Ql,compact:Ze,dense:!Ze,fit:tt,tight:tt&&Xe<600,height:Ns,forecastNote:Nl?void 0:xs,emptyText:es,past:Al{Nl?Xt(!0):zt(!0)},ai=(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',padding:Xe<820?8:12,paddingTop:Xe<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[It?null:ti,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[It?null:Hs,It?(0,Ae.jsx)(O.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ae.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"})}):zs?Ws:Ls,Ms,li]}),(0,Ae.jsxs)(A.default,{testID:"display-side",style:{width:st,gap:Xe<820?4:8,minHeight:0},children:[(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:As(!1)}),(0,Ae.jsx)(A.default,{style:{flexShrink:0},children:Es}),It?null:(0,Ae.jsx)(A.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,compact:Xe<820,snug:Xe<820,tight:Xe<700,sound:(0,L.flapSoundOn)(),onPress:ni})}),It?null:(0,Ae.jsx)(A.default,{ref:Fs,testID:"day-graph-slot",onLayout:Ks,style:{flexGrow:0,flexShrink:1,flexBasis:Ns+52,minHeight:Xe<600?90:120,overflow:'visible'},children:ii}),(0,Ae.jsxs)(O.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Ae.jsx)(E.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>hl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ae.jsx)(G.T,{center:!0,weight:"semibold",children:"Reviews"})}),Ys,(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt})]})]})]});return(0,Ae.jsxs)(_.SafeAreaView,{style:{flex:1,backgroundColor:Q.colours.bg},onTouchStart:()=>{ol.current=Date.now()},onMouseDown:()=>{ol.current=Date.now()},children:[Ze?(0,Ae.jsxs)(A.default,{style:{flex:1},children:[(0,Ae.jsxs)(O.default,{ref:it,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ae.jsxs)(A.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ae.jsx)(A.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ae.jsx)(j.ExitButton,{})}),(0,Ae.jsx)(U.RestaurantLogo,{rid:rt,size:64}),(0,Ae.jsx)(G.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:dt.name}),(0,Ae.jsx)(U.PoweredBy,{}),(0,Ae.jsx)(C.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ae.jsx)(A.default,{accessible:!0,accessibilityLabel:`Current time ${(0,q.hm)(yt)}`,children:(0,Ae.jsx)(G.T,{center:!0,size:30,weight:"semibold",colour:Q.colours.goldLight,children:(0,q.hm)(yt)})}),(0,Ae.jsx)(Me.ShellfishChip,{rid:rt,by:jt,app:"display",size:"m"}),(0,Ae.jsx)(Me.SundayRoastChip,{rid:rt,by:jt,app:"display",size:"m"}),K]}),He,oi,(0,Ae.jsx)(A.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ae.jsx)(Ke,{phone:!0,split:ns,items:[{label:`Tables \xb7 ${_l}`,value:is.length,testID:'badge-tables'},{label:`Covers \xb7 ${_l}`,value:os,testID:'badge-covers'},{label:'Takeaway',value:Cl.length,alert:Cl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Vt(!0)}]})}),(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{gap:8},children:As(!0)}),(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),Es,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[zs?Ws:Ls,Ms]}),(0,Ae.jsxs)(A.default,{onLayout:e=>{ot.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[We.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ae.jsxs)(G.T,{center:!0,size:20,weight:"semibold",colour:Q.colours.goldLight,accessibilityRole:"header",children:[Js," (",Qs.length,")"]}),(0,Ae.jsx)(A.default,{testID:"display-guest-list",accessibilityLabel:Js,style:{gap:4},children:Xs})]}),Ys,ii,(0,Ae.jsx)(A.default,{testID:"covers-dock",children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,compact:!0,sound:(0,L.flapSoundOn)(),onPress:()=>it.current?.scrollTo({y:ot.current,animated:!0})})}),(0,Ae.jsxs)(A.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ae.jsx)(G.T,{center:!0,size:14,colour:St?Q.colours.muted:Q.colours.amber,children:St?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ae.jsx)(G.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Ae.jsx)(G.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>hl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),qs]}),e?null:(0,Ae.jsx)(A.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:Q.colours.hairline},children:(0,Ae.jsx)(z.VoiceSlot,{size:56})})]}):(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Je>=1e3?18:14,paddingVertical:Xe<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),...We.look.web({backgroundImage:s.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Ae.jsx)(A.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ae.jsx)(U.RestaurantBrand,{rid:dt.id,size:Je<900?32:40,beside:!0})}),(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ae.jsx)(G.T,{size:Je<900?18:21,weight:"semibold",colour:Q.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,q.hm)(yt)}),Je>=900?(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,children:(0,q.niceDate)(yt)}):null]})]}),It?(0,Ae.jsx)(A.default,{style:{width:220}}):(0,Ae.jsx)(A.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:oi}),(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ae.jsx)(Me.ShellfishChip,{rid:rt,by:jt,app:"display",size:Je<1200?'xs':Je<1280||Xe<700?'s':'m'}),(0,Ae.jsx)(E.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.muted,children:"?"})}),'simulated'===bt?(0,Ae.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>gt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(G.T,{size:11,colour:Q.colours.muted,children:"+15"})}):null,e?null:(0,Ae.jsx)(j.ExitButton,{}),K,Pe?null:(0,Ae.jsx)(z.VoiceSlot,{size:44})]})]}),He,It?null:(0,Ae.jsxs)(A.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,Ae.jsx)(Ke,{splitOnly:!0,split:ns,items:[]}),(0,Ae.jsx)(A.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Je>=1e3?18:14)+(e?0:52)+('simulated'===bt?52:0),zIndex:4},children:(0,Ae.jsx)(Me.SundayRoastChip,{rid:rt,by:jt,app:"display",size:Je<1100||Xe<700?'s':'m'})})]}),tt?ai:(ri=(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:As(!1)}),Es]}),(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),It?(0,Ae.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"}):(0,Ae.jsx)(Ae.Fragment,{children:(0,Ae.jsxs)(A.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[ti,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Hs,zs?Ws:Ls,Ms,li]})]})}),Ys,It?null:(0,Ae.jsx)(A.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,sound:(0,L.flapSoundOn)(),onPress:ni})}),It?null:(0,Ae.jsx)(A.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Ns+Se.DAY_GRAPH_CHROME},children:ii})]}),(0,Ae.jsx)(O.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:ri})),qs]}),(0,Ae.jsx)(I.SoldOutStrip,{rid:rt,by:wt,onOpen:()=>bl(!0)}),(0,Ae.jsx)(D.SoldOutSheet,{visible:gl,onClose:()=>bl(!1),rid:rt,by:wt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ae.jsx)(p.TableOrderCue,{rid:rt}),Dt.elements,Ft?(0,Ae.jsx)(y.EditBookingPicker,{rid:rt,today:kt,who:jt,hidePrivate:!0,onClose:()=>Ut(!1)}):null,Kt?(0,Ae.jsx)(y.EditBookingSheet,{rid:rt,id:Kt,who:jt,hidePrivate:!0,onClose:()=>qt(null)}):null,Pt?(0,Ae.jsx)(me.TableSheet,{rid:rt,name:Pt,view:Rl,plan:Tt,todays:vl,now:yt,privacy:St,turnBase:dt.settings.turnMins,onClose:()=>Et(null),onWalkIn:e=>Dt.openWalkInAt(e),onMove:e=>At(e),onDetails:Dl}):null,ls?(()=>{const e=ts[ls],t=e?.dayBookings??[];return(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>ss(null),title:`${(0,d.tableNumbers)(ls)} \xb7 ${Gl?_l:(0,Te.dayLong)(Al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ae.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${Gl?_l.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${Gl?_l.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ue.privName)(e,St):Ve(e.name);return(0,Ae.jsx)(G.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,fe.tablesWords)((0,te.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ss(null),el(e.id)},style:{minHeight:56}},e.id)}),(0,Ae.jsx)(G.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ss(null),style:{minHeight:56}})]})})():null,Zt?(()=>{const e=ut.find(e=>e.id===Zt);return e?(0,Ae.jsx)(be.GuestActionsSheet,{rid:rt,b:e,name:e.walkIn?(0,ue.privName)(e,St):Ve(e.name),view:Rl,now:yt,otherDay:e.date!==kt,turnBase:dt.settings.turnMins,onClose:()=>el(null),onDetails:Dl,onDone:xl,onPickOnPlan:(e,t)=>{Xt(!1),Lt('plan'),Ht('all'),ll({id:e.id,tables:t})}}):null})():null,Nt?(0,Ae.jsx)(me.DetailsPanel,{title:Nt.title,onClose:()=>_t(null),children:Nt.body}):null,Yt?(0,Ae.jsx)(me.ServiceSummary,{r:dt,todays:vl,orders:ct,waitlistAll:al,walkInCount:rl,onClose:()=>Qt(!1)}):null,dl?(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>cl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ae.jsx)(g.FloorLegend,{}),(0,Ae.jsx)(G.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>cl(!1)})]}):null,ul?(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>hl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ae.jsx)(V.ReviewsSection,{rid:rt,mode:"read",venueName:dt.name}),(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>hl(!1)})]}):null,Gt?(0,Ae.jsxs)(me.DetailsPanel,{title:"Takeaway",onClose:()=>Vt(!1),children:[(0,Ae.jsx)(G.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ae.jsx)(Ye,{list:Cl,me:jt,bookings:ut})]}):null,ml?(0,Ae.jsx)(A.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:Q.colours.bg},children:(0,Ae.jsx)(ne.PlanDesigner,{initial:Tt,venue:dt.name,mode:"display",startStep:"arrange",onActivity:()=>{wl.current=Date.now(),null!==kl&&Il(null)},notice:null!==kl?`Locking again in ${kl} s \xb7 touch to keep editing`:null,onSave:e=>{te.useFloor.getState().setPlan(rt,e),jl(null),xl('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{te.useFloor.getState().setPlan(rt,e),xl('Live seating plan updated on every screen.')},onCancel:()=>{jl(null),xl('No changes kept. Editing is locked again.')}},ml.at)}):null,e?null:(0,Ae.jsx)(de.Screensaver,{rid:rt,idleMins:vt.idleMins,pinOn:vt.pinOn,wake:vt,tonightCards:vt.tonightCards,cfg:Ct}),e?null:(0,Ae.jsx)(we.PrintHost,{rid:rt}),e?null:(0,Ae.jsx)(je.AlertHost,{variant:"display",rid:rt,skipTakeaway:!0}),e?null:(0,Ae.jsx)(W.SeatAllergenReminder,{rid:rt}),e?null:(0,Ae.jsx)(ke.TakeawayTakeover,{rid:rt,me:jt})]});var ri};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=e(T),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=_r(_d[30]),z=_r(_d[31]),M=_r(_d[32]),H=e(_r(_d[33])),P=e(_r(_d[34])),E=e(_r(_d[35])),O=e(_r(_d[36])),A=e(_r(_d[37])),N=e(_r(_d[38])),_=_r(_d[39]),G=_r(_d[40]),V=_r(_d[41]),F=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]),Pe=_r(_d[88]),Ee=_r(_d[89]),Oe=_r(_d[90]),Ae=_r(_d[91]);const Ne='#221C12',_e='#2E2618',Ge=12e4,Ve=e=>(e??'').replace(' (example)',''),Fe=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Ue=e=>e.slotTime?(0,q.hm)(new Date(e.slotTime)):'ASAP';function Ke({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,Ae.jsxs)(A.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Ae.jsx)(A.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,Ae.jsxs)(A.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,Ae.jsx)(G.T,{size:l?24:19,weight:"semibold",colour:e.alert?Q.colours.amber:Q.colours.text,children:e.value}),(0,Ae.jsx)(G.T,{size:l?14:12,colour:Q.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ae.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ae.jsx)($.default.Fragment,{children:i},e.testID)})}),s?(0,Ae.jsx)(A.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,Ae.jsx)(G.T,{size:14,colour:Q.colours.muted,children:"No Covers yet"}):(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ae.jsx)(G.T,{size:i?13:14,weight:"semibold",colour:Q.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,Ae.jsx)(G.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,Ae.jsxs)(A.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:Q.colours.gold},children:[(0,Ae.jsx)(A.default,{style:{width:`${s.walkInPct}%`,backgroundColor:Q.colours.gold}}),(0,Ae.jsx)(A.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function qe({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,Ae.jsxs)(E.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Ae.jsx)(A.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Ae.jsx)(G.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?Q.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,Ae.jsx)(G.T,{size:12,colour:Q.colours.muted,children:l}):null]})}function Ye({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,Pe.statusBlock)(e,t,(0,Pe.linkedBooking)(e,s));return e.length?(0,Ae.jsx)(A.default,{style:{gap:8},children:e.map(e=>(0,Ae.jsxs)(A.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:Q.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?Q.colours.ok:e.allergies.length?Q.colours.red:Q.colours.gold},children:[(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Ae.jsxs)(G.T,{size:l?16:18,weight:"bold",children:[Ue(e)," \xb7 ",Ve(e.customerName)]}),(0,Ae.jsx)(G.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,Ae.jsxs)(G.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,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:Q.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,K.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ae.jsx)(He.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ae.jsxs)(G.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ae.jsx)(G.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>Y.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Ae.jsx)(G.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Ae.jsx)(G.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Ae.jsx)(we.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ae.jsx)(G.Muted,{children:"No takeaway orders right now."})}function Qe({rid:e,id:t,turnBase:l}){const s=(0,Y.useBookings)(e).find(e=>e.id===t);return s?(0,Ae.jsx)(b.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1304,[1141,796,5,6,1305,828,853,1117,860,1140,1306,1307,1308,1114,1135,1309,1310,1315,1316,1317,872,1318,1153,980,1122,1319,34,1094,1172,1044,1110,1136,1320,395,380,402,295,102,426,36,794,1204,1208,873,861,858,874,821,1113,892,1119,1084,1025,1100,1127,1321,1126,1322,1329,1331,1334,1337,1333,1338,1340,1341,1132,1116,1118,878,1345,1193,1346,1203,1195,1022,1351,1359,1360,1097,1134,1362,1363,1364,1166,1365,1165,1159,869,1366,1367,25]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ge}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:b,headerExtra:K,subHeader:Me,noVoice:Pe=!1}={}){const Ue=(0,N.default)(),Je=b??Ue.width,Xe=Ue.height,Ze=Je<700,et=Je>=Xe,tt=!Ze&&et&&Je>=600,st=tt,lt=Math.round(Math.min(520,Math.max(Je>=1e3?448:280,.3*Je))),it=$.default.useRef(null),ot=$.default.useRef(0),[nt,at]=(0,T.useState)({w:0,h:0}),rt=(0,X.useOwner)(e=>e.site),dt=(0,Y.useRestaurant)(rt);(0,Ie.useAlertWatcher)(rt,{enabled:!e});const ct=(0,Y.useOrders)(rt),ut=(0,Y.useBookings)(rt),ht=(0,Y.useEvents)(rt),gt=(0,Y.useStore)(e=>e.skipMinutes),bt=(0,Y.useStore)(e=>e.clock.mode),yt=(0,Y.useNow)(5e3),pt=(0,X.useOwner)(e=>e.staff),ft=(0,X.useOwner)(e=>e.attendance),mt=(0,X.useOwner)(e=>e.shifts);$.default.useEffect(()=>{(0,ee.ensureAttendance)((0,q.ymd)(yt),yt)},[(0,q.ymd)(yt)]);const xt=ft.filter(e=>e.in&&!e.out&&yt.getTime()-new Date(e.in).getTime()<72e6&&yt.getTime()>=new Date(e.in).getTime()),jt=Fe(pt.find(e=>e.id===xt[0]?.staffId)?.name)||'Duty Manager',wt=k.IS_CAR?'Car':'Display';(0,D.useSoldOutLink)(!1,e?void 0:wt,!0);const kt=(0,q.ymd)(yt),It=(0,R.useTravelDay)('display',kt),vt=(0,Z.useFrontDoor)(kt,et),Dt=(0,te.useDisplaySettings)(rt),St=Dt.privacy,Ct=(0,ce.useSaverSync)(),Tt=(0,te.usePlan)(rt),$t=(0,te.useFloor)(e=>e.live[rt]),Bt=(0,ve.useBlocks)(e=>e.blocks),[Rt,Lt]=(0,T.useState)('plan'),[zt,Wt]=(0,T.useState)(!1),[Ht,Mt]=(0,T.useState)('all'),[Pt,Et]=(0,T.useState)(null),[At,Ot]=(0,T.useState)(null),[Nt,_t]=(0,T.useState)(null),[Gt,Ft]=(0,T.useState)(!1),[Vt,Ut]=(0,T.useState)(!1),[Kt,qt]=(0,T.useState)(null),[Yt,Qt]=(0,T.useState)(!1),[Jt,Xt]=(0,T.useState)(!1),[Zt,es]=(0,T.useState)(null),[ts,ss]=(0,T.useState)(null),[ls,is]=(0,T.useState)(null),os=$.default.useRef(0),ns=e=>{os.current=Date.now(),is(e)};$.default.useEffect(()=>{if(!ls)return;const e=setInterval(()=>{Date.now()-os.current>=Te.DAY_IDLE_MS&&is(null)},5e3);return()=>clearInterval(e)},[ls]);const as=(0,Y.useWaitlist)(rt),rs=(0,Y.useStore)(e=>e.walkIns[rt]??0),[ds,cs]=(0,T.useState)(!1),[us,hs]=(0,T.useState)(!1),[gs,bs]=(0,T.useState)(!1);(0,V.useReviewAlerts)(rt);const[ys,ps]=(0,T.useState)({view:0,content:0}),[fs,ms]=(0,T.useState)(null);$.default.useEffect(()=>{fs&&((0,S.notify)({id:`floor-note:${Date.now()}`,title:fs,timeoutMs:4500,big:!0,testID:'floor-toast'}),ms(null))},[fs]),$.default.useEffect(()=>{if(!e)return(0,L.setDisplaySilent)(!0),()=>(0,L.setDisplaySilent)(!1)},[e]);const[xs,js]=(0,T.useState)(null),ws=$.default.useRef(0),[ks,Is]=(0,T.useState)(null);$.default.useEffect(()=>{if(!xs)return;ws.current=Date.now();const e=setInterval(()=>{const e=Date.now()-ws.current;if(e>=Ge)return js(null),void ms('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Is(e>=105e3?Math.ceil((Ge-e)/1e3):null)},1e3);return()=>clearInterval(e)},[xs]);const vs=e=>e.date!==kt?_t({title:`Guest details \xb7 ${(0,Te.dayWord)(e.date,kt)} ${e.time}`,body:(0,Oe.jsxs)(Oe.Fragment,{children:[!e.walkIn&&e.date>kt?(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Te.dayWord)(e.date,kt)}, ${e.time}`,disabled:!Fl.ok,accessibilityHint:Fl.hint,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}):null,(0,xe.bookingDetails)(e)]})}):_t({title:`Guest details \xb7 ${e.time}`,body:(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsx)(Qe,{rid:rt,id:e.id,turnBase:dt.settings.turnMins}),e.walkIn?null:(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}),e.walkIn?(0,Oe.jsx)(ye.CancelWalkInButton,{rid:rt,b:e,big:!0,onDone:e=>{_t(null),ms(e)}}):null,e.walkIn?(0,Oe.jsx)(ye.ReinstateWalkInButton,{rid:rt,b:e,today:kt,onDone:e=>{_t(null),ms(e)}}):null,(0,xe.bookingDetails)(e)]})}),Ds=ut.filter(e=>e.date===kt).sort((e,t)=>e.time.localeCompare(t.time)),Ss=Ds.filter(e=>!['cancelled','noshow'].includes(e.status)),Cs=ct.filter(Ve).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ts=(0,T.useMemo)(()=>(0,c.forecastToday)(dt,ut,ct,ht,yt),[dt,ut,ct,ht,yt.getTime()/6e4|0]),$s=(0,ve.closedAreasAt)(Bt,rt,kt,(0,q.hm)(yt)),Bs=[...$s].join(','),Rs=(0,T.useMemo)(()=>(0,se.floorView)(Tt,ut,ct,$t??{},yt,dt.settings.turnMins,$s),[Tt,ut,ct,$t,yt.getTime(),Bs]),Ls=(0,me.hoursFor)(dt,yt),zs=Ls?.open??new Date(`${kt}T12:00:00`),Ws=Ls?.close??new Date(`${kt}T21:00:00`),Hs=(0,q.addMins)(zs,-zs.getMinutes()),Ms=(0,q.addMins)(Ws,30),Ps=e=>new Date(`${kt}T${e}:00`),Es=(0,ve.blocksOn)(Bt,rt,kt).map(e=>({from:Ps(e.from),to:Ps(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(dt,yt,kt)),As=Object.keys(Rs).filter(e=>'blocked'===Rs[e]?.status),Os=ls&&ls!==kt?ls:kt,Ns=Os!==kt,_s=(0,Te.dayWord)(Os,kt),Gs=/^(Today|Yesterday|Tomorrow)$/.test(_s),Fs=Ns?(0,Te.bookingsForDay)(ut,Os,kt).sort((e,t)=>e.time.localeCompare(t.time)):Ds,Vs=(0,q.parseYmd)(Os);Vs.setHours(12);const Us=Ns?(0,me.hoursFor)(dt,Vs):Ls,Ks=Us?.open??new Date(`${Os}T12:00:00`),qs=Us?.close??new Date(`${Os}T21:00:00`),Ys=e=>new Date(`${Os}T${e}:00`),Qs=[...Ns?(0,ve.blocksOn)(Bt,rt,Os).map(e=>({from:Ys(e.from),to:Ys(e.to),label:e.reason??'Paused'})):Es,...Ns?(0,o.queuedServicePauses)(dt,Vs,Os):[]],Js=(0,o.queuedServiceSessions)(dt,Vs),Xs=l.IS_QUEUED_VENUE&&(void 0===Js||!Js.length),Zs=(0,Oe.jsxs)(O.default,{testID:"queued-hours-gate",style:[ze.look.panel,{padding:14,gap:8}],children:[(0,Oe.jsx)(G.T,{weight:"semibold",children:void 0===Js?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Oe.jsx)(G.Muted,{children:i.queuedVenues[rt]?.hours.note})]}),el=Ns?Us||Fs.length?OsNs?(0,se.dayFloorView)(Tt,Fs,Os):Rs,[Ns,Tt,Fs,Os,Rs]),[sl,ll]=(0,T.useState)(null),[il,ol]=(0,T.useState)(null),[nl,al]=(0,T.useState)(null),rl=Ns?Fs.filter(e=>!['cancelled','noshow'].includes(e.status)):Ss,dl=rl.reduce((e,t)=>e+t.partySize,0),cl=(0,u.coversSplit)(rl,Os),ul=(0,$e.cancelledDayTally)(ut,Os),hl=(0,Be.cancellationsFor)(ut,Os,e=>e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)','')),gl=(0,$e.cancelledTallyWords)(ul,Gs?_s.toLowerCase():Ns?`on ${_s}`:'today'),bl=Bt.filter(e=>e.rid===rt&&e.date===Os&&!e.removedAt),yl=(0,Ce.chartBands)(bl,60*Ks.getHours()+Ks.getMinutes(),60*qs.getHours()+qs.getMinutes()),pl=new Set((0,Ce.blockedHours)(yl)),fl=yt.getHours()+(yt.getMinutes()>=30?1:0),ml=Ts.hours.filter(e=>e.hour>=fl&&!pl.has(e.hour)),xl=ml.reduce((e,t)=>e+t.coversHigh,0),jl=ml.reduce((e,t)=>e+t.coversLow,0),wl=Math.round((jl+xl)/2),kl=!Ts.example&&Ts.open&&Ts.enough&&xl>0?`Usually ${(0,c.coversRange)(wl,wl)} more`:void 0,Il=async(e,t)=>{const s=Rs[e]?.booking;if(!s||e===t)return;const l=Rs[t]?.status;if(l&&!['free','soon'].includes(l))return void ms('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${se.STATUS[l].label.toLowerCase()}. Pick a free table.`);await Y.repo.bookings.update(s.id,{table:t});const i=$t?.[e]?.stage;te.useFloor.getState().setLive(rt,t,{stage:i??'seated',dirty:!1}),te.useFloor.getState().setLive(rt,e,{stage:void 0,dirty:!0}),ms(`${(0,ue.privName)(s,St)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`)},vl=e=>{if(ts)return ol(null),void ss(t=>t?{...t,tables:(0,fe.toggleTable)(t.tables,e)}:t);Ns?ll(e):At?(e!==At&&Il(At,e),Ot(null)):Et(e)},Dl=ts?ut.find(e=>e.id===ts.id):void 0,Sl=ts&&Dl?(()=>{const e=Dl.walkIn?(0,ue.privName)(Dl,St):Fe(Dl.name),t=(0,fe.seatsOf)(Tt,ts.tables).total,s=(0,fe.seatLine)(t,Dl.partySize),l=(0,fe.pickClashes)(Dl,ts.tables,ut.filter(e=>e.date===Dl.date),dt.settings.turnMins),i=(0,fe.tableKey)(ts.tables)!==(0,fe.tableKey)((0,te.tablesOf)(Dl.table));return(0,Oe.jsxs)(O.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:Q.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:Q.colours.gold,padding:10},children:[(0,Oe.jsxs)(O.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Te.dayWord)(Dl.date,kt)} ${Dl.time}. Tap tables on the plan to add or take them off. ${(0,fe.tablesWords)(ts.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Te.dayWord)(Dl.date,kt)," ",Dl.time]}),(0,Oe.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[(0,fe.tablesWords)(ts.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),il?(0,Oe.jsx)(O.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:il,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:Q.colours.amber,backgroundColor:Q.colours.amberBg},children:(0,Oe.jsx)(G.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:il})}):null,(0,Oe.jsxs)(G.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Oe.jsx)(G.Button,{testID:il?'plan-pick-overcap-yes':'plan-pick-save',label:il?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${il?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,fe.tablesWords)(ts.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Dl)return void ss(null);const s=(0,fe.overCapacityAsk)(ts.tables,t,Dl.partySize);if(!s||il){ol(null);try{await(0,pe.saveBookingTables)(rt,Dl,ts.tables),ms((0,fe.savedWords)(e,Dl.partySize,ts.tables,t))}catch(t){ms(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}ss(null)}else ol(s)}}),(0,Oe.jsx)(G.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{ol(null),ss(null)}})]})]})})():null,Cl=Tt.areas.filter(e=>Tt.tables.some(t=>t.areaId===e.id)),Tl=e=>{const t=Tt.tables.filter(t=>t.areaId===e);return Ns?`${t.filter(e=>!tl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Rs[e.name]?.status??'free')).length}/${t.length} free`},$l='all'===Ht||Cl.some(e=>e.id===Ht)?Ht:'all',Bl=e=>(0,Oe.jsx)(le.FloorCanvas,{plan:Tt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:tt,big:!0,view:tl,privacy:St,turnBase:dt.settings.turnMins,highlight:ts?ts.tables:At?[At]:void 0,onTap:e=>vl(e.name),onDrop:(e,t)=>ts||Ns?void 0:Il(e.name,t.name)}),Rl=Ze?1:et||Cl.length>2?2:1,Ll=e=>{const t=Tt.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},zl=[];for(let e=0;e{const t=(0,le.areaBounds)(Tt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,le.minReadableScale)(Tt,e.id)}}),nt.w,nt.h):null,Hl=e=>(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between',height:ie.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,children:Tl(e.id)})]}),Ml=(0,Oe.jsx)(O.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-nt.w)>1||Math.abs(s-nt.h)>1)&&at({w:t,h:s})},children:Wl?(0,Oe.jsx)(A.default,{style:{flex:1},scrollEnabled:Wl.scroll,showsVerticalScrollIndicator:Wl.scroll,contentContainerStyle:{gap:ie.GRID_GAP},children:Wl.rows.map((e,t)=>(0,Oe.jsx)(O.default,{style:{height:Wl.rowHeights[t],flexDirection:'row',gap:ie.GRID_GAP},children:e.map(e=>{const t=Cl.find(t=>t.id===e);return(0,Oe.jsxs)(O.default,{testID:`area-cell-${e}`,style:{width:Wl.cellW,gap:2},children:[Hl(t),(0,Oe.jsx)(O.default,{style:{flex:1},children:Bl(e)})]},e)})},t))}):null}),Pl=(0,Oe.jsxs)(O.default,{testID:"venue-plan",style:{flex:Ze?void 0:1,gap:10,minWidth:0},children:[(0,Oe.jsx)(r.TableNumberWarning,{plan:Tt}),Tt.tables.length?null:(0,Oe.jsxs)(O.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Oe.jsx)(G.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Oe.jsx)(G.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,Oe.jsx)(G.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,Oe.jsx)(qe,{chipId:"all",compact:!Ze,label:"Whole venue",selected:'all'===$l,onPress:()=>Mt('all')},"__all"),...Cl.map(e=>(0,Oe.jsx)(qe,{chipId:e.id,compact:!Ze,label:`${e.name}${(0,oe.areaMarks)(e)}`,colour:(0,Q.brandColour)(e.colour),sub:Ze?$s.has(e.id)?'closed':$l===e.id?Tl(e.id):void 0:void 0,selected:$l===e.id,onPress:()=>Mt(e.id)},e.id))];return Ze?(0,Oe.jsx)(O.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Oe.jsx)(A.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;ps(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>ps(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:ys.view>0&&ys.content>0&&ys.content<=ys.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:ys.view>0&&ys.content<=ys.view+1?'100%':void 0},children:e})})(),(0,Oe.jsx)(g.FloorLegend,{}),Sl,At?(0,Oe.jsxs)(G.Row,{gap:8,style:{backgroundColor:Q.colours.goldTint,borderRadius:10,padding:8},children:[(0,Oe.jsxs)(G.T,{weight:"semibold",colour:Q.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(At),": tap the new table."]}),(0,Oe.jsx)(G.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ot(null)})]}):null,'all'===$l&&tt?Ml:'all'===$l?(0,Oe.jsx)(O.default,{style:{flex:Ze?void 0:1,gap:12,minHeight:st?void 0:360},children:zl.map((e,t)=>(0,Oe.jsxs)(O.default,{style:{flex:Ze?void 0:Math.max(.3,...e.map(e=>Ll(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Oe.jsxs)(O.default,{style:{flex:1,gap:2},children:[Ze?(0,Oe.jsxs)(O.default,{style:{alignItems:'center',gap:4},children:[(0,Oe.jsxs)(G.T,{center:!0,size:18,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{center:!0,size:14,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.Muted,{center:!0,children:Tl(e.id)})]}):(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.Muted,{children:Tl(e.id)})]}),(0,Oe.jsx)(O.default,{style:Ze?{height:Math.max(280,Math.round((Je-40)*Ll(e.id)))}:{flex:1},children:Bl(e.id)})]},e.id)),e.length{if(Ns)return void es(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rs[t]?Et(t):vs(e)}},Os)}),Al='timeline'===Rt,Ol=zt?(0,Oe.jsx)(M.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Wt(!1),supportedOrientations:['landscape','portrait'],children:(0,Oe.jsxs)(O.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:Q.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Oe.jsx)(E.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Wt(!1),style:{minHeight:64,minWidth:Je<600?120:180,paddingHorizontal:Je<600?14:22,borderRadius:16,borderWidth:2,borderColor:Q.colours.goldLight,backgroundColor:Q.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(G.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Oe.jsx)(O.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Oe.jsx)(G.T,{size:22,weight:"semibold",colour:Q.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${Ns?(0,Te.dayLong)(Os):'Today'}`})}),Je<600?null:(0,Oe.jsx)(O.default,{style:{minWidth:180}})]}),Xs?Zs:(0,Oe.jsx)(O.default,{style:{flex:1,minHeight:0},children:(0,Oe.jsx)(re.Timeline,{hideNow:!0,fit:!0,plan:Tt,bookings:Ns?Fs:Ds,now:Ns?Ks:yt,privacy:St,turnBase:dt.settings.turnMins,t0:Ns?(0,q.addMins)(Ks,-Ks.getMinutes()):Hs,t1:Ns?(0,q.addMins)(qs,30):Ms,pauses:Ns?Qs:Es,blockedTables:Ns?[]:As,onOpen:e=>{if(Wt(!1),Ns)return void es(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rs[t]?Et(t):vs(e)}},`full-${Os}`)})]})}):null,Nl=Ns?(0,Oe.jsxs)(O.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:Q.colours.gold,backgroundColor:Q.colours.goldTint},children:[(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:Gs?`Showing ${_s} \xb7 ${(0,q.niceDate)((0,q.parseYmd)(Os))}`:`Showing ${(0,Te.dayWord)(Os,kt)}`}),(0,Oe.jsx)(O.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${gl}. Showing ${(0,Te.dayLong)(Os)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Oe.jsx)(G.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ss(null),ns(null)},style:{minHeight:44}})]}):null,_l=(0,Oe.jsx)(O.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:Ze?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(Al||zt);return(0,Oe.jsx)(E.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?(Lt('plan'),Wt(!0)):(Wt(!1),Lt('plan'))},style:{flex:Ze?1:void 0,minHeight:Ze?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?Q.colours.gold:'transparent',...ze.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,Oe.jsx)(G.T,{size:Ze?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Gl='display'!==k.APP_VARIANT||e?_l:(0,Oe.jsxs)(O.default,{testID:"display-view-row",style:{flexDirection:Ze?'column':'row',flexWrap:Ze?'nowrap':'wrap',gap:6,alignItems:Ze?'stretch':'center'},children:[_l,(0,Oe.jsx)(w.DisplayRotaKitchenButtons,{phone:Ze,shifts:mt,staff:pt,today:kt})]}),Fl=(0,h.useBookingWrite)(),Vl=e=>(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsx)(We.BigAction,{premium:!0,label:"Walk-in",onPress:vt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint}),(0,Oe.jsx)(We.BigAction,{premium:!0,label:"New booking",onPress:vt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint}),(0,Oe.jsx)(We.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Ut(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint})]});(0,Ae.useDisplayNotices)(rt,!e);const Ul=Ze?180:168,[Kl,ql]=(0,T.useState)(Ul),Yl=$.default.useRef(Ul),Ql=$.default.useRef(null),Jl=$.default.useRef(null),Xl=()=>{const e=Ql.current,t=Jl.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,s,l,i)=>{t.measureInWindow((e,t)=>{const l=Xe<820?8:12,o=44+(Xe<820?4:8),n=i>Yl.current?Math.ceil(i-Yl.current):Se.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Ul,Math.floor(t-l-s)-n-o));Math.abs(Yl.current-a)>=2&&(Yl.current=a,ql(a))})})};$.default.useEffect(()=>{const e=setTimeout(Xl,60);return()=>clearTimeout(e)},[Je,Xe]);const Zl=(0,Oe.jsxs)(O.default,{ref:Jl,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xl()},style:{flexDirection:'row',flexWrap:Je>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ze?12:6,justifyContent:Ze?'center':void 0,borderTopWidth:1,borderTopColor:Q.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Oe.jsx)(Ee.DisplayClockButton,{}),(0,Oe.jsx)(ae.HoldToEdit,{quiet:!0,onUnlock:()=>{Is(null),js({at:Date.now()})},onHint:()=>ms('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Oe.jsx)(De.BlockBookingsButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,display:!0,day:Os}),Tt.areas.some(e=>e.outdoor)?(0,Oe.jsx)(De.CloseGardenButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,short:!0}):null,(0,Oe.jsx)(E.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>bs(!0),style:({pressed:e})=>({...ze.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR?null:(0,Oe.jsx)(f.GiftQrButton,{rid:rt,venue:dt.name})]}),ei=Cs.length?(0,Oe.jsxs)(O.default,{testID:"takeaway-panel",style:[ze.look.panel,{overflow:'hidden'}],children:[(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Oe.jsx)(G.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Oe.jsxs)(G.T,{size:12,colour:Q.colours.muted,children:[Cs.length," live"]})]}),(0,Oe.jsx)(O.default,{style:{padding:10},children:(0,Oe.jsx)(Ye,{list:Cs,me:jt,compact:!0,bookings:ut})})]}):null,ti=(Le.DueToday,Ns?Fs:Ds.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),si=Ns?Gs?`${_s}\u2019s guests`:`Guests ${_s}`:'Today\u2019s guests',li=(0,Oe.jsxs)(Oe.Fragment,{children:[0===ti.length?(0,Oe.jsx)(G.Muted,{children:Ns?Os{const t=(0,J.isSeatedHighlight)(e.status,{otherDay:Ns}),s=(0,he.guestRowText)(e,{name:e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)',''),seated:t}),l=Q.colours.text,i=t?Q.colours.goldLight:Q.colours.muted,o=Q.colours.gold,n=s.depositWarn?Q.colours.amber:Q.colours.goldLight;return(0,Oe.jsxs)(E.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:s.a11y,accessibilityHint:Ns?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Xt(!1),es(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,J.seatedHighlightStyle)({backgroundColor:e?_e:Ne,borderColor:Q.colours.gold,borderLeftColor:Q.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:Q.colours.hairline,backgroundColor:e?Q.colours.tilePressed:'transparent'},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Oe.jsx)(G.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:s.time}),(0,Oe.jsx)(G.T,{size:18,weight:"semibold",colour:l,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:s.name}),s.allergy?(0,Oe.jsx)(O.default,{style:{paddingTop:2},children:(0,Oe.jsx)(H.AllergyIcon,{text:s.allergy,size:22,colour:Q.colours.amber,ink:Q.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Oe.jsxs)(G.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Oe.jsx)(G.T,{size:16,colour:l,children:s.people}),s.deposit?(0,Oe.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}):null,s.deposit?(0,Oe.jsx)(G.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:s.deposit}):null,(0,Oe.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}),(0,Oe.jsx)(G.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===s.table?i:l,children:s.table}),s.dog?(0,Oe.jsx)(G.T,{size:16,children:" "}):null,s.dog?(0,Oe.jsx)(O.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Oe.jsx)(ge.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,Oe.jsx)(Re.CancellationsSection,{items:hl,dayWord:Ns?Gs?_s.toLowerCase():`on ${_s}`:'today'})]}),ii=(0,Oe.jsx)(A.default,{testID:"display-guest-list",accessibilityLabel:si,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:li}),oi=P.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Xt(!1)}}),ni=(0,Oe.jsxs)(E.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${si}, ${ti.length}`,accessibilityState:{expanded:Jt},'aria-expanded':Jt,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Xt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:Jt?Q.colours.gold:Q.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?Q.colours.tilePressed:Jt?Q.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Oe.jsx)(G.T,{size:16,weight:"bold",colour:Q.colours.gold,children:ti.length}),(0,Oe.jsx)(O.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(O.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Oe.jsxs)(G.T,{size:13,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,children:[si," ",Jt?'\u2039':'\u203a']})})})]}),ai=Jt?(0,Oe.jsxs)(O.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Oe.jsxs)(O.default,{testID:"guests-drawer",...oi.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Je)),backgroundColor:Q.colours.surface,borderRightWidth:1,borderColor:Q.colours.gold,borderRadius:14,...ze.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Oe.jsxs)(O.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[si.toUpperCase()," (",ti.length,")"]}),(0,Oe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${si}`,onPress:()=>Xt(!1),style:{marginRight:-6}})]}),ul.count?(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,testID:"cancelled-day-tally-guests",children:gl}):null]}),ii]}),(0,Oe.jsx)(E.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${si}`,accessibilityRole:"button",onPress:()=>Xt(!1),style:{flex:1}})]}):null,ri=Xs?Zs:l.IS_KIRKTON&&!Object.values(dt.kitchenHours??{}).some(Boolean)?(0,Oe.jsxs)(O.default,{testID:"kirkton-hours-to-confirm",style:[ze.look.panel,{padding:14,gap:8}],children:[(0,Oe.jsx)(G.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Oe.jsx)(G.Muted,{children:"No service hours have been set for this venue."})]}):(0,Oe.jsx)(Se.DayGraph,{busyThreshold:(0,t.venueBusy)(dt,ut,yt).busy,todays:Fs,open:Ks,close:qs,now:yt,turnBase:dt.settings.turnMins,blocks:bl,pauses:Qs,compact:Ze,dense:!Ze,fit:tt,tight:tt&&Xe<600,height:Ul,forecastNote:Ns?void 0:kl,emptyText:el,past:Os{Ns?Xt(!0):Wt(!0)},hi=(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',padding:Xe<820?8:12,paddingTop:Xe<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[It?null:ni,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[It?null:Nl,It?(0,Oe.jsx)(A.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Oe.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"})}):Al?El:Pl,Ol,ai]}),(0,Oe.jsxs)(O.default,{testID:"display-side",style:{width:lt,gap:Xe<820?4:8,minHeight:0},children:[(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Vl(!1)}),(0,Oe.jsx)(O.default,{style:{flexShrink:0},children:Gl}),It?null:(0,Oe.jsx)(O.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,compact:Xe<820,snug:Xe<820,tight:Xe<700,sound:(0,L.flapSoundOn)(),onPress:ui})}),It?null:(0,Oe.jsx)(O.default,{ref:Ql,testID:"day-graph-slot",onLayout:Xl,style:{flexGrow:0,flexShrink:1,flexBasis:Ul+52,minHeight:Xe<600?90:120,overflow:'visible'},children:di}),(0,Oe.jsxs)(A.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Oe.jsx)(E.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>hs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Oe.jsx)(G.T,{center:!0,weight:"semibold",children:"Reviews"})}),ei,(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt})]})]})]});return(0,Oe.jsxs)(_.SafeAreaView,{style:{flex:1,backgroundColor:Q.colours.bg},onTouchStart:()=>{os.current=Date.now()},onMouseDown:()=>{os.current=Date.now()},children:[Ze?(0,Oe.jsxs)(O.default,{style:{flex:1},children:[(0,Oe.jsxs)(A.default,{ref:it,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Oe.jsxs)(O.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Oe.jsx)(O.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Oe.jsx)(j.ExitButton,{})}),(0,Oe.jsx)(U.RestaurantLogo,{rid:rt,size:64}),(0,Oe.jsx)(G.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:dt.name}),(0,Oe.jsx)(U.PoweredBy,{}),(0,Oe.jsx)(C.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Oe.jsx)(O.default,{accessible:!0,accessibilityLabel:`Current time ${(0,q.hm)(yt)}`,children:(0,Oe.jsx)(G.T,{center:!0,size:30,weight:"semibold",colour:Q.colours.goldLight,children:(0,q.hm)(yt)})}),(0,Oe.jsx)(He.ShellfishChip,{rid:rt,by:jt,app:"display",size:"m"}),(0,Oe.jsx)(He.SundayRoastChip,{rid:rt,by:jt,app:"display",size:"m"}),K]}),Me,ci,(0,Oe.jsx)(O.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Oe.jsx)(Ke,{phone:!0,split:cl,items:[{label:`Tables \xb7 ${_s}`,value:rl.length,testID:'badge-tables'},{label:`Covers \xb7 ${_s}`,value:dl,testID:'badge-covers'},{label:'Takeaway',value:Cs.length,alert:Cs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Ft(!0)}]})}),(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{gap:8},children:Vl(!0)}),(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),Gl,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[Al?El:Pl,Ol]}),(0,Oe.jsxs)(O.default,{onLayout:e=>{ot.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[ze.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Oe.jsxs)(G.T,{center:!0,size:20,weight:"semibold",colour:Q.colours.goldLight,accessibilityRole:"header",children:[si," (",ti.length,")"]}),(0,Oe.jsx)(O.default,{testID:"display-guest-list",accessibilityLabel:si,style:{gap:4},children:li})]}),ei,di,(0,Oe.jsx)(O.default,{testID:"covers-dock",children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,compact:!0,sound:(0,L.flapSoundOn)(),onPress:()=>it.current?.scrollTo({y:ot.current,animated:!0})})}),(0,Oe.jsxs)(O.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Oe.jsx)(G.T,{center:!0,size:14,colour:St?Q.colours.muted:Q.colours.amber,children:St?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Oe.jsx)(G.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cs(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Oe.jsx)(G.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>hs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zl]}),e?null:(0,Oe.jsx)(O.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:Q.colours.hairline},children:(0,Oe.jsx)(W.VoiceSlot,{size:56})})]}):(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Je>=1e3?18:14,paddingVertical:Xe<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),...ze.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Oe.jsx)(O.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Oe.jsx)(U.RestaurantBrand,{rid:dt.id,size:Je<900?32:40,beside:!0})}),(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Oe.jsx)(G.T,{size:Je<900?18:21,weight:"semibold",colour:Q.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,q.hm)(yt)}),Je>=900?(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,children:(0,q.niceDate)(yt)}):null]})]}),It?(0,Oe.jsx)(O.default,{style:{width:220}}):(0,Oe.jsx)(O.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:ci}),(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Oe.jsx)(He.ShellfishChip,{rid:rt,by:jt,app:"display",size:Je<1200?'xs':Je<1280||Xe<700?'s':'m'}),(0,Oe.jsx)(E.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cs(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.muted,children:"?"})}),'simulated'===bt?(0,Oe.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>gt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(G.T,{size:11,colour:Q.colours.muted,children:"+15"})}):null,e?null:(0,Oe.jsx)(j.ExitButton,{}),K,Pe?null:(0,Oe.jsx)(W.VoiceSlot,{size:44})]})]}),Me,It?null:(0,Oe.jsxs)(O.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,Oe.jsx)(Ke,{splitOnly:!0,split:cl,items:[]}),(0,Oe.jsx)(O.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Je>=1e3?18:14)+(e?0:52)+('simulated'===bt?52:0),zIndex:4},children:(0,Oe.jsx)(He.SundayRoastChip,{rid:rt,by:jt,app:"display",size:Je<1100||Xe<700?'s':'m'})})]}),tt?hi:(gi=(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Vl(!1)}),Gl]}),(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),It?(0,Oe.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"}):(0,Oe.jsx)(Oe.Fragment,{children:(0,Oe.jsxs)(O.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[ni,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Nl,Al?El:Pl,Ol,ai]})]})}),ei,It?null:(0,Oe.jsx)(O.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,sound:(0,L.flapSoundOn)(),onPress:ui})}),It?null:(0,Oe.jsx)(O.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Ul+Se.DAY_GRAPH_CHROME},children:di})]}),(0,Oe.jsx)(A.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:gi})),Zl]}),(0,Oe.jsx)(I.SoldOutStrip,{rid:rt,by:wt,onOpen:()=>bs(!0)}),(0,Oe.jsx)(v.SoldOutSheet,{visible:gs,onClose:()=>bs(!1),rid:rt,by:wt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Oe.jsx)(p.TableOrderCue,{rid:rt}),vt.elements,Vt?(0,Oe.jsx)(y.EditBookingPicker,{rid:rt,today:kt,who:jt,hidePrivate:!0,onClose:()=>Ut(!1)}):null,Kt?(0,Oe.jsx)(y.EditBookingSheet,{rid:rt,id:Kt,who:jt,hidePrivate:!0,onClose:()=>qt(null)}):null,Pt?(0,Oe.jsx)(xe.TableSheet,{rid:rt,name:Pt,view:Rs,plan:Tt,todays:Ds,now:yt,privacy:St,turnBase:dt.settings.turnMins,onClose:()=>Et(null),onWalkIn:e=>vt.openWalkInAt(e),onMove:e=>Ot(e),onDetails:vs}):null,sl?(()=>{const e=tl[sl],t=e?.dayBookings??[];return(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>{al(null),ll(null)},title:`${(0,d.tableNumbersA11y)(sl)} \xb7 ${Gs?_s:(0,Te.dayLong)(Os)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Oe.jsxs)(G.T,{size:16,center:!0,colour:Q.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${Gs?_s.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${Gs?_s.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ue.privName)(e,St):Fe(e.name);return(0,Oe.jsx)(G.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,fe.tablesWords)((0,te.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ll(null),es(e.id)},style:{minHeight:56}},e.id)}),Os>=kt?(()=>{const t=e?.table.maxSeats??0,s=ut.filter(e=>e.date===Os&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,te.tablesOf)(e.table).includes(sl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Oe.jsxs)(O.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",center:!0,colour:Q.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(sl)]}),nl?(0,Oe.jsxs)(O.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:nl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:Q.colours.amber,backgroundColor:Q.colours.amberBg},children:[(0,Oe.jsx)(G.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:nl.ask}),(0,Oe.jsxs)(G.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Oe.jsx)(G.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!Fl.ok,accessibilityHint:Fl.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=ut.find(e=>e.id===nl.id);if(al(null),!e)return;const s=Fe(e.name);try{await(0,pe.saveBookingTables)(rt,e,[sl]),ms((0,fe.savedWords)(s,e.partySize,[sl],t))}catch(e){ms(`Couldn\u2019t save tables for ${s}: ${String(e?.message??e).slice(0,120)}`)}ll(null)}}),(0,Oe.jsx)(G.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>al(null)})]})]}):null,nl?null:s.slice(0,12).map(e=>{const s=Fe(e.name),l=e.partySize>t;return(0,Oe.jsx)(G.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:!Fl.ok,accessibilityHint:Fl.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(sl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{const l=(0,fe.overCapacityAsk)([sl],t,e.partySize);if(l)al({id:e.id,ask:l});else{try{await(0,pe.saveBookingTables)(rt,e,[sl]),ms((0,fe.savedWords)(s,e.partySize,[sl],t))}catch(e){ms(`Couldn\u2019t save tables for ${s}: ${String(e?.message??e).slice(0,120)}`)}ll(null)}},style:{minHeight:56}},e.id)})]}):null})():null,(0,Oe.jsx)(G.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{al(null),ll(null)},style:{minHeight:56}})]})})():null,Zt?(()=>{const e=ut.find(e=>e.id===Zt);return e?(0,Oe.jsx)(be.GuestActionsSheet,{rid:rt,b:e,name:e.walkIn?(0,ue.privName)(e,St):Fe(e.name),view:Rs,now:yt,otherDay:e.date!==kt,turnBase:dt.settings.turnMins,onClose:()=>es(null),onDetails:vs,onDone:ms,onEdit:e=>{es(null),qt(e.id)},onPickOnPlan:(e,t)=>{Xt(!1),Lt('plan'),Mt('all'),ss({id:e.id,tables:t})}}):null})():null,Nt?(0,Oe.jsx)(xe.DetailsPanel,{title:Nt.title,onClose:()=>_t(null),children:Nt.body}):null,Yt?(0,Oe.jsx)(xe.ServiceSummary,{r:dt,todays:Ds,orders:ct,waitlistAll:as,walkInCount:rs,onClose:()=>Qt(!1)}):null,ds?(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>cs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Oe.jsx)(g.FloorLegend,{}),(0,Oe.jsx)(G.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>cs(!1)})]}):null,us?(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>hs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Oe.jsx)(F.ReviewsSection,{rid:rt,mode:"read",venueName:dt.name}),(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>hs(!1)})]}):null,Gt?(0,Oe.jsxs)(xe.DetailsPanel,{title:"Takeaway",onClose:()=>Ft(!1),children:[(0,Oe.jsx)(G.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Oe.jsx)(Ye,{list:Cs,me:jt,bookings:ut})]}):null,xs?(0,Oe.jsx)(O.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:Q.colours.bg},children:(0,Oe.jsx)(ne.PlanDesigner,{initial:Tt,venue:dt.name,mode:"display",startStep:"arrange",onActivity:()=>{ws.current=Date.now(),null!==ks&&Is(null)},notice:null!==ks?`Locking again in ${ks} s \xb7 touch to keep editing`:null,onSave:e=>{te.useFloor.getState().setPlan(rt,e),js(null),ms('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{te.useFloor.getState().setPlan(rt,e),ms('Live seating plan updated on every screen.')},onCancel:()=>{js(null),ms('No changes kept. Editing is locked again.')}},xs.at)}):null,e?null:(0,Oe.jsx)(de.Screensaver,{rid:rt,idleMins:Dt.idleMins,pinOn:Dt.pinOn,wake:Dt,tonightCards:Dt.tonightCards,cfg:Ct}),e?null:(0,Oe.jsx)(we.PrintHost,{rid:rt}),e?null:(0,Oe.jsx)(je.AlertHost,{variant:"display",rid:rt,skipTakeaway:!0}),e?null:(0,Oe.jsx)(z.SeatAllergenReminder,{rid:rt}),e?null:(0,Oe.jsx)(ke.TakeawayTakeover,{rid:rt,me:jt})]});var gi};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),D=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=e(T),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),z=_r(_d[30]),W=_r(_d[31]),H=_r(_d[32]),M=e(_r(_d[33])),P=e(_r(_d[34])),E=e(_r(_d[35])),A=e(_r(_d[36])),O=e(_r(_d[37])),N=e(_r(_d[38])),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),me=_r(_d[69]),xe=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),ve=_r(_d[75]),De=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),ze=_r(_d[84]),We=_r(_d[85]),He=_r(_d[86]),Me=_r(_d[87]),Pe=_r(_d[88]),Ee=_r(_d[89]),Ae=_r(_d[90]),Oe=_r(_d[91]);const Ne='#221C12',_e='#2E2618',Ge=12e4,Fe=e=>(e??'').replace(' (example)',''),Ve=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Ue=e=>e.slotTime?(0,q.hm)(new Date(e.slotTime)):'ASAP';function Ke({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:o}){return(0,Oe.jsxs)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Oe.jsx)(O.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,Oe.jsxs)(O.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,Oe.jsx)(G.T,{size:s?24:19,weight:"semibold",colour:e.alert?Q.colours.amber:Q.colours.text,children:e.value}),(0,Oe.jsx)(G.T,{size:s?14:12,colour:Q.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Oe.jsx)(E.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,Oe.jsx)($.default.Fragment,{children:i},e.testID)})}),l?(0,Oe.jsx)(O.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Oe.jsx)(G.T,{size:14,colour:Q.colours.muted,children:"No Covers yet"}):(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Oe.jsx)(G.T,{size:i?13:14,weight:"semibold",colour:Q.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Oe.jsx)(G.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Oe.jsxs)(O.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:Q.colours.gold},children:[(0,Oe.jsx)(O.default,{style:{width:`${l.walkInPct}%`,backgroundColor:Q.colours.gold}}),(0,Oe.jsx)(O.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function qe({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:o,compact:n}){return(0,Oe.jsxs)(E.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Oe.jsx)(O.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Oe.jsx)(G.T,{size:n?12:14,weight:l?'semibold':'medium',colour:l?Q.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Oe.jsx)(G.T,{size:12,colour:Q.colours.muted,children:s}):null]})}function Ye({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Pe.statusBlock)(e,t,(0,Pe.linkedBooking)(e,l));return e.length?(0,Oe.jsx)(O.default,{style:{gap:8},children:e.map(e=>(0,Oe.jsxs)(O.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:Q.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?Q.colours.ok:e.allergies.length?Q.colours.red:Q.colours.gold},children:[(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Oe.jsxs)(G.T,{size:s?16:18,weight:"bold",children:[Ue(e)," \xb7 ",Fe(e.customerName)]}),(0,Oe.jsx)(G.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,Oe.jsxs)(G.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,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:Q.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,K.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Oe.jsx)(Me.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Oe.jsxs)(G.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Oe.jsx)(G.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>Y.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Oe.jsx)(G.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Oe.jsx)(G.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Oe.jsx)(we.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Oe.jsx)(G.Muted,{children:"No takeaway orders right now."})}function Qe({rid:e,id:t,turnBase:s}){const l=(0,Y.useBookings)(e).find(e=>e.id===t);return l?(0,Oe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1304,[1141,796,5,6,1305,828,853,1117,860,1140,1306,1307,1308,1114,1135,1309,1310,1315,1316,1317,872,1318,1153,980,1122,1319,34,1094,1172,1044,1110,1136,1320,395,380,402,295,102,426,36,794,1204,1208,873,861,858,874,821,1113,892,1119,1084,1025,1100,1127,1321,1126,1322,1329,1331,1334,1337,1333,1338,1340,1341,1132,1116,1118,878,1345,1193,1346,1203,1195,1022,1351,1359,1360,1097,1134,1362,1363,1364,1166,1365,1165,1159,869,1366,1367,25]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1306,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1307,[1023,1084]); @@ -1411,7 +1411,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.listSavedPlans=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))},_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const{data:c,error:u}=await(0,n.getSupabase)().from('table_plans').insert({venue_id:a,name:o.name,is_active:!1,areas:t.areas??[],tables:t.tables??[],joins:t.joins??[],sections:t.sections??[],fixtures:t.fixtures??[],updated_by:s()}).select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').single();if(u)throw u;return l(c)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return c(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:c(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}function c(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1328,[1327,1021,872,934,988]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1329,[34,236,402,102,821,794,1166,1330,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},1330,[]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return w}}),_e.Timeline=function({plan:e,bookings:T,now:C,privacy:S,onOpen:v,turnBase:I,t0:D,t1:E,height:z,pauses:L,blockedTables:R,hideNow:$,compact:_=!1,fit:O=!1}){const B=(0,o.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),W=T.filter(e=>!['cancelled','noshow'].includes(e.status)),[N,F]=(0,o.useState)(0),A=O&&!W.some(e=>!e.table)?B.filter(e=>'__none'!==e.key):B,P=O&&N>0?Math.max(w,Math.min(k,Math.floor(N/Math.max(1,A.length)))):k,H=P<44,Y=(0,o.useMemo)(()=>(0,c.clashes)(W,I),[W,I]),V=Math.max(1,Math.ceil((E.getTime()-D.getTime())/9e5)),[U,X]=(0,o.useState)(0),G=Math.max(30,U-M-2),q=Math.min(V,Math.max(1,Math.floor(G/j))),J=U>0?Math.max(j,Math.floor(G/q*100)/100):j,[K,Q]=(0,o.useState)(0),Z=Math.max(0,V-q),ee=Math.max(0,Math.min(Z,K)),te=(0,u.addMins)(D,15*ee),le=(0,u.addMins)(te,15*q),oe=e=>(e.getTime()-te.getTime())/9e5*J,[ie,ne]=(0,o.useState)(null),re=(0,o.useRef)(null);(0,o.useEffect)(()=>{const e=$?0:Math.floor((C.getTime()-D.getTime())/9e5)-Math.floor(q/3);Q(Math.max(0,Math.min(Z,e)))},[D.getTime(),q,Z,$]);const[se,ae]=(0,o.useState)(''),[de,ce]=(0,o.useState)(null),he=(0,o.useRef)(null);he.current=de,(0,o.useEffect)(()=>{if(!de)return;const e=setTimeout(()=>ce(null),s.ARM_MS);return()=>clearTimeout(e)},[de]);const ue=de?W.find(e=>e.id===de.id):void 0,be=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(he.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(he.current,e.id,Date.now()),onResponderGrant:e=>{re.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:l=>{if(!re.current||!(0,s.isArmed)(he.current,e.id,Date.now()))return;const o=l.nativeEvent.pageX-re.current.x,i=l.nativeEvent.pageY-re.current.y;(Math.abs(i)>=6||Math.abs(o)>=6)&&ne({id:e.id,row:t,dy:i})},onResponderRelease:l=>{const o=re.current;re.current=null,ne(null);const n=l.nativeEvent.pageX-(o?.x??0),r=l.nativeEvent.pageY-(o?.y??0),d=(0,s.releaseOn)(he.current,e.id,!(Math.abs(n)<6&&Math.abs(r)<6),Date.now());if(ce(d.arm),'select'===d.action){ae('');try{i.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void ae('');if('none'===d.action)return;ae('');const h=A.findIndex(e=>e.key===t),f=Math.max(0,Math.min(A.length-1,h+Math.round(r/P))),g=(0,b.dragTables)(e.table,t,A[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),ae(`${(0,p.privName)(e,S)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,u.hm)((0,c.startOf)(e))}`)):Math.abs(n)>=6&&Math.abs(r)

=600||se?(0,y.jsx)(r.default,{style:{flex:U>=600?1:void 0,flexBasis:U>=600?void 0:'100%',minWidth:0},children:(0,y.jsx)(x.T,{size:13,center:U<600,colour:g.colours.muted,numberOfLines:U>=600?1:2,testID:"timeline-hint",children:se||s.SELECT_HINT})}):null,L?.length?(0,y.jsxs)(x.Row,{gap:4,children:[(0,y.jsx)(r.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:13,children:"Blocked"})]}):null,(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.goldLight,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(r.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))})}),(0,y.jsx)(r.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})})]}):null]}):(0,y.jsxs)(y.Fragment,{children:[_?(0,y.jsxs)(r.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,y.jsx)(r.default,{style:{alignSelf:'center'},children:(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'})}),(0,y.jsx)(x.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),se?(0,y.jsx)(r.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:se})}):null]}):(0,y.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(x.Row,{gap:8,children:[(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'}),(0,y.jsx)(r.default,{style:{flex:1,minWidth:0},children:(0,y.jsx)(x.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,y.jsx)(r.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{size:13,colour:g.colours.goldLight,children:se})})]}),(0,y.jsxs)(x.T,{center:!0,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})]}):null,L?.length?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(r.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:14,children:"Blocked"})]}):null]}),(0,y.jsxs)(r.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-U)>1&&X(t)},style:{flex:z?void 0:1,height:z,flexShrink:_?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,y.jsxs)(r.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:g.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,y.jsx)(r.default,{testID:"timeline-table-head",style:{width:M,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:(0,y.jsx)(x.T,{size:13,weight:"semibold",colour:g.colours.goldLight,children:"Table"})}),(0,y.jsxs)(r.default,{style:{width:q*J,flexShrink:0},children:[Array.from({length:Math.ceil(q/4)},(e,t)=>(0,y.jsx)(r.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*J,top:26,bottom:0,width:1,backgroundColor:g.colours.border}},t)),Array.from({length:Math.ceil(q/4)},(e,t)=>{const l=4*t*J,o=Math.max(0,Math.min(q*J-56,l-28));return(0,y.jsx)(r.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:o,width:56,top:4,height:22,justifyContent:'center'},children:(0,y.jsx)(x.T,{size:15,weight:"semibold",colour:g.colours.goldLight,center:!0,numberOfLines:1,children:(0,u.hm)((0,u.addMins)(te,60*t))})},`l${t}`)})]})]}),(0,y.jsxs)(n.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-N)>1&&F(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,y.jsx)(r.default,{style:{width:M,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:A.map((e,t,l)=>(0,y.jsx)(r.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:P,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:H?(0,y.jsxs)(r.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,y.jsx)(r.default,{style:{width:q*J,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!he.current,onResponderRelease:()=>{ce(null),ae('')},children:(0,y.jsxs)(r.default,{style:{width:q*J},children:[(L??[]).map((e,t)=>{const l=Math.max(0,oe(e.from)),o=Math.min(q*J,oe(e.to));return o<=l?null:(0,y.jsx)(r.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,u.hm)(e.from)} to ${(0,u.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:o-l,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),A.map((e,o,i)=>{return(0,y.jsxs)(r.default,{testID:`tl-row-${e.key}`,style:{height:P,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:o>0&&i[o-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(q/4)},(e,l)=>(0,y.jsx)(r.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*J,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),R?.includes(e.key)?(0,y.jsx)(r.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,y.jsx)(x.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,W.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)te)).map(t=>{const o=ie?.id===t.id&&ie.row===e.key?ie:null,i=oe((0,c.startOf)(t)),n=Math.max(0,Math.min(q*J-44,i)),a=Math.min(q*J,oe((0,u.addMins)((0,c.startOf)(t),(0,c.durOf)(t,I)))),d=Math.min(q*J-n,Math.max(44,a-Math.max(0,i))),b=Y.has(t.id),j=de?.id===t.id;return(0,y.jsx)(r.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,p.privName)(t,S)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,u.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,I)} min${b?', clash':''}${(0,h.depositView)(t,!0)?`, ${(0,h.depositView)(t,!0).a11y}`:''}${j?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:j},accessibilityHint:j?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:j?'1':'0'},...be(t,e.key),style:[{position:'absolute',left:n,top:(H?2:4)+(o?o.dy:0),width:d,height:P-(H?4:8),borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:j?3:b?2.5:1,borderColor:j?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...j?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:o?40:j?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:j?'ns-resize':'pointer',touchAction:j?'none':'pan-y'},o?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,y.jsx)(x.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:H?1:2,style:{lineHeight:16},children:d<100?H&&d>=70?`${t.partySize} \xb7 ${(0,u.hm)((0,c.startOf)(t))}`:String(t.partySize):(0,y.jsxs)(y.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key||H?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,p.privName)(t,S)," \xb7 ",t.partySize,H?' \xb7 ':'\n',(0,u.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,h.depositView)(t,!0)?d>=150?` \xb7 ${(0,h.depositView)(t,!0).label}`:'Deposit paid'===(0,h.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&me>=0&&me<=q*J?(0,y.jsx)(r.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:me,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,y.jsx)(r.default,{style:{position:'absolute',top:0,left:Math.max(-me,Math.min(-18,q*J-me-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,y.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,u.hm)(C)})})}):null]})})]}),ue?(0,y.jsx)(r.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,y.jsxs)(x.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,y.jsx)(r.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,p.privName)(ue,S)} ${s.SELECTED_A11Y}`,children:(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,p.privName)(ue,S)," \xb7 ",ue.partySize]})}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{ce(null),v(ue)}}),(0,y.jsx)(x.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{ce(null),ae('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=_r(_d[2]),i=e(_r(_d[3]));_r(_d[4]);var n=e(_r(_d[5])),r=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),u=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),x=_r(_d[16]),p=_r(_d[17]),y=_r(_d[18]);const j=30,k=52,w=28,M=120},1331,[828,860,34,281,236,295,102,1128,874,1025,1100,14,858,1118,1332,821,794,1333,25]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return w}}),_e.Timeline=function({plan:e,bookings:T,now:C,privacy:S,onOpen:v,turnBase:I,t0:D,t1:z,height:E,pauses:$,blockedTables:L,hideNow:R,compact:_=!1,fit:O=!1}){const B=(0,o.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),W=T.filter(e=>!['cancelled','noshow'].includes(e.status)),[N,A]=(0,o.useState)(0),F=O&&!W.some(e=>!e.table)?B.filter(e=>'__none'!==e.key):B,P=O&&N>0?Math.max(w,Math.min(k,Math.floor(N/Math.max(1,F.length)))):k,H=P<44,Y=(0,o.useMemo)(()=>(0,c.clashes)(W,I),[W,I]),V=Math.max(1,Math.ceil((z.getTime()-D.getTime())/9e5)),[U,X]=(0,o.useState)(0),G=Math.max(30,U-M-2),q=Math.min(V,Math.max(1,Math.floor(G/j))),J=U>0?Math.max(j,Math.floor(G/q*100)/100):j,[K,Q]=(0,o.useState)(0),Z=Math.max(0,V-q),ee=Math.max(0,Math.min(Z,K)),te=(0,u.addMins)(D,15*ee),le=(0,u.addMins)(te,15*q),oe=e=>(e.getTime()-te.getTime())/9e5*J,[ie,re]=(0,o.useState)(null),ne=(0,o.useRef)(null);(0,o.useEffect)(()=>{const e=R?0:Math.floor((C.getTime()-D.getTime())/9e5)-Math.floor(q/3);Q(Math.max(0,Math.min(Z,e)))},[D.getTime(),q,Z,R]);const[se,ae]=(0,o.useState)(''),[de,ce]=(0,o.useState)(null),he=(0,o.useRef)(null);he.current=de,(0,o.useEffect)(()=>{if(!de)return;const e=setTimeout(()=>ce(null),s.ARM_MS);return()=>clearTimeout(e)},[de]);const ue=de?W.find(e=>e.id===de.id):void 0,be=(t,l)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(he.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(he.current,t.id,Date.now()),onResponderGrant:e=>{ne.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!ne.current||!(0,s.isArmed)(he.current,t.id,Date.now()))return;const o=e.nativeEvent.pageX-ne.current.x,i=e.nativeEvent.pageY-ne.current.y;(Math.abs(i)>=6||Math.abs(o)>=6)&&re({id:t.id,row:l,dy:i})},onResponderRelease:o=>{const r=ne.current;ne.current=null,re(null);const n=o.nativeEvent.pageX-(r?.x??0),d=o.nativeEvent.pageY-(r?.y??0),h=(0,s.releaseOn)(he.current,t.id,!(Math.abs(n)<6&&Math.abs(d)<6),Date.now());if(ce(h.arm),'select'===h.action){ae('');try{i.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void ae('');if('none'===h.action)return;ae('');const f=F.findIndex(e=>e.key===l),g=Math.max(0,Math.min(F.length-1,f+Math.round(d/P))),x=(0,b.dragTables)(t.table,l,F[g].key);if(x){a.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,b.overCapacityAsk)(x.split('+'),(0,b.seatsOf)(e,x.split('+')).total,t.partySize);ae(`${(0,p.privName)(t,S)} \u2192 ${(0,b.tablesWords)(x.split('+'))}, still ${(0,u.hm)((0,c.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`)}else Math.abs(n)>=6&&Math.abs(d)

=600||se?(0,y.jsx)(n.default,{style:{flex:U>=600?1:void 0,flexBasis:U>=600?void 0:'100%',minWidth:0},children:(0,y.jsx)(x.T,{size:13,center:U<600,colour:g.colours.muted,numberOfLines:U>=600?1:2,testID:"timeline-hint",children:se||s.SELECT_HINT})}):null,$?.length?(0,y.jsxs)(x.Row,{gap:4,children:[(0,y.jsx)(n.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:13,children:"Blocked"})]}):null,(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.goldLight,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(n.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))})}),(0,y.jsx)(n.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})})]}):null]}):(0,y.jsxs)(y.Fragment,{children:[_?(0,y.jsxs)(n.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,y.jsx)(n.default,{style:{alignSelf:'center'},children:(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'})}),(0,y.jsx)(x.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),se?(0,y.jsx)(n.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:se})}):null]}):(0,y.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(x.Row,{gap:8,children:[(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'}),(0,y.jsx)(n.default,{style:{flex:1,minWidth:0},children:(0,y.jsx)(x.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,y.jsx)(n.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{size:13,colour:g.colours.goldLight,children:se})})]}),(0,y.jsxs)(x.T,{center:!0,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})]}):null,$?.length?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(n.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:14,children:"Blocked"})]}):null]}),(0,y.jsxs)(n.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-U)>1&&X(t)},style:{flex:E?void 0:1,height:E,flexShrink:_?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,y.jsxs)(n.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:g.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,y.jsx)(n.default,{testID:"timeline-table-head",style:{width:M,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:(0,y.jsx)(x.T,{size:13,weight:"semibold",colour:g.colours.goldLight,children:"Table"})}),(0,y.jsxs)(n.default,{style:{width:q*J,flexShrink:0},children:[Array.from({length:Math.ceil(q/4)},(e,t)=>(0,y.jsx)(n.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*J,top:26,bottom:0,width:1,backgroundColor:g.colours.border}},t)),Array.from({length:Math.ceil(q/4)},(e,t)=>{const l=4*t*J,o=Math.max(0,Math.min(q*J-56,l-28));return(0,y.jsx)(n.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:o,width:56,top:4,height:22,justifyContent:'center'},children:(0,y.jsx)(x.T,{size:15,weight:"semibold",colour:g.colours.goldLight,center:!0,numberOfLines:1,children:(0,u.hm)((0,u.addMins)(te,60*t))})},`l${t}`)})]})]}),(0,y.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-N)>1&&A(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,y.jsx)(n.default,{style:{width:M,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:F.map((e,t,l)=>(0,y.jsx)(n.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:P,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:H?(0,y.jsxs)(n.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,y.jsx)(n.default,{style:{width:q*J,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!he.current,onResponderRelease:()=>{ce(null),ae('')},children:(0,y.jsxs)(n.default,{style:{width:q*J},children:[($??[]).map((e,t)=>{const l=Math.max(0,oe(e.from)),o=Math.min(q*J,oe(e.to));return o<=l?null:(0,y.jsx)(n.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,u.hm)(e.from)} to ${(0,u.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:o-l,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),F.map((e,o,i)=>{return(0,y.jsxs)(n.default,{testID:`tl-row-${e.key}`,style:{height:P,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:o>0&&i[o-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(q/4)},(e,l)=>(0,y.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*J,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),L?.includes(e.key)?(0,y.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,y.jsx)(x.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(r=e.key,W.filter(e=>('__none'===r?!e.table:(0,d.tablesOf)(e.table).includes(r))&&(0,c.startOf)(e)te)).map(t=>{const o=ie?.id===t.id&&ie.row===e.key?ie:null,i=oe((0,c.startOf)(t)),r=Math.max(0,Math.min(q*J-44,i)),a=Math.min(q*J,oe((0,u.addMins)((0,c.startOf)(t),(0,c.durOf)(t,I)))),d=Math.min(q*J-r,Math.max(44,a-Math.max(0,i))),b=Y.has(t.id),j=de?.id===t.id;return(0,y.jsx)(n.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,p.privName)(t,S)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,u.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,I)} min${b?', clash':''}${(0,h.depositView)(t,!0)?`, ${(0,h.depositView)(t,!0).a11y}`:''}${j?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:j},accessibilityHint:j?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:j?'1':'0'},...be(t,e.key),style:[{position:'absolute',left:r,top:(H?2:4)+(o?o.dy:0),width:d,height:P-(H?4:8),borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:j?3:b?2.5:1,borderColor:j?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...j?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:o?40:j?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:j?'ns-resize':'pointer',touchAction:j?'none':'pan-y'},o?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,y.jsx)(x.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:H?1:2,style:{lineHeight:16},children:d<100?H&&d>=70?`${t.partySize} \xb7 ${(0,u.hm)((0,c.startOf)(t))}`:String(t.partySize):(0,y.jsxs)(y.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key||H?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,p.privName)(t,S)," \xb7 ",t.partySize,H?' \xb7 ':'\n',(0,u.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,h.depositView)(t,!0)?d>=150?` \xb7 ${(0,h.depositView)(t,!0).label}`:'Deposit paid'===(0,h.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var r}),!R&&me>=0&&me<=q*J?(0,y.jsx)(n.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:me,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,y.jsx)(n.default,{style:{position:'absolute',top:0,left:Math.max(-me,Math.min(-18,q*J-me-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,y.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,u.hm)(C)})})}):null]})})]}),ue?(0,y.jsx)(n.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,y.jsxs)(x.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,y.jsx)(n.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,p.privName)(ue,S)} ${s.SELECTED_A11Y}`,children:(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,p.privName)(ue,S)," \xb7 ",ue.partySize]})}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{ce(null),v(ue)}}),(0,y.jsx)(x.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{ce(null),ae('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=_r(_d[2]),i=e(_r(_d[3]));_r(_d[4]);var r=e(_r(_d[5])),n=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),u=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),x=_r(_d[16]),p=_r(_d[17]),y=_r(_d[18]);const j=30,k=52,w=28,M=120},1331,[828,860,34,281,236,295,102,1128,874,1025,1100,14,858,1118,1332,821,794,1333,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1332,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1333,[]); __d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1334,[5,828,34,283,336,236,402,102,426,821,873,794,1026,1000,1315,1335,2,1336,1337,874,858,25]); @@ -1421,10 +1421,10 @@ __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.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1338,[860,14,1025,1339]); __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])},1339,[861]); __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])},1340,[34,102,797,821,25]); -__d(function(_g,r,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:S,name:D,view:P,now:I,onClose:L,onDetails:v,onDone:N,otherDay:T,turnBase:W=90,onPickOnPlan:H}){const[_,z]=(0,l.useState)(!1),M=(0,j.useBookingWrite)(),[A,G]=(0,l.useState)(!1),[O,F]=(0,l.useState)(!1),[R,q]=(0,l.useState)(!1),E=(0,k.guestRowText)(S,{name:D,seated:'seated'===S.status&&!T}),J='seated'===S.status&&!T,K=S.table?J?`Seated \xb7 ${(0,a.tableCardLabel)(S.table)}`:(0,a.tableCardLabel)(S.table):J?'Seated':'No table yet',Q=T?[]:(0,y.guestActions)(S,D,P,I).filter(e=>'details'!==e.id),U=(0,g.tableActions)(S,D),V={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},X=async t=>{const s={...S,table:t};t!==S.table&&await u.repo.bookings.update(S.id,{table:t}),await(0,b.seatBookingNow)(e,s),N(`${D} seated at ${(0,y.tableWords)(t)}.`),L()},Y=async t=>'seat'===t.id&&t.table?X(t.table):'pick'===t.id?z(e=>!e):'details'===t.id?(L(),v(S)):'finished'===t.id?('seated'===S.status?await(0,b.finishBookingNow)(e,S):await u.repo.bookings.setStatus(S.id,'finished'),N('seated'===S.status&&S.table?`${D} finished. ${(0,y.tableWords)(S.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),L()):'noshow'===t.id?(await u.repo.bookings.setStatus(S.id,'noshow'),N(`${D} marked as a no-show.`),L()):void 0,Z=_?(0,y.freeTablesNow)(P,S.partySize).slice(0,8):[];if(A)return(0,w.jsx)(h.TablePicker,{rid:e,booking:S,name:D,turnBase:W,onClose:L,onSaved:N,onPickOnPlan:H?e=>{L(),H(S,e)}:void 0});if(O)return(0,w.jsx)(f.CancelWalkInConfirm,{rid:e,b:S,onClose:L,onDone:N});if(R)return(0,w.jsx)(p.CancelBookingConfirm,{rid:e,b:S,name:D,onClose:L,onDone:N});const ee=[...Q];return(0,w.jsxs)(c.Sheet,{visible:!0,onClose:L,title:`${S.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,w.jsx)(o.default,{accessible:!0,accessibilityLabel:E.a11y,testID:"guest-actions-summary",children:(0,w.jsxs)(c.T,{size:18,children:[E.people,E.deposit?(0,w.jsxs)(c.T,{size:18,weight:"semibold",colour:E.depositWarn?x.colours.amber:x.colours.goldLight,children:[" \xb7 ",E.deposit]}):null," \xb7 ",K]})}),(0,w.jsx)(t.ShowNumberButton,{b:S}),(0,w.jsxs)(o.default,{style:{gap:10},children:[ee.map(e=>(0,w.jsxs)(n.default.Fragment,{children:[(0,w.jsx)(c.Button,{kind:B(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:M.hint,disabled:'details'!==e.id&&!M.ok,testID:`guest-act-${e.id}`,onPress:()=>Y(e),style:C}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,w.jsxs)(c.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&_?(0,w.jsxs)(o.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Z.length?(0,w.jsx)(c.Muted,{children:"No free tables right now."}):null,Z.map(e=>(0,w.jsx)(c.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:M.hint,disabled:!M.ok,testID:`guest-pick-${e.table}`,onPress:()=>X(e.table),style:C},e.table))]}):null]},e.id)),U.map(t=>(0,w.jsx)(c.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:M.hint,disabled:!M.ok,testID:`guest-act-${t.id}`,style:C,onPress:async()=>{if(M.ok){if('assign'===t.id)return G(!0);await(0,h.saveBookingTables)(e,S,[]),N(`${D}: table taken off.`),L()}}},t.id)),!T&&(0,f.canCancelWalkIn)(S)?(0,w.jsx)(c.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${S.ref}, ${S.partySize} Covers`,accessibilityHint:M.hint,disabled:!M.ok,testID:"guest-act-cancelwalkin",onPress:()=>F(!0),style:C}):null,(0,$.canCancelBooking)(S)?(0,w.jsx)(c.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${S.time}, ${S.partySize} Covers`,accessibilityHint:M.hint,disabled:!M.ok,testID:"guest-act-cancelbooking",onPress:()=>q(!0),style:C}):null,(0,w.jsx)(c.Button,{kind:"ghost",label:V.label,accessibilityLabel:V.a11y,testID:"guest-act-details",onPress:()=>Y(V),style:C})]}),(0,w.jsx)(c.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:L,style:C})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=e(l),o=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),j=r(d[16]),w=r(d[17]);const C={minHeight:64},B=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1341,[1342,860,1025,34,102,794,1119,874,1344,1338,1118,1116,1132,1133,1134,821,1307,25]); +__d(function(_g,r,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:D,name:v,view:I,now:P,onClose:L,onDetails:z,onDone:H,otherDay:N,turnBase:T=90,onPickOnPlan:W,onEdit:_}){const[A,E]=(0,l.useState)(null),[F,M]=(0,l.useState)(!1),R=(0,w.useBookingWrite)(),[G,O]=(0,l.useState)(!1),[U,q]=(0,l.useState)(!1),[J,K]=(0,l.useState)(!1),Q=(0,k.guestRowText)(D,{name:v,seated:'seated'===D.status&&!N}),V='seated'===D.status&&!N,X=D.table?V?`Seated \xb7 ${(0,a.tableCardLabel)(D.table)}`:(0,a.tableCardLabel)(D.table):V?'Seated':'No table yet',Y=N?[]:(0,y.guestActions)(D,v,I,P).filter(e=>'details'!==e.id),Z=(0,g.tableActions)(D,v),ee={id:'details',label:'Guest details',a11y:`Guest details, ${v}`},te=async t=>{const s={...D,table:t};t!==D.table&&await u.repo.bookings.update(D.id,{table:t}),await(0,b.seatBookingNow)(e,s),H(`${v} seated at ${(0,y.tableWords)(t)}.`),L()},se=async t=>'seat'===t.id&&t.table?te(t.table):'pick'===t.id?M(e=>!e):'details'===t.id?(L(),z(D)):'finished'===t.id?('seated'===D.status?await(0,b.finishBookingNow)(e,D):await u.repo.bookings.setStatus(D.id,'finished'),H('seated'===D.status&&D.table?`${v} finished. ${(0,y.tableWords)(D.table).replace(/^t/,'T')} needs clearing.`:`${v} finished.`),L()):'noshow'===t.id?(await u.repo.bookings.setStatus(D.id,'noshow'),H(`${v} marked as a no-show.`),L()):void 0,ae=F?(0,y.freeTablesNow)(I,D.partySize,!0).slice(0,12):[];if(G)return(0,C.jsx)(p.TablePicker,{rid:e,booking:D,name:v,turnBase:T,onClose:L,onSaved:H,onPickOnPlan:W?e=>{L(),W(D,e)}:void 0});if(U)return(0,C.jsx)(f.CancelWalkInConfirm,{rid:e,b:D,onClose:L,onDone:H});if(J)return(0,C.jsx)($.CancelBookingConfirm,{rid:e,b:D,name:v,onClose:L,onDone:H});const ie=[...Y];return(0,C.jsxs)(c.Sheet,{visible:!0,onClose:L,title:`${D.time} \xb7 ${v}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(o.default,{accessible:!0,accessibilityLabel:Q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(c.T,{size:18,children:[Q.people,Q.deposit?(0,C.jsxs)(c.T,{size:18,weight:"semibold",colour:Q.depositWarn?j.colours.amber:j.colours.goldLight,children:[" \xb7 ",Q.deposit]}):null," \xb7 ",X]})}),(0,C.jsx)(t.ShowNumberButton,{b:D}),(0,C.jsxs)(o.default,{style:{gap:10},children:[ie.map(e=>(0,C.jsxs)(n.default.Fragment,{children:[(0,C.jsx)(c.Button,{kind:B(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:R.hint,disabled:'details'!==e.id&&!R.ok,testID:`guest-act-${e.id}`,onPress:()=>se(e),style:S}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(c.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&F?(0,C.jsxs)(o.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ae.length?(0,C.jsx)(c.Muted,{children:"No free tables right now."}):null,A?(0,C.jsxs)(o.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:A.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[(0,C.jsx)(c.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:A.ask}),(0,C.jsx)(c.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!R.ok,accessibilityHint:R.hint,onPress:()=>{const e=A.table;E(null),te(e)},style:S}),(0,C.jsx)(c.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>E(null),style:S})]}):ae.map(e=>(0,C.jsx)(c.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,g.overCapacityAsk)([e.table],e.seats,D.partySize);t?E({table:e.table,ask:t}):te(e.table)},style:S},e.table))]}):null]},e.id)),Z.map(t=>(0,C.jsx)(c.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:R.hint,disabled:!R.ok,testID:`guest-act-${t.id}`,style:S,onPress:async()=>{if(R.ok){if('assign'===t.id)return O(!0);await(0,p.saveBookingTables)(e,D,[]),H(`${v}: table taken off.`),L()}}},t.id)),!N&&(0,f.canCancelWalkIn)(D)?(0,C.jsx)(c.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${D.ref}, ${D.partySize} Covers`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-cancelwalkin",onPress:()=>q(!0),style:S}):null,(0,x.canCancelBooking)(D)?(0,C.jsx)(c.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${v}, ${D.time}, ${D.partySize} Covers`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-cancelbooking",onPress:()=>K(!0),style:S}):null,!_||D.walkIn||['cancelled','noshow'].includes(D.status)||N&&!(D.date>=(0,h.ymd)(P))?null:(0,C.jsx)(c.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${v}, ${D.time}. Date, time, covers, table, anything.`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-edit",onPress:()=>{L(),_(D)},style:S}),(0,C.jsx)(c.Button,{kind:"ghost",label:ee.label,accessibilityLabel:ee.a11y,testID:"guest-act-details",onPress:()=>se(ee),style:S})]}),(0,C.jsx)(c.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:L,style:S})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=e(l),o=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),$=r(d[14]),x=r(d[15]),j=r(d[16]),w=r(d[17]),C=r(d[18]);const S={minHeight:64},B=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1341,[1342,860,1025,34,102,794,1119,874,1344,1338,1118,858,1116,1132,1133,1134,821,1307,25]); __d(function(g,r,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)(h.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(h.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=h.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,h.canShowNumber)(e,!y||(0,b.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 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,h.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,h.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]),b=r(d[7]),h=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1342,[34,379,402,102,874,1003,892,1023,1343,872,821,794,25]); __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')}`}},1343,[]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1344,[1025,1100]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a,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.maxSeatsc[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1344,[1025,1100]); __d(function(g,_r,_i,_a,_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 I}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const l=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,n.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,C.jsxs)(m.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,C.jsx)(x.T,{size:13,weight:"semibold",colour:T.colours.gold,children:"NEXT HOUR"}),(0,C.jsxs)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,C.jsx)(x.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,C.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?T.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?T.colours.amber:'#3C78B5'},children:[(0,C.jsx)(x.T,{size:13,weight:"semibold",children:e.time}),(0,C.jsxs)(x.T,{size:13,children:[(0,p.privName)(e,s)," \xb7 ",e.partySize]}),(0,C.jsx)(x.T,{size:12,colour:T.colours.muted,accessibilityLabel:e.table?(0,a.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,a.tableNumbers)(e.table)}`:'no table'}),(0,C.jsx)(x.T,{size:12,colour:t<0?T.colours.amber:T.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,C.jsx)(x.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,C.jsx)(x.T,{size:12,children:v.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,C.jsxs)(x.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,C.jsxs)(x.Row,{gap:4,children:[(0,C.jsx)(m.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:v.STATUS[e].colour}}),(0,C.jsx)(x.T,{size:12,colour:T.colours.muted,children:v.STATUS[e].label})]},e)),(0,C.jsx)(x.T,{size:12,colour:T.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,u.useState)(20);return(0,u.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,u.useEffect)(()=>{l<=0&&s()},[l]),(0,C.jsxs)(x.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,C.jsx)(x.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,C.jsx)(x.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return B}}),_e.TableSheet=function({rid:e,name:t,view:s,plan:i,todays:c,now:h,privacy:w,turnBase:S,onClose:I,onWalkIn:B,onMove:D,onDetails:z}){const M=s[t],N=j.useFloor.getState(),[P,R]=(0,u.useState)(!1),[L,A]=(0,u.useState)(M?.note??''),[W,O]=(0,u.useState)(!1),H=(0,$.useBookingWrite)();if(!M)return null;const F=M.booking,E=['seated','mains','dessert','bill'].includes(M.status),_=c.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,n.minsBetween)(h,(0,v.startOf)(e)))-Math.abs((0,n.minsBetween)(h,(0,v.startOf)(t)))),G=e=>e.partySize<=M.table.maxSeats,U=M.next??M.due,V=(0,v.turnFor)(M.covers||M.table.maxSeats,S);return(0,C.jsxs)(x.Sheet,{visible:!0,onClose:I,title:`${(0,a.tableNumbers)(t)} \xb7 ${v.STATUS[M.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===M.status?(0,C.jsx)(x.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{j.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,C.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(x.Badge,{kind:"neutral",label:`${M.table.minSeats}\u2013${M.table.maxSeats} seats`}),F?(0,C.jsx)(x.Badge,{kind:"gold",label:`${(0,p.privName)(F,w)} \xb7 ${F.partySize} \xb7 ${M.seatedMins}m`}):null,F?(0,C.jsx)(x.Badge,{kind:M.seatedMins>(0,v.durOf)(F,S)?'red':'neutral',label:`Turn about ${(0,v.durOf)(F,S)} min \xb7 free about ${(0,n.hm)((0,v.endOf)(F,S))} (est.)`}):(0,C.jsx)(x.Badge,{kind:"neutral",label:`Turn estimate for ${M.table.maxSeats}: about ${V} min`}),M.next?(0,C.jsx)(x.Badge,{kind:"blue",label:`Next: ${M.next.time} ${(0,p.privName)(M.next,w)} (${M.next.partySize})`}):null,M.allergy?(0,C.jsx)(x.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,C.jsx)(k.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,C.jsx)(o.BookingTableButton,{rid:e,booking:F??U,turnBase:S,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,C.jsx)(r.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,C.jsx)(r.ReinstateWalkInButton,{rid:e,b:F,today:(0,n.ymd)(new Date)}):null,!E&&'blocked'!==M.status&&U?(0,C.jsx)(x.Button,{label:`Seat ${(0,p.privName)(U,w)}`,accessibilityLabel:`Seat ${(0,p.privName)(U,w)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await y.repo.bookings.update(s.id,{table:s.table&&(0,j.tablesOf)(s.table).includes(t)?s.table:t}),await y.repo.bookings.setStatus(s.id,'seated'),(0,f.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==M.status&&U&&(0,v.startOf)(U)<=h?(0,C.jsxs)(x.Row,{gap:8,children:[(0,C.jsx)(x.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,p.privName)(U,w)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await y.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,C.jsx)(x.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,p.privName)(U,w)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await y.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===M.status?null:(0,C.jsxs)(x.Row,{gap:8,children:[(0,C.jsx)(x.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===M.status&&j.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,C.jsx)(x.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,C.jsxs)(m.default,{style:{gap:6},children:[0===_.length?(0,C.jsx)(x.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,C.jsxs)(b.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,p.privName)(s,w)} ${s.time}`,onPress:async()=>{await y.repo.bookings.update(s.id,{table:t}),await y.repo.bookings.setStatus(s.id,'seated'),(0,f.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?T.colours.border:T.colours.amber,backgroundColor:T.colours.surface2},children:[(0,C.jsxs)(x.T,{weight:"semibold",children:[s.time," \xb7 ",(0,p.privName)(s,w)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,a.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,C.jsxs)(x.T,{size:12,colour:T.colours.amber,children:["Bigger than this table (",M.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(x.T,{size:14,colour:T.colours.muted,children:"Course / status"}),(0,C.jsx)(x.Row,{wrap:!0,gap:6,children:v.STAGES.map(s=>(0,C.jsx)(x.Chip,{label:v.STAGE_LABEL[s],selected:M.status===s,onPress:()=>N.setLive(e,t,{stage:s})},s))}),(0,C.jsxs)(x.Row,{wrap:!0,gap:8,children:[F?(0,C.jsx)(x.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,C.jsx)(x.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await y.repo.bookings.setStatus(F.id,'finished'),N.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,C.jsxs)(x.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(x.Button,{kind:"secondary",label:'blocked'===M.status?'Unblock table':'Block table',onPress:()=>{N.setLive(e,t,{blocked:'blocked'!==M.status}),I()},testID:"block-table"}),(0,C.jsx)(x.Button,{kind:"ghost",label:M.note?'Edit note':'Note',onPress:()=>R(!P)}),F||U?(0,C.jsx)(x.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),z(F??U)},testID:"guest-details"}):null]}),P?(0,C.jsxs)(x.Row,{gap:6,children:[(0,C.jsx)(l.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[x.styles.input,{flex:1}]}),(0,C.jsx)(x.Button,{small:!0,label:"Save",onPress:()=>{N.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,w?(0,C.jsx)(x.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,i.joins.some(e=>e.tables.includes(t))?(0,C.jsxs)(x.Muted,{children:["Joins with ",i.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",i.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:a,todays:i,waiting:o,now:r,privacy:c,busy:h,onToast:w}){const[k,$]=(0,u.useState)(''),[B,D]=(0,u.useState)(2),z=(0,j.useFloor)(e=>e.smsLog);return(0,C.jsxs)(I,{title:`Waitlist (${o.length})`,right:(0,C.jsxs)(x.Muted,{children:["new party about ",(0,S.estimateWait)(o.length+1,t.settings.turnMins,h)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,C.jsx)(x.Muted,{children:"Nobody waiting."}):null,o.map((l,o)=>{const u=(0,v.suggestTable)(s,i,a,l.partySize,r,(0,v.turnFor)(l.partySize,t.settings.turnMins)),b=(0,S.estimateWait)(o+1,t.settings.turnMins,h),k=Math.max(0,(0,n.minsBetween)(new Date(l.joinedAt),r)),$=z.find(t=>t.rid===e&&t.text.includes(`#${l.number} `));return(0,C.jsxs)(m.default,{style:{backgroundColor:T.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(x.T,{weight:"semibold",children:["#",l.number," ",(0,p.pv)(l.name,c)," \xb7 ",l.partySize]}),(0,C.jsxs)(x.T,{size:12,colour:k>b?T.colours.amber:T.colours.muted,children:["waited ",k,"m \xb7 quoted about ",b,"m"]})]}),u?(0,C.jsxs)(x.T,{size:12,colour:u.clashes?T.colours.amber:T.colours.ok,children:["Best table: ",u.table," (",u.why,")"]}):(0,C.jsx)(x.T,{size:12,colour:T.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,C.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(x.Button,{small:!0,label:$||'notified'===l.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${l.number}`,onPress:()=>{j.useFloor.getState().logSms(e,r.toISOString(),`#${l.number} ${l.partySize}: Your table at ${t.name} is ready.`),y.repo.waitlist.setStatus(l.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),u?(0,C.jsx)(x.Button,{small:!0,kind:"success",label:`Seat at ${u.table}`,onPress:async()=>{await y.repo.waitlist.setStatus(l.id,'seated'),await y.repo.bookings.seatWalkIn(e,l.partySize,u.table,`From waitlist #${l.number}`),(0,f.resetTableLive)(e,u.table),w(`Waitlist #${l.number} seated at ${u.table}`)}}):null,(0,C.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>y.repo.waitlist.setStatus(l.id,'removed')})]}),'notified'===l.status?(0,C.jsx)(x.Badge,{kind:"ok",label:`Told table ready${$?` ${(0,n.hm)(new Date($.at))}`:''} `}):null]},l.id)}),(0,C.jsxs)(x.Row,{gap:6,children:[(0,C.jsx)(l.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:k,onChangeText:$,style:[x.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,C.jsx)(b.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:T.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(x.T,{weight:"bold",colour:T.colours.gold,children:B})}),(0,C.jsx)(x.Button,{small:!0,label:"Add",disabled:k.trim().length<2,onPress:()=>{y.repo.waitlist.join(e,k.trim(),B),$('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:l,now:a,walkInCount:o,staffOn:r,onSummary:u}){const c=o+l.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)),f=h?c/h:1,p=f>=1.1?T.colours.amber:f>=.85?T.colours.ok:T.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,n.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,n.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,v.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),k=y.filter(e=>e.future&&e.covers>j),S=t.nextHour?.covers??0,$=Math.ceil(S/16);return(0,C.jsxs)(I,{title:"Pace & kitchen",right:(0,C.jsx)(x.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,C.jsxs)(m.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${h}`,style:{gap:4},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{size:14,children:"Covers so far"}),(0,C.jsxs)(x.T,{weight:"bold",colour:p,children:[c," ",(0,C.jsxs)(x.T,{size:13,colour:T.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,C.jsx)(m.default,{style:{height:10,borderRadius:5,backgroundColor:(0,s.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,C.jsx)(m.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,C.jsxs)(x.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,i.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,C.jsx)(x.T,{size:13,colour:T.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,C.jsx)(m.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,C.jsxs)(m.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,C.jsx)(x.T,{size:10,colour:T.colours.muted,children:e.covers||''}),(0,C.jsx)(m.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?T.colours.red:e.future?'#6B5A3A':T.colours.gold}}),(0,C.jsx)(x.T,{size:9,colour:4===t?T.colours.gold:T.colours.muted,children:(0,n.hm)(e.from)})]},t))}),k.map(e=>(0,C.jsxs)(x.T,{size:13,colour:T.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,n.hm)(e.from),"\u2013",(0,n.hm)((0,n.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),$>r?(0,C.jsxs)(x.T,{size:13,colour:T.colours.amber,children:["\u26a0 Next hour about ",S," Covers with ",r," on: about ",$-r," more on the floor suggested."]}):(0,C.jsxs)(x.T,{size:13,colour:T.colours.ok,children:["Staffing looks OK for the next hour (",r," on)."]}),(0,C.jsx)(x.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),r=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,n.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,j.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{children:e}),(0,C.jsx)(x.T,{weight:"semibold",children:t})]},e);return(0,C.jsxs)(x.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(r)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,C.jsx)(x.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return j.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]),c=_r(d[9]);_r(d[10]);var b=e(_r(d[11])),h=e(_r(d[12])),m=e(_r(d[13])),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]),C=_r(d[25]);const I=({title:e,right:t,children:s,testID:l})=>(0,C.jsxs)(m.default,{testID:l,style:{backgroundColor:T.colours.surface,borderRadius:14,borderWidth:1,borderColor:T.colours.border,padding:10,gap:6},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{weight:"semibold",colour:T.colours.gold,children:e}),t]}),s]});const B=e=>(0,C.jsxs)(m.default,{style:{gap:6},children:[(0,C.jsxs)(x.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,C.jsxs)(x.Muted,{children:[e.time," \xb7 ",e.table?(0,j.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,C.jsx)(k.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,C.jsx)(c.BookingNeeds,{b:e,big:!0}),e.notes?(0,C.jsxs)(x.T,{children:["Notes: ",e.notes]}):(0,C.jsx)(x.Muted,{children:"No notes."}),e.allergies.length?(0,C.jsx)(m.default,{style:{backgroundColor:T.colours.redBg,borderRadius:8,padding:8},children:(0,C.jsxs)(x.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,w.allergenLabel)(e.allergen)} \u2014 ${(0,w.severityLabel)(e.severity)}`).join('; ')]})}):(0,C.jsx)(x.Muted,{children:"No allergies declared."}),(0,C.jsx)(t.ShowNumberButton,{b:e},`num-${e.id}`)]});const D=!0},1345,[1342,828,827,860,1140,1114,1132,858,34,1102,236,402,295,102,794,1119,1333,874,1025,861,1112,1100,1292,821,1307,25]); __d(function(g,_r,_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.']}]},1346,[827,34,236,402,102,794,874,1025,1347,821,1348,1350,25]); __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1347,[]); @@ -1491,7 +1491,7 @@ __d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModu __d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4);return(0,f.jsxs)(n.default,{style:{gap:14},children:[g.map(t=>{const u=b.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(n.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(o.default,{testID:`more-page-${t.id}`,accessibilityRole:"button",accessibilityLabel:t.title,onPress:()=>e('more',t.id),style:({pressed:e})=>({padding:12,borderTopWidth:l?1:0,borderColor:i.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,f.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),t.badge?(0,f.jsx)(s.Badge,{kind:"gold",label:t.badge}):null,(0,f.jsx)(s.T,{colour:i.colours.muted,children:"\u203a"})]})},t.id))})]},t):null}),(0,f.jsxs)(s.Muted,{center:!0,children:['staff'===l?'Staff app preview':'Managers app'," \xb7 ",t.APP_VERSION," \xb7 ",'live'===c.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});var t=r(d[0]);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),s=r(d[4]),l=r(d[5]),i=r(d[6]),u=r(d[7]),c=r(d[8]),f=r(d[9]);const b=[],p=e=>{e.forEach(e=>{b.some(t=>t.id===e.id)||b.push(e)})},g=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const h=e=>b.find(t=>t.id===e)},1408,[1015,34,402,102,794,892,821,1084,988,25]); __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'}},1409,[]); __d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1410,[860,34,102,794,892,1025,858,1087,1085,988,1086,5,1000,821,25]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=E,_e.signInWithText=H,_e.SignInWithLink=V,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return!h.IS_CAR&&(v.includes(h.APP_VARIANT)&&!b.PITCH&&!e&&!M())},_e.InviteGate=function(){const[e,H]=(0,u.useState)(p.useSession.persist.hasHydrated()),[D,F]=(0,u.useState)(p.START_INVITE||p.START_HANDOVER?'checking':'done'),[W,L]=(0,u.useState)(null),[K,U]=(0,u.useState)(0),[G,Y]=(0,u.useState)(!1),[$,B]=(0,u.useState)(null),X=(0,p.useSession)(e=>e.meId),Q=(0,p.useSession)(e=>!X||!!e.welcomed[X]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>H(!0));return p.useSession.persist.hasHydrated()&&H(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_HANDOVER&&!p.START_INVITE&&!z){z=!0;const n=await(0,I.claimChromeHandover)(p.START_HANDOVER);if(!t)return;if('ok'===n.status&&n.id.staffRef){R(N(n.id.staffRef)??E({id:n.id.staffRef,name:n.id.displayName||n.id.staffRef,role:'owner'===n.id.role?'owner':'manager'===n.id.role?'manager':'staff',level:'head_chef'===n.id.role?'Head Chef':void 0,job:'',active:!0}))}else if('refused'===n.status&&!e)return L(n.message),void F('done')}if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&L(e)});if(!t)return;if('refused'===e.kind)return L(e.message),void F('done');if('offline'===e.kind)return Y(!0),void(n=setTimeout(()=>{t&&U(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void F('bad')}const o=N(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),B(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}F('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,K]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!X){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t,{app:s,message:l})})}if(G)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===D)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!X&&!b.PITCH)return W&&/already been used/i.test(W)?j(x,'invite-app-used'):W&&(0,S.isPhoneLinked)(W)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):W?j(W,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===D)return(0,w.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,w.jsx)(T.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,w.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F('done')}),(0,w.jsx)(T.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(W&&!X&&(0,S.isPhoneLinked)(W))return(0,w.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:24,weight:"bold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,w.jsx)(T.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,w.jsx)(T.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(W&&!X)return(0,w.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,w.jsx)(T.Muted,{center:!0,children:W}),(0,w.jsx)(T.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,w.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>L(null)})]});if($&&!X)return(0,w.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,w.jsx)(T.Muted,{center:!0,children:$}),(0,w.jsx)(V,{})]});if(!X&&!b.PITCH&&!M())return(0,w.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:W?'This link can\u2019t be used here':'Sign in to CoverCharge'}),W?(0,w.jsx)(T.Muted,{center:!0,children:W}):null,(0,w.jsx)(T.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,w.jsx)(V,{})]});const q=(0,p.rosterPerson)(X);return q&&!Q&&_(q)?(0,w.jsx)(k.LaunchWelcome,{p:q,onDone:()=>p.useSession.getState().markWelcomed(q.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),m=_r(d[12]),k=_r(d[13]),T=_r(d[14]),I=_r(d[15]),b=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),w=_r(d[20]);const x='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,w.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const N=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return R(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=N(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=N(o.id.staffRef)??E({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return R(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function V(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,w.jsxs)(f.default,{style:{gap:6},children:[(0,w.jsx)(T.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsx)(T.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,w.jsx)(T.T,{size:13,colour:m.colours.red,children:t}):null]})}let z=!1;const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1411,[5,1412,1413,1414,1415,1416,34,236,41,102,872,1003,821,1417,794,988,2,1093,1002,892,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=E,_e.signInWithText=H,_e.SignInWithLink=V,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId),n=(0,T.useSync)(e=>'device'===e.kind&&!!e.venueId);return h.IS_CAR?!b.PITCH&&!n:j.includes(h.APP_VARIANT)&&!b.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,H]=(0,u.useState)(p.useSession.persist.hasHydrated()),[D,F]=(0,u.useState)(p.START_INVITE||p.START_HANDOVER?'checking':'done'),[W,L]=(0,u.useState)(null),[K,U]=(0,u.useState)(0),[G,Y]=(0,u.useState)(!1),[$,B]=(0,u.useState)(null),X=(0,p.useSession)(e=>e.meId),Q=(0,p.useSession)(e=>!X||!!e.welcomed[X]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>H(!0));return p.useSession.persist.hasHydrated()&&H(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!j.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_HANDOVER&&!p.START_INVITE&&!z){z=!0;const n=await(0,T.claimChromeHandover)(p.START_HANDOVER);if(!t)return;if('ok'===n.status&&n.id.staffRef){R(N(n.id.staffRef)??E({id:n.id.staffRef,name:n.id.displayName||n.id.staffRef,role:'owner'===n.id.role?'owner':'manager'===n.id.role?'manager':'staff',level:'head_chef'===n.id.role?'Head Chef':void 0,job:'',active:!0}))}else if('refused'===n.status&&!e)return L(n.message),void F('done')}if(p.START_INVITE&&!(e&&await(0,T.signedInHereAs)(e)&&await(0,T.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&L(e)});if(!t)return;if('refused'===e.kind)return L(e.message),void F('done');if('offline'===e.kind)return Y(!0),void(n=setTimeout(()=>{t&&U(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void F('bad')}const o=N(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,T.signedInHereAs)(o.id)){if(await(0,T.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),B(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}F('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,K]),!j.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!X){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t,{app:s,message:l})})}if(G)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===D)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!X&&!b.PITCH)return W&&/already been used/i.test(W)?v(x,'invite-app-used'):W&&(0,S.isPhoneLinked)(W)?v(S.PHONE_LINKED_TEXT,'invite-phone-linked'):W?v(W,'invite-app-refused'):v(P,'invite-app-notsetup');if('bad'===D)return(0,w.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,w.jsx)(I.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,w.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F('done')}),(0,w.jsx)(I.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(W&&!X&&(0,S.isPhoneLinked)(W))return(0,w.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:24,weight:"bold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,w.jsx)(I.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,w.jsx)(I.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(W&&!X)return(0,w.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,w.jsx)(I.Muted,{center:!0,children:W}),(0,w.jsx)(I.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,w.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>L(null)})]});if($&&!X)return(0,w.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,w.jsx)(I.Muted,{center:!0,children:$}),(0,w.jsx)(V,{})]});if(!X&&!b.PITCH&&!M())return(0,w.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:W?'This link can\u2019t be used here':'Sign in to CoverCharge'}),W?(0,w.jsx)(I.Muted,{center:!0,children:W}):null,(0,w.jsx)(I.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,w.jsx)(V,{})]});const q=(0,p.rosterPerson)(X);return q&&!Q&&_(q)?(0,w.jsx)(k.LaunchWelcome,{p:q,onDone:()=>p.useSession.getState().markWelcomed(q.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),m=_r(d[12]),k=_r(d[13]),I=_r(d[14]),T=_r(d[15]),b=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),w=_r(d[20]);const x='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,n)=>(0,w.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:e})}),j=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const N=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return R(t),_(t)?((0,T.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=N(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,T.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=N(o.id.staffRef)??E({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return R(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function V(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,w.jsxs)(f.default,{style:{gap:6},children:[(0,w.jsx)(I.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsx)(I.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,w.jsx)(I.T,{size:13,colour:m.colours.red,children:t}):null]})}let z=!1;const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1411,[5,1412,1413,1414,1415,1416,34,236,41,102,872,1003,821,1417,794,988,2,1093,1002,892,25]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1412,[34,102,873,794,5,6,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1413,[]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1414,[34,102,873,794,25]); diff --git a/customer-app/admin.html b/customer-app/admin.html index d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 0c5c26500429120e486e37c3b881dd7e511f6e7f..09f0d788eb1daeaf9b5b33a72173cc722fc17c1d 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 93c816bd6c6739f1917edd9fe00c34b1ce4129ab..a1f4fc3f9273144f69c47a55b8227ccd1142336b 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-007944bf60"; +const V = "cc-customer-29b11ea108"; const BASE = "/customer-app/"; -const PRECACHE = ["/customer-app/apple-touch-icon.png", "/customer-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/customer-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/customer-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/customer-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/customer-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/customer-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/customer-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/customer-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/customer-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/customer-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/customer-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/customer-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/customer-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/customer-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/customer-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/customer-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/customer-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/customer-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/customer-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/customer-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/customer-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/customer-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/customer-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/customer-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/customer-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/customer-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/customer-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/customer-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/customer-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/customer-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/customer-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/customer-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/customer-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/customer-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/customer-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/customer-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/customer-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/customer-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/customer-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/customer-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/customer-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/customer-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/customer-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/customer-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/customer-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/customer-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/customer-app/brand-logo.png", "/customer-app/favicon.ico", "/customer-app/icon-192.png", "/customer-app/icon-512.png", "/customer-app/icon-maskable-192.png", "/customer-app/icon-maskable-512.png", "/customer-app/manifest.webmanifest", "/customer-app/index.html", "/customer-app/_expo/static/js/web/bundle.js?v=007944bf60bcb0d3cdec5af8cbfd0fd7c02311af96daeb5a35f6d36d541c7de5"]; +const PRECACHE = ["/customer-app/apple-touch-icon.png", "/customer-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/customer-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/customer-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/customer-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/customer-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/customer-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/customer-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/customer-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/customer-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/customer-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/customer-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/customer-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/customer-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/customer-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/customer-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/customer-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/customer-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/customer-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/customer-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/customer-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/customer-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/customer-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/customer-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/customer-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/customer-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/customer-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/customer-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/customer-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/customer-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/customer-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/customer-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/customer-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/customer-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/customer-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/customer-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/customer-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/customer-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/customer-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/customer-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/customer-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/customer-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/customer-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/customer-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/customer-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/customer-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/customer-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/customer-app/brand-logo.png", "/customer-app/favicon.ico", "/customer-app/icon-192.png", "/customer-app/icon-512.png", "/customer-app/icon-maskable-192.png", "/customer-app/icon-maskable-512.png", "/customer-app/manifest.webmanifest", "/customer-app/index.html", "/customer-app/_expo/static/js/web/bundle.js?v=29b11ea108bed7f350e10a6e53aded4b23bf55093a3da7f49406dd0e945c1f91"]; // 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 d3926f75bf67cddf9fbd8f446a5c497ed8dad434..49ba89169a5212b4c0d5c61a393ae29012a8cdb9 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 4276aef4504061545633e6b7ee108b885c6dabee..1889b4a1fb97b5c9cfb247295cd809310334a5b6 100644 --- a/display-app/_expo/static/js/web/bundle.js +++ b/display-app/_expo/static/js/web/bundle.js @@ -1095,7 +1095,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()})},1012,[34,1013]); __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},1013,[1010,978,1014]); __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'}},1014,[1010]); -__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.155'},1015,[]); +__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.156'},1015,[]); __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});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:h}=await r.select();c&&s(c,h);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},h='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,h.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),h}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),h={...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:h})}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}}},1016,[1017,1018,934,978,1013]); __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())}}}},1018,[978]); @@ -1196,9 +1196,9 @@ __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,"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'},1113,[821]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},1114,[34,102,1115,821,1116,794,25]); __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 b={...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)(b)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(b,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}});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})},1115,[860,1100]); -__d(function(_g,r,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=$,_e.TablePicker=function({rid:e,booking:u,name:p,turnBase:k=90,onClose:v,onSaved:w,onPickOnPlan:T}){const C=(0,b.usePlan)(e),L=(0,c.useBookings)(e),[S,W]=(0,t.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),P=(0,t.useMemo)(()=>(0,h.pickGroups)(C),[C]),z=L.filter(e=>e.date===u.date),O=(0,h.seatsOf)(C,S),D=(0,h.seatLine)(O.total,u.partySize),I=(0,h.pickClashes)(u,S,z,k),B=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,M=(0,h.tableKey)(S)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),N=(0,f.useBlocks)(e=>e.blocks),R=(0,f.blockAt)(N,e,u.date,u.time),_=e=>W(s=>(0,h.toggleTable)(s,e)),Y=async s=>{try{await $(e,u,s),w?.((0,h.savedWords)(p,u.partySize,s,(0,h.seatsOf)(C,s).total)),v()}catch(e){w?.(`Couldn\u2019t save tables for ${p}: ${String(e?.message??e).slice(0,120)}`)}},G=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(S)} picked. ${D.text}.`,children:[(0,x.jsx)(y.T,{size:18,weight:"semibold",colour:g.colours.goldLight,children:(0,h.tablesWords)(S)}),(0,x.jsx)(y.T,{size:17,colour:g.colours.text,children:D.text})]}),R?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${R.from} to ${R.to}${R.reason?` (${R.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.goldMuted},children:(0,x.jsxs)(y.T,{size:16,colour:g.colours.goldLight,children:["New bookings paused ",R.from,"\u2013",R.to,R.reason?` \xb7 ${R.reason}`:'',". You can still save tables for this booking."]})}):null,I.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(I)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.gold},children:(0,x.jsxs)(y.T,{size:16,weight:"semibold",colour:g.colours.goldLight,children:[(0,h.clashWords)(I)," You can still save."]})}):null,(0,x.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(y.Button,{testID:"table-pick-save",label:I.length?'Save anyway':'Save tables',disabled:!M||!S.length,accessibilityLabel:`${I.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(S)} for ${p}. ${D.text}.${I.length?` ${(0,h.clashWords)(I)}`:''}`,onPress:()=>Y(S),style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(y.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${p}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(y.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:v,style:j})]})]});return(0,x.jsxs)(y.Sheet,{visible:!0,onClose:v,title:`Tables \xb7 ${u.time} ${p} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:G,children:[(0,x.jsx)(s.TableNumberWarning,{plan:C}),(0,x.jsx)(y.T,{size:16,colour:g.colours.text,children:"Tap one table, or several to join them. Tap again to take one off."}),T?(0,x.jsx)(y.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${p}`,onPress:()=>T(S),style:j}):null,P.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(y.T,{size:15,weight:"semibold",colour:g.colours.gold,children:e.area}),(0,x.jsx)(y.Row,{gap:8,wrap:!0,children:e.tables.map(e=>{const s=S.includes(e.name),t=B(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:s},'aria-checked':s,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,s,t),onPress:()=>_(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:s?2:1,borderColor:s?g.colours.gold:t?g.colours.goldMuted:g.colours.hairline,borderStyle:t&&!s?'dashed':'solid',backgroundColor:s?g.colours.gold:e?g.colours.tilePressed:g.colours.tile}),children:[(0,x.jsx)(y.T,{size:18,weight:"semibold",colour:s?g.colours.onGold:g.colours.text,children:(0,l.tableNumbers)(e.name)}),(0,x.jsxs)(y.T,{size:14,colour:s?g.colours.onGold:g.colours.muted,children:[e.seats," seats",t?' \xb7 booked':'']})]},e.name)})})]},e.area)),P.length?null:(0,x.jsx)(y.Muted,{children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var s=r(d[0]),l=r(d[1]),t=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),g=r(d[9]),p=r(d[10]),y=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function $(e,s,l){const t=(0,h.tableKey)(l),o=(0,b.tablesOf)(s.table);await c.repo.bookings.update(s.id,(0,u.tablePatch)(t||null)),'seated'===s.status&&s.date===(0,p.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(t).includes(e)).forEach(s=>b.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0})),t&&(0,k.resetTableLive)(e,t))}},1116,[1117,860,34,402,102,874,1025,1115,1118,821,858,794,1119,1022,25]); +__d(function(_g,r,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=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.amber,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(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?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.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=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1116,[1117,860,34,402,102,874,1025,1115,1118,821,858,794,1119,1022,25]); __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])},1117,[34,859,821,794,25]); -__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1118,[860,1100]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.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=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1118,[860,1100]); __d(function(g,_r,_i,_a,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 O}}),_e.useTableNames=N,_e.resetTableLive=M,_e.seatBookingNow=L,_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=F,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return R}}),_e.TablePicker=W,_e.WalkInSheet=E,_e.WalkInMatchPrompt=H,_e.AssignTableSheet=_,_e.undoNotice=Y,_e.NewBookingSheet=U,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[i,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,B.jsxs)(B.Fragment,{children:[s?(0,B.jsx)(E,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,B.jsx)(U,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,i?(0,B.jsx)(_,{booking:i.b,combine:i.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),i=_r(_d[5]),n=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),z=_r(_d[27]),B=_r(_d[28]);const O=Array.from({length:12},(e,t)=>String(t+1));function N(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function M(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}async function L(e,t){await f.repo.bookings.setStatus(t.id,'seated'),M(e,t.table)}function F(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=N(e),a=(0,S.useFloor)(t=>t.live[e])??{},i=(0,S.usePlan)(e),n=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(n,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(i.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,S.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,x.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const R=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function W({use:e,value:t,onPick:s,big:o,best:a,dense:i,bestSet:n,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=i?6:8,y=i?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(n??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,B.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],n=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!n,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,B.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?n?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:n,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:i?58:64,borderRadius:12,borderWidth:n||u?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:n||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:n?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||n?1:.55},children:[(0,B.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,B.jsx)(T.T,{weight:"bold",size:22,colour:n?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,B.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,B.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,B.jsx)(T.T,{size:i?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const A=[1,2,3,4,5,6,7,8];function E({onClose:e,onSeated:a,wide:i,initialTable:y}){const{rid:w,r:C,now:D}=(0,p.useCtx)(15e3),I=F(w,D),[$,P]=(0,r.useState)(2),[O,N]=(0,r.useState)(!1),[R,E]=(0,r.useState)(y??null),_=(0,S.usePlan)(w),Y=(0,f.useBookings)(w),U=(0,v.useBlocks)(e=>e.blocks),q=(0,v.closedAreasAt)(U,w,(0,x.ymd)(D),(0,x.hm)(D)),Q=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(I).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(_,Y.filter(e=>e.date===(0,x.ymd)(D)),e,$,D,(0,k.turnFor)($,C.settings.turnMins),90,void 0,{closed:q})?.table??null},[_,Y,I,$,q.size,D.getTime()]);(0,r.useEffect)(()=>{R&&(0,S.tablesOf)(R).some(e=>'Closed'===I[e]?.label)&&E(null)},[R,q.size]);const[V,G]=(0,r.useState)(!1),[K,X]=(0,r.useState)(''),J=(e,t=String(e),s=()=>{N(!1),P(e)})=>{const o='9+'===t?O:!O&&$===e;return(0,B.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:i?58:60,height:i?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,B.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},Z=(0,B.jsx)(s.PartySizeInput,{value:$,onChange:P,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),ee=(0,B.jsxs)(b.default,{style:{gap:8,width:i?256:void 0},children:[(0,B.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,B.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[A.map(e=>J(e)),J(9,'9+',()=>{N(!0),P(e=>e>=9?e:9)})]}),O?Z:null]}),[te,se]=(0,r.useState)(!1),[oe,le]=(0,r.useState)(null),ae=async(t=R,s=!1)=>{if(!te){if(!s){const e=(0,z.bookingsNearWalkIn)(Y,D,$);if(e.length)return void le({at:t,list:e})}se(!0);try{const s=await f.repo.bookings.seatWalkIn(w,$,t??void 0,K);M(w,t??void 0),a(s),e()}finally{se(!1)}}},ie=async(t,s)=>{if(!te){se(!0);try{const o=s??t.table??null;o&&o!==t.table&&await f.repo.bookings.assignTable(t.id,o),await L(w,{...t,table:o??void 0}),(0,n.notify)({id:`seated:${t.id}`,testID:'walkin-match-toast',timeoutMs:5e3,icon:'\u2713',title:`${t.name} seated \xb7 ${t.partySize} \xb7 ${o?(0,l.tableNumbers)(o):'table to assign'} (booking ${t.ref})`}),le(null),e()}finally{se(!1)}}},ne=(0,B.jsxs)(b.default,{style:{gap:8,flex:i?1:void 0,minWidth:0},children:[(0,B.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,B.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),R?(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>E(null)}):null]}),(0,B.jsx)(W,{use:I,value:R,onPick:e=>{I[e]&&!I[e].busy?ae(e):E(R===e?null:e)},big:i,dense:i,best:Q,bestSet:(0,u.bestTables)(_)}),(0,B.jsxs)(T.Muted,{children:["Tap a free table to seat them there",Q&&!R?` (suggested for ${$}: ${(0,l.tableNumbers)(Q)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(D)}`,maxWidth:i?1100:void 0,testID:"walkin-sheet",children:[(0,B.jsx)(T.Button,{label:`Seat walk-in \xb7 ${$} ${1===$?'person':'people'}${R?` \xb7 ${(0,l.tableNumbers)(R)}`:''}`,disabled:te,onPress:()=>{ae()},testID:"seat-walkin",style:{minHeight:52}}),i?(0,B.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[ee,ne]}):(0,B.jsxs)(B.Fragment,{children:[ee,ne]}),(0,B.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[V?(0,B.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:K,onChangeText:X,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,B.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,B.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]}),oe?(0,B.jsx)(H,{list:oe.list,busy:te,onYes:e=>{ie(e,oe.at)},onNo:()=>{const e=oe.at;le(null),ae(e,!0)},onClose:()=>le(null)}):null]})}function H({list:e,busy:t,onYes:s,onNo:o,onClose:a}){return(0,B.jsx)(T.Sheet,{visible:!0,onClose:a,title:"Booked party?",maxWidth:720,testID:"walkin-match",children:(0,B.jsxs)(b.default,{style:{gap:14},children:[e.map((e,o)=>(0,B.jsxs)(b.default,{testID:`walkin-match-${o}`,style:{gap:12,padding:16,borderRadius:16,borderWidth:2,borderColor:j.colours.gold,backgroundColor:'#15130F'},children:[(0,B.jsx)(b.default,{accessibilityRole:"header",accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:26,weight:"bold",colour:j.colours.goldLight,testID:"walkin-match-question",children:(0,z.walkInMatchQuestion)(e)})}),e.table?(0,B.jsxs)(T.T,{size:17,colour:j.colours.text,children:["Booked table ",(0,l.tableNumbers)(e.table)," \xb7 ",e.ref]}):(0,B.jsx)(T.T,{size:17,colour:j.colours.text,children:e.ref}),(0,B.jsx)(T.Button,{label:"Yes, seat booking",testID:"walkin-match-yes",disabled:t,accessibilityLabel:`Yes, seat ${e.name}'s booking, ${e.partySize} people`,onPress:()=>s(e),style:{minHeight:64}})]},e.id)),(0,B.jsx)(T.Button,{kind:"secondary",label:"No, new walk-in",testID:"walkin-match-no",disabled:t,onPress:o,style:{minHeight:64}})]})})}function _({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:i}=(0,p.useCtx)(15e3),n=F(o,i),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[n,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(i)),t,e.partySize,i,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,i.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),O=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&M(o,l),t()},L=C?(0,B.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,B.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,B.jsx)(b.default,{testID:"combine-short",children:(0,B.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,B.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,B.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>N(I)}),(0,B.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,B.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${R(e)}`,testID:"assign-table-sheet",footer:L,children:[v&&!C?(0,B.jsx)(b.default,{testID:"assign-suggested",children:(0,B.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,B.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,B.jsx)(W,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await N([e])}})]})}function Y(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${R(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function U({date:e,onClose:t,wide:n,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:O}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,L]=(0,r.useState)(ee.blocks),[W,A]=(0,r.useState)(!1),[E,H]=(0,r.useState)(''),[_,Y]=(0,r.useState)(2),[U,q]=(0,r.useState)(null),[Q,V]=(0,r.useState)(''),[G,K]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ie=(0,S.usePlan)(u),ne=(0,P.dogSetUp)(ie),re=!0===te.dog&&ne,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(_,c.settings.turnMins),be=F.filter(e=>e.date===M),he=e=>(0,k.freeTablesAt)(ie,be,_,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(R,u,M,e)}),ge=re&&U?he(U):[];(0,r.useEffect)(()=>{ae(null)},[re,U,_]);const pe=(0,y.bookingSlots)(c,ue,e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),_,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0),e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),me=(0,w.ukPhone)(G),[fe,ye]=(0,r.useState)(!1),ke=U?pe.find(e=>e.time===U):void 0,xe=ke&&ke.left<_?{left:Math.max(0,ke.left),time:ke.time}:null,je=ke&&null!=ke.partiesLeft&&ke.partiesLeft<1?{time:ke.time,cap:ke.partiesCap??0}:null,we=xe||je,Te=U?(0,v.blockAt)(R,u,M,U):void 0,Se='staff'!==z,ve=!!U&&!(0,D.dogTimeOk)(c,F,M,U,de),Ce=!oe.length&&E.trim().length>=2&&!!U&&(!we||fe)&&(0,o.validParty)(_)&&me.ok&&(0,w.emailOk)(X)&&(!Te||Se&&W)&&(!re||ge.length>0)&&!ve,De=te.wheelchair>0||te.stepFree;return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,B.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:_,audience:"staff"}),te.dog&&!ne?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,B.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(L(e),q(null),A(!1))}}),(0,B.jsxs)(T.Row,{gap:6,children:[(0,B.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,B.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,B.jsx)(T.Field,{label:"Name",value:E,onChangeText:H,placeholder:"e.g. Reid",testID:"nb-name"}),(0,B.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&G?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,B.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,B.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(T.T,{center:!0,children:"Covers"}),(0,B.jsx)(s.PartySizeInput,{value:_,onChange:e=>{Y(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!he(e.time).length||!(0,D.dogTimeOk)(c,F,M,e.time,de);return(0,B.jsx)(T.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,v.blockAt)(R,u,M,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:U===e.time,onPress:()=>{q(e.time),A(!1),ye(!1)}},e.time)})}),we?(0,B.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[xe?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(_,xe.left,xe.time)}):null,je?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overPartiesNote)(je.time,je.cap)}):null,(0,B.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&U?(0,B.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,B.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,B.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ie.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),ge.length?(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:ge.slice(0,10).map((e,t)=>(0,B.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${De&&(0,P.accessibleSetUp)(ie)&&!(0,P.isAccessible)(ie,e.table)?' \xb7 not step-free':''}`,selected:(le??ge[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",_," at ",U,". Try another time."]})]}):null,Te?(0,B.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,B.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",Te.from,"\u2013",Te.to,Te.reason?` (${Te.reason})`:'']}),Se?(0,B.jsx)(T.Chip,{label:W?'Manager override on':'Override and book anyway',selected:W,onPress:()=>A(e=>!e)}):(0,B.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,B.jsx)(b.default,{testID:"nb-closed",children:(0,B.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,B.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:_,date:M,time:U,today:(0,x.ymd)(h),bookings:F,audience:"staff",showTables:!1!==c.settings.tableRequests}),De&&!(0,P.accessibleSetUp)(ie)?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,B.jsx)(T.Field,{label:"Notes (optional)",value:Q,onChangeText:V,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,i.depositDue)((0,i.depositOf)(c.settings),_)?(0,B.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,i.depositDue)((0,i.depositOf)(c.settings),_))," (",(0,a.gbp)((0,i.depositOf)(c.settings).perPersonPence)," per person for ",(0,i.depositOf)(c.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,B.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),ve?(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",U,". Try another time: dogs are very welcome then."]}):null,(0,B.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Ce,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||ge.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:_,date:M,time:U,notes:Q.trim(),security:(0,i.depositDue)((0,i.depositOf)(c.settings),_)?'deposit':'none',depositPaid:0,...(0,i.depositDue)((0,i.depositOf)(c.settings),_)?{depositDue:(0,i.depositDue)((0,i.depositOf)(c.settings),_),depositPolicy:(0,i.depositWords)((0,i.depositOf)(c.settings),_,c.name).join(' '),depositRefundable:(0,i.depositOf)(c.settings).refundable,depositCutoffHours:(0,i.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===U)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??ge[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,O)).catch(()=>{}),d?.({date:M,time:U,name:E.trim()}),t()}})]})}},1119,[827,1120,1121,860,867,14,1122,34,859,402,102,872,1084,874,1123,1100,858,821,864,794,1025,1022,1124,1125,1130,1102,1096,1131,25]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,$]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{$(String(e))},[e]);const w=e=>p((0,s.clampParty)(e,b,y)),I=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>w(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:c.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(u.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:c.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?I(-10,'\u221210',"10 fewer people"):null,I(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{$(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&w((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);$(String(e)),w(e)},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:c.colours.border,color:c.colours.text,backgroundColor:c.colours.surface,textAlign:'center',fontSize:20,fontFamily:c.fonts.semibold}}),I(1,'+','One more person'),y-b>=20?I(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),c=r(_d[5]),u=r(_d[6]),d=r(_d[7])},1120,[34,402,412,102,1121,821,794,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return 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.`},1121,[]); @@ -1210,12 +1210,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}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"fitLabel",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"BIG_LABEL_MIN",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"OCC_LABEL_MIN",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"occupiedLabel",{enumerable:!0,get:function(){return S}}),_e.areaBounds=I,_e.minReadableScale=function(e,t){return Math.max(0,...e.tables.filter(e=>e.areaId===t).map(e=>{const t='round'===e.shape?.85:1,o=(7.4399999999999995*Math.max(1,(0,g.tableNumber)(e).length)+6)/(e.w*t),n=22/Math.min(e.w,e.h);return Math.max(o,n)}))},_e.seatSpots=R,_e.FixtureShape=T,_e.FloorCanvas=function(e){const[$,L]=(0,r.useState)({w:0,h:0}),z=e.plan.tables.filter(t=>t.areaId===e.areaId),E=e.crop&&z.length?I(e.plan,e.areaId):{x:0,y:0,w:l.PLAN_W,h:l.PLAN_H},F='live'===e.mode?[...new Map(z.flatMap(t=>{const o=e.view?.[t.name];if(!o?.group||o.group.length<2)return[];const n=[...o.group].sort().join('+');return[[n,{key:n,members:o.group,view:o}]]})).values()]:[],O=28*F.length,D={x:E.x,y:E.y,r:E.x+E.w,b:E.y+E.h},_=$.w?'width'===e.fit?Math.min($.w/l.PLAN_W,e.maxH?e.maxH/l.PLAN_H:9):Math.min($.w/E.w,Math.max(1,$.h-O)/E.h):0,B=e.fill&&'contain'===e.fit&&_>0&&$.h>0,N=B?($.w/_-E.w)/2:0,P=B?(($.h-O)/_-E.h)/2:0,W={x:D.x-N,y:D.y-P,r:D.r+N,b:D.b+P},H=W.r-W.x,G=W.b-W.y,[Y,X]=(0,r.useState)(null),U=(0,r.useRef)(null),[q,J]=(0,r.useState)(null),K=(0,r.useRef)(null);K.current=q,i.default.useEffect(()=>{if(!q)return;const e=setTimeout(()=>J(null),n.ARM_MS);return()=>clearTimeout(e)},[q]);const V='live'===e.mode&&!!e.onDrop,Q=e=>!V||(0,n.isArmed)(K.current,e.id,Date.now()),Z=t=>e.plan.sections.find(e=>e.id===t.sectionId),ee=t=>e.plan.joins.find(e=>e.tables.includes(t.name)),te=i.default.useMemo(()=>(0,g.numberClashes)(e.plan.tables).sameArea,[e.plan.tables]),oe=(t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>Q(t),onResponderTerminationRequest:()=>!Q(t),onResponderGrant:e=>{U.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,id:t.id,kind:o}},onResponderMove:n=>{const r=U.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,a=n.nativeEvent.pageY-r.y;Math.abs(i)+Math.abs(a)<6&&!Y||Q(t)&&('live'!==e.mode||e.onDrop&&e.view&&['seated','mains','dessert','bill'].includes(e.view[t.name]?.status)&&e.view[t.name]?.booking)&&X({id:t.id,dx:i,dy:a,kind:o})},onResponderRelease:r=>{const i=U.current;U.current=null;const s=r.nativeEvent.pageX-(i?.x??0),u=r.nativeEvent.pageY-(i?.y??0);if(X(null),Math.abs(s)+Math.abs(u)<6||!_){if('move'===o){if(V){const e=(0,n.releaseOn)(K.current,t.id,!1,Date.now());if(J(e.arm),'select'===e.action)try{a.default.announceForAccessibility(n.SELECTED_A11Y)}catch{}}e.onTap?.(t)}return}if(V){const e=(0,n.releaseOn)(K.current,t.id,!0,Date.now());if(J(e.arm),'move'!==e.action)return}const h=s/_,c=u/_;if('edit'===e.mode&&'move'===o)e.onMove?.(t,w(v(t.x+h,e.snapOn),0,l.PLAN_W-t.w),w(v(t.y+c,e.snapOn),0,l.PLAN_H-t.h));else if('edit'===e.mode&&'resize'===o)e.onResize?.(t,w(v(t.w+h,e.snapOn),50,400),w(v(t.h+c,e.snapOn),50,300));else if('live'===e.mode&&e.onDrop){const o=t.x+t.w/2+h,n=t.y+t.h/2+c,r=z.find(e=>e.id!==t.id&&o>=e.x-10&&o<=e.x+e.w+10&&n>=e.y-10&&n<=e.y+e.h+10);r&&e.onDrop(t,r)}}}),ne=e=>e*_,re=e=>ne(e-W.x),ie=e=>ne(e-W.y),ae='width'===e.fit?l.PLAN_H*_+O||200:void 0;return(0,x.jsxs)(s.default,{testID:"floor-canvas",onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),style:[{width:'100%',borderRadius:16,overflow:'hidden'},'contain'===e.fit?{flex:1}:{height:ae}],children:[F.map(e=>{const o=z.filter(t=>e.members.includes(t.name)),n=o.length?(Math.min(...o.map(e=>e.x))+Math.max(...o.map(e=>e.x+e.w)))/2:W.x+H/2,r=e.view.booking?.time??e.view.next?.time,i=`${A(e.members)}${r?` \xb7 ${'seated'===e.view.status?'Seated':'Booked'} ${r}`:''}`,a=Math.min(Math.max(0,$.w-8),260);return(0,x.jsx)(s.default,{testID:`joined-label-${e.key}`,accessible:!0,accessibilityLabel:`Joined tables ${i}`,pointerEvents:"none",style:{height:28,width:a,marginLeft:w(ne(n-W.x)-a/2,4,Math.max(4,$.w-a-4)),alignItems:'center',justifyContent:'center',overflow:'hidden',borderRadius:8,borderWidth:1,borderColor:h.colours.gold,backgroundColor:(0,t.soutersSurface)('#0B0B0B')},children:(0,x.jsx)(c.T,{size:16,weight:"bold",colour:h.colours.goldLight,center:!0,numberOfLines:1,children:i})},e.key)}),_?(0,x.jsx)(s.default,{style:{width:ne(H),height:ne(G),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0F0E0C'),borderRadius:16,borderWidth:1,borderColor:h.colours.border,overflow:'hidden'},children:(0,x.jsxs)(s.default,{style:{position:'absolute',left:0,top:0,width:ne(H),height:ne(G)},children:['edit'===e.mode?Array.from({length:l.PLAN_W/(2*l.GRID)},(e,o)=>(0,x.jsx)(s.default,{style:{position:'absolute',left:re(o*l.GRID*2),top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`v${o}`)):null,'edit'===e.mode?Array.from({length:l.PLAN_H/(2*l.GRID)},(e,o)=>(0,x.jsx)(s.default,{style:{position:'absolute',top:ie(o*l.GRID*2),left:0,right:0,height:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`h${o}`)):null,(e.plan.fixtures??[]).filter(t=>t.areaId===e.areaId).map(t=>(0,x.jsx)(T,{f:{...t,x:t.x-W.x,y:t.y-W.y},S:ne,live:'live'===e.mode},t.id)),e.plan.joins.map(e=>{const t=z.filter(t=>e.tables.includes(t.name));if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,x.jsx)(s.default,{testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:re((r+a)/2-u/2),top:ie((i+l)/2)-3,width:ne(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.55)',transform:[{rotate:`${h}rad`}]}},e.id)}),z.map(n=>{const r=e.view?.[n.name],a=r?u.STATUS[r.status]:u.STATUS.free,v=Y?.id===n.id,w=v&&'resize'===Y.kind?Math.max(50,n.w+Y.dx/_):n.w,$=v&&'resize'===Y.kind?Math.max(50,n.h+Y.dy/_):n.h,I=v&&'move'===Y.kind?n.x+Y.dx/_:n.x,T=v&&'move'===Y.kind?n.y+Y.dy/_:n.y,A=e.selected===n.id||e.highlight?.includes(n.name)||q?.id===n.id,L=Z(n),z='edit'===e.mode?'#2A2419':a.colour,E='edit'===e.mode?h.colours.text:a.fg,F='round'===n.shape?ne(Math.min(w,$))/2:ne(10),O='live'===e.mode?(0,g.liveTableLabel)(n,te):(0,l.tableLabel)(n),D=ne(Math.min(w,$))<64,B=r?r.covers>0?r.covers:'soon'===r.status?(r.next??r.dayBookings?.[0])?.partySize??0:0:0,N=e.big&&'live'===e.mode&&r&&!(r.group&&r.group.length>1)&&k.has(r.status)&&B>0,P=N?S(O,B):O,W=M(e.big?Math.max(13,Math.min(34,ne(Math.min(w,$))/3)):Math.max(11,Math.min(22,ne(Math.min(w,$))/4)),P,ne(w)*('round'===n.shape?.85:1),N?C:e.big?j:9),H=ne(w)*('round'===n.shape?.85:1),G=e=>e.length*W*.62+6,X=N&&G(P)>H,U=X&&Math.max(G(O),G(`(${B})`))<=H&&1.2*W*2<=ne($)-4,J=X&&!U,K=Math.max(e.big?11:12,Math.round(.62*W)),V=(ne($)-6-1.4*W)/(1.4*K),Q=V>=2&&ne(w)>=5*K?2:V>=1?1:0,ae=r?.booking&&void 0!==r.seatedMins?r.booking.time:void 0,se='soon'===r?.status?r.next?.time??r.dayBookings?.[0]?.time:void 0,le='edit'===e.mode?`Table ${(0,o.tableNumbers)(O)}, ${(0,l.shapeLabel)(n.shape).toLowerCase()}, ${n.minSeats}\u2013${n.maxSeats} seats${n.online?', bookable online':''}`:'soon'===r?.status?`Table ${(0,o.tableNumbers)(O)}, booked later${se?`, ${se}`:''}${r.group?`, combined with ${r.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`:`Table ${(0,o.tableNumbers)(O)}, ${a.label}${void 0!==r?.seatedMins?`, seated ${r.seatedMins} min`:''}${r?.covers?`, ${r.covers} Covers`:''}${r?.dayBookings?.length?`, booked: ${r.dayBookings.map(e=>`${e.time}, ${e.partySize} Covers`).join('; ')}`:''}${r?.group?`, combined with ${r.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`,de=void 0!==r?.seatedMins&&r.booking?Math.min(1.2,r.seatedMins/(r.booking.durationMins??(0,u.turnFor)(r.booking.partySize,e.turnBase))):null;return(0,x.jsxs)(i.default.Fragment,{children:[R({...n,w:w,h:$}).map((t,o)=>(0,x.jsx)(s.default,{pointerEvents:"none",style:[{position:'absolute',left:re(I+t.x)-Math.max(4,ne(8)),top:ie(T+t.y)-Math.max(4,ne(8)),width:Math.max(8,ne(16)),height:Math.max(8,ne(16)),borderRadius:99,backgroundColor:'edit'===e.mode?'#5A4C33':'rgba(255,255,255,0.16)',borderWidth:1,borderColor:'edit'===e.mode?h.colours.gold:'rgba(255,255,255,0.25)'},y()]},o)),'live'===e.mode&&(ne(w)<44||ne($)<44)?(0,x.jsx)(s.default,{accessible:!1,importantForAccessibility:"no-hide-descendants",'aria-hidden':!0,...oe(n,'move'),style:{position:'absolute',left:re(I+w/2)-Math.max(44,ne(w))/2,top:ie(T+$/2)-Math.max(44,ne($))/2,width:Math.max(44,ne(w)),height:Math.max(44,ne($)),zIndex:2}}):null,(0,x.jsxs)(s.default,{testID:`table-${n.name}`,accessibilityRole:"button",accessibilityLabel:le,onAccessibilityTap:()=>e.onTap?.(n),onKeyDown:t=>{'Enter'!==t?.key&&' '!==t?.key||e.onTap?.(n)},tabIndex:0,...oe(n,'move'),style:[{position:'absolute',left:re(I),top:ie(T),width:ne(w),height:ne($),borderRadius:F,backgroundColor:z,alignItems:'center',justifyContent:'center',padding:2,overflow:J?'visible':'hidden',borderWidth:A?3:e.sectionColours&&L?2.5:1.5,borderColor:A?'#FFFFFF':e.sectionColours&&L?(0,h.brandColour)(L.colour):'edit'===e.mode?h.colours.gold:'rgba(0,0,0,0.35)',transform:[{scale:v?1.06:1}],zIndex:v?50:J?4:3,opacity:v&&'live'===e.mode?.85:1,shadowColor:'#000',shadowOpacity:v?.6:.3,shadowRadius:v?14:6,cursor:'edit'===e.mode?'grab':'pointer',touchAction:'none'},v?null:y()],children:[(0,x.jsxs)(s.default,{style:J?{alignItems:'center',justifyContent:'center',overflow:'visible'}:{alignItems:'center',justifyContent:'center',maxWidth:'100%',maxHeight:'100%',overflow:'hidden'},pointerEvents:"none",children:[N?(0,x.jsx)(c.T,{testID:`table-label-${n.name}`,style:U?{flexShrink:0,lineHeight:Math.round(1.2*W),maxWidth:Math.max(20,H-4)}:J?{...p,whiteSpace:'nowrap',textShadowColor:'rgba(0,0,0,0.9)',textShadowRadius:3,textShadowOffset:{width:0,height:0}}:p,weight:"bold",size:W,colour:J?'#FFFFFF':E,center:!0,numberOfLines:U?2:1,children:P}):(0,x.jsx)(c.T,{style:p,weight:"bold",size:W,colour:E,center:!0,numberOfLines:1,children:O}),'live'===e.mode&&'blocked'===r?.status?(0,x.jsx)(c.T,{style:f,size:Math.max(10,Math.round(.5*W)),weight:"semibold",colour:E,center:!0,numberOfLines:1,children:"Blocked"}):null,N||'live'===e.mode&&r?.group&&r.group.length>1?null:e.big&&'live'===e.mode&&r&&1===Q?'free'!==r.status&&'soon'!==r.status&&(r.covers||ae)?(0,x.jsx)(c.T,{style:f,size:K,weight:"bold",colour:E,center:!0,numberOfLines:1,children:[r.covers?`${r.covers}`:'',ae??''].filter(Boolean).join(' \xb7 ')}):null:e.big&&'live'===e.mode&&r&&2===Q?(0,x.jsxs)(x.Fragment,{children:['soon'!==r.status&&r.covers?(0,x.jsxs)(c.T,{style:f,size:K,weight:"semibold",colour:E,center:!0,children:[r.covers," ",1===r.covers?'Cover':'Covers']}):'free'!==r.status||D?null:(0,x.jsxs)(c.T,{style:f,size:K,colour:E,center:!0,children:[n.minSeats,"\u2013",n.maxSeats]}),'free'!==r.status&&'soon'!==r.status&&ae?(0,x.jsx)(c.T,{style:f,size:K,weight:"bold",colour:E,center:!0,children:ae}):'dirty'===r.status?(0,x.jsx)(c.T,{style:f,size:K,colour:E,center:!0,children:"Clear"}):null]}):e.big&&'live'===e.mode?null:'edit'===e.mode?D?null:(0,x.jsxs)(c.T,{style:f,size:11,colour:h.colours.muted,center:!0,children:[n.minSeats,"\u2013",n.maxSeats,n.online?' \xb7 online':'']}):r?(0,x.jsxs)(x.Fragment,{children:['free'!==r.status||D?null:(0,x.jsxs)(c.T,{style:f,size:11,colour:E,center:!0,children:[n.minSeats,"\u2013",n.maxSeats," seats"]}),void 0!==r.seatedMins?(0,x.jsxs)(c.T,{style:f,size:12,weight:"semibold",colour:E,center:!0,children:[r.seatedMins,"m \xb7 ",r.covers,"\ud83d\udc65"]}):r.orderOnly?(0,x.jsx)(c.T,{style:f,size:11,colour:E,center:!0,children:"Open order"}):null,'dirty'!==r.status||D?null:(0,x.jsx)(c.T,{style:f,size:11,colour:E,center:!0,children:"Clear"}),!D||r.allergy||r.vip?(0,x.jsxs)(c.T,{style:f,size:11,colour:E,center:!0,children:[r.allergy?'\u26a0':'',r.vip?'VIP'===r.vip?'\u2605':'\u2665':'',r.occasion?u.OCCASION_ICON[r.occasion]:'',r.note?'\u270e':'']}):null]}):null]}),null,'live'===e.mode&&r&&!D&&(r.booking??r.next)&&(0,b.needsIcons)(r.booking??r.next).replace('\u26a0\ufe0f','').trim()?(0,x.jsx)(s.default,{pointerEvents:"none",testID:`needs-${n.name}`,style:{position:'absolute',bottom:e.big?-Math.max(9,.55*K):2,right:e.big?-6:4,backgroundColor:(0,t.soutersSurface)('rgba(11,11,11,0.85)'),borderRadius:8,paddingHorizontal:4,borderWidth:1,borderColor:'rgba(255,255,255,0.15)'},children:(0,x.jsx)(c.T,{size:e.big?Math.max(11,.75*K):10,children:(0,b.needsIcons)(r.booking??r.next).replace('\u26a0\ufe0f','').trim()})}):null,L&&'live'===e.mode&&e.sectionColours&&!D&&!e.big?(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:3,right:6,backgroundColor:(0,h.brandColour)(L.colour),borderRadius:6,paddingHorizontal:3},children:(0,x.jsx)(c.T,{size:9,weight:"bold",colour:"#0B0B0B",children:L.server})}):null,null===de||D?null:(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:'15%',right:'15%',bottom:5,height:4,borderRadius:2,backgroundColor:'rgba(0,0,0,0.25)'},children:(0,x.jsx)(s.default,{style:{width:`${Math.min(100,100*de)}%`,height:4,borderRadius:2,backgroundColor:de>=1?'#B3261E':'rgba(0,0,0,0.6)'}})}),ee(n)&&'edit'===e.mode?(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',bottom:2,left:4},children:(0,x.jsx)(c.T,{size:10,colour:h.colours.gold,children:"\u26d3"})}):null]}),'edit'===e.mode&&e.selected===n.id?(0,x.jsx)(s.default,{testID:"resize-handle",accessibilityLabel:"Resize table",...oe(n,'resize'),style:{position:'absolute',left:re(I+w)-14,top:ie(T+$)-14,width:28,height:28,borderRadius:14,backgroundColor:h.colours.gold,borderWidth:2,borderColor:'#fff',zIndex:60,cursor:'nwse-resize',touchAction:'none'}}):null]},n.id)}),0===z.length?(0,x.jsx)(s.default,{style:{position:'absolute',left:0,right:0,top:'45%'},children:(0,x.jsxs)(c.T,{center:!0,colour:h.colours.muted,children:["No tables in this area yet",'edit'===e.mode?' \u2014 add some in Tables':'',"."]})}):null]})}):null]})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),i=e(r),a=e(_r(d[4]));_r(d[5]);var s=e(_r(d[6])),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),c=_r(d[10]),b=_r(d[11]),g=_r(d[12]),x=_r(d[13]);const f={flexShrink:0},p={flexShrink:0,maxWidth:'none'},y=(e=250)=>({transitionProperty:'background-color, border-color, transform, left, top, width, height',transitionDuration:`${e}ms`}),v=(e,t=!0)=>t?Math.round(e/l.GRID)*l.GRID:Math.round(e),w=(e,t,o)=>Math.max(t,Math.min(o,e)),M=(e,t,o,n=9)=>Math.max(n,Math.min(e,(o-6)/(.62*Math.max(1,t.length)))),j=12,C=11,k=new Set(['soon','seated','mains','dessert','bill']),S=(e,t)=>`${e} (${t})`,$=46;function I(e,t){const o=e.tables.filter(e=>e.areaId===t);if(!o.length)return{x:0,y:0,w:l.PLAN_W,h:l.PLAN_H};const n=Math.max(0,Math.min(...o.map(e=>e.x))-$),r=Math.max(0,Math.min(...o.map(e=>e.y))-$);return{x:n,y:r,w:Math.min(l.PLAN_W,Math.max(...o.map(e=>e.x+e.w))+$)-n,h:Math.min(l.PLAN_H,Math.max(...o.map(e=>e.y+e.h))+$)-r}}function R(e){const t=Math.max(1,e.maxSeats),o=[];if('round'===e.shape){const n=e.w/2+9.6,r=e.h/2+9.6;for(let i=0;ie.w,r=Math.ceil(t/2),i=t-r;if(n){for(let t=0;te.w,a=n?{borderColor:'#FFFFFF',borderWidth:2}:null;return'bar'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#2A2216':'#3A2E1C',borderRadius:8,borderWidth:1.5,borderColor:o?'#5A4A30':h.colours.gold},a],children:(0,x.jsx)(c.T,{size:Math.max(9,Math.min(14,t(e.h)/2.4)),weight:"semibold",colour:h.colours.goldLight,children:"BAR"})}):'wall'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#3A3631':'#5C574F',borderRadius:2},a]}):'window'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:'rgba(226,196,137,0.16)',borderColor:'rgba(226,196,137,0.6)',borderWidth:1,borderRadius:2},a],children:!o&&t(i?e.h:e.w)>60?(0,x.jsx)(c.T,{size:9,colour:"#BFDDFF",style:i?{transform:[{rotate:'90deg'}]}:void 0,children:"WINDOW"}):null}):(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{borderColor:o?'#7A6440':h.colours.gold,borderWidth:1.5,borderStyle:'dashed',borderRadius:3,backgroundColor:'rgba(207,164,95,0.08)'},a],children:t(i?e.h:e.w)>40?(0,x.jsx)(c.T,{size:9,colour:h.colours.goldLight,style:i?{transform:[{rotate:'90deg'}]}:void 0,children:"DOOR"}):null})}function A(e){return(0,l.tablesLabel)(e.join('+')).replace(/^Tables? /,'').replace(/ \+ /g,'+')}},1127,[828,860,1128,34,281,236,102,1025,1100,821,794,1102,859,25]); __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])},1129,[34,402,102,874,861,863,821,794,25]); -__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 a}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return o}}),_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 d}}),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 l}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return f}}),_e.changedFields=P,_e.historyText=O,_e.editPatch=function(t,a,s,o=(new Date).toISOString()){const n=P(t,a);if(!n.length)return{};const d={};for(const c of n)switch(c){case'partySize':d.partySize=(0,e.clampParty)(Number(a.partySize));break;case'phone':case'email':case'table':d[c]=String(a[c]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[c]=String(a[c]??'').trim();break;case'area':d.area=(a.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(a.dogs??0)),d.dog=Number(a.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(a.highChairs??0))||void 0;break;case'wheelchair':d.access={...t.access??{},wheelchair:Math.max(0,Number(a.wheelchair??0))||void 0};break;case'occasion':d.occasion=a.occasion||void 0;break;case'allergies':d.allergies=[...a.allergies??[]],d.allergyNone=!!a.allergyNone&&!(a.allergies??[]).length,d.allergyNote=(a.allergyNote??'').trim()||void 0,(a.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(a.vegan??0)||void 0,vegetarian:Number(a.vegetarian??0)||void 0};break;case'deposit':if(!a.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(a.depositDue??0))),a.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(a.depositDate??'')?a.depositDate:o.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(a.depositAmount??0))),depositPaidBy:s.by.slice(0,80),depositPaidAt:e===o.slice(0,10)?o:`${e}T12:00:00.000Z`,depositMethod:a.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=a.status,'seated'!==a.status||t.seatedAt||(d.seatedAt=o),'finished'!==a.status||t.finishedAt||(d.finishedAt=o),'confirmed'!==a.status&&'pending'!==a.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=a.source||void 0;break;case'tags':d.tags=[...(t.tags??[]).filter(e=>!p.includes(e)),...a.tags??[]];break;case'duration':d.durationMins=Number(a.duration??0)>=15?Number(a.duration):void 0}n.includes('table')&&(d.tableSetHere=!0);const c=t;return d.locallyEdited=!0,d.editedFields=[...new Set([...c.editedFields??[],...n])],d.editLog=[...c.editLog??[],{at:o,by:s.by.slice(0,80),app:s.app,fields:n,text:O(t,a,n,s.by.slice(0,80),o)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>b[e]??e).join(', ')} changed by ${e.by} ${N(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,a,s,o,n=90,d){const c=[];if(!P(e,a).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return c;const u={...e,date:a.date,time:a.time,partySize:a.partySize,...Number(a.duration??0)>=15?{durationMins:Number(a.duration)}:{}};if(a.table){const e=(0,t.tableOverlaps)(u,a.table,s.filter(e=>e.date===a.date),n);if(e.length&&c.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),d){const e=a.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>d.tables.find(t=>t.name===e)).filter(Boolean),t=e.reduce((e,t)=>e+t.maxSeats,0);e.length&&td.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(a.dogs??0)>0&&s.length&&c.push(`Dogs aren\u2019t allowed in ${s[0].name}. Pick a dog-friendly table.`)}}o&&c.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return c},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return k}}),_e.bookingExtras=function(e){const t=e,a=e.dogs??(e.dog?1:0),s=[];a&&s.push(w(a,'dog','dogs'));t.highChairs&&s.push(w(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&s.push(w(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&s.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&s.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&s.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&s.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&s.push(`Deposit by ${t.depositMethod}`);return s.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]);const a='For example: birthday, high chair, dog, window seat',s='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.',o=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')},d=['date','time','partySize','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration'],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'}],l=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],h=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],p=['VIP','Regular'],b={date:'date',time:'time',partySize:'covers',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'},f=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:(a=e.depositPaidAt,a?a.slice(0,10):''),depositDue:e.depositDue??0,status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>p.includes(e)).sort(),duration:e.durationMins??0};var a},y=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),$=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'']:[!1]);function v(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return y(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return $(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':return Number(t[e]??0);default:return String(t[e]??'').trim()}}function P(e,t){const a=f(e);return d.filter(e=>v(e,a)!==v(e,t))}const S=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,N=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},w=(e,t,a)=>`${e} ${1===e?t:a}`;function O(e,t,a,s,o){const n=f(e),d=[];for(const e of[...a].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))'deposit'===e?t.depositOn?t.depositPaid&&!n.depositPaid?d.push(`deposit marked paid (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&n.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${S(Number(t.depositDue??0))}`):d.push('deposit taken off'):'dogs'===e?d.push(!n.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?w(Number(t.dogs),'dog','dogs'):'no dog now'):'highChairs'===e?d.push(t.highChairs?w(Number(t.highChairs),'high chair','high chairs'):'no high chair now'):'wheelchair'===e?d.push(t.wheelchair?w(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now'):'partySize'===e?d.push(`covers ${n.partySize} to ${t.partySize}`):'time'===e?d.push(`time ${n.time} to ${t.time}`):'date'===e?d.push(`date ${n.date} to ${t.date}`):'table'===e?d.push(t.table?`table ${t.table}`:'table taken off'):'status'===e?d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`):'occasion'===e?d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off'):'area'===e?d.push(t.area?`area ${t.area}`:'any area'):'duration'===e?d.push(t.duration?`table time ${t.duration} min`:'table time as usual'):d.push(`${b[e]} changed`);const c=d.join(', ');return`${c.charAt(0).toUpperCase()}${c.slice(1)} by ${s} ${N(o)}`}const k=e=>e.map(e=>b[e]).join(', ')},1130,[1121,1115]); +__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 n}}),_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 d}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return l}}),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}}),_e.changedFields=N,_e.historyText=k,_e.editPatch=function(t,a,s,o=(new Date).toISOString()){const n=N(t,a);if(!n.length)return{};const d={};for(const c of n)switch(c){case'partySize':d.partySize=(0,e.clampParty)(Number(a.partySize));break;case'phone':case'email':case'table':d[c]=String(a[c]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[c]=String(a[c]??'').trim();break;case'area':d.area=(a.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(a.dogs??0)),d.dog=Number(a.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(a.highChairs??0))||void 0;break;case'wheelchair':d.access={...t.access??{},wheelchair:Math.max(0,Number(a.wheelchair??0))||void 0};break;case'occasion':d.occasion=a.occasion||void 0;break;case'allergies':d.allergies=[...a.allergies??[]],d.allergyNone=!!a.allergyNone&&!(a.allergies??[]).length,d.allergyNote=(a.allergyNote??'').trim()||void 0,(a.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(a.vegan??0)||void 0,vegetarian:Number(a.vegetarian??0)||void 0};break;case'deposit':if(!a.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(a.depositDue??0))),a.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(a.depositDate??'')?a.depositDate:o.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(a.depositAmount??0))),depositPaidBy:s.by.slice(0,80),depositPaidAt:e===o.slice(0,10)?o:`${e}T12:00:00.000Z`,depositMethod:a.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=a.status,'seated'!==a.status||t.seatedAt||(d.seatedAt=o),'finished'!==a.status||t.finishedAt||(d.finishedAt=o),'confirmed'!==a.status&&'pending'!==a.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=a.source||void 0;break;case'tags':d.tags=[...(t.tags??[]).filter(e=>!b.includes(e)),...a.tags??[]];break;case'duration':d.durationMins=Number(a.duration??0)>=15?Number(a.duration):void 0}n.includes('table')&&(d.tableSetHere=!0);const c=t;return d.locallyEdited=!0,d.editedFields=[...new Set([...c.editedFields??[],...n])],d.editLog=[...c.editLog??[],{at:o,by:s.by.slice(0,80),app:s.app,fields:n,text:k(t,a,n,s.by.slice(0,80),o)}].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} ${w(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,s,o,n,d=90,c){const u=[];if(!N(e,s).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return u;const l={...e,date:s.date,time:s.time,partySize:s.partySize,...Number(s.duration??0)>=15?{durationMins:Number(s.duration)}:{}};if(s.table){const e=(0,t.tableOverlaps)(l,s.table,o.filter(e=>e.date===s.date),d);if(e.length&&u.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),c){const e=s.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>c.tables.find(t=>t.name===e)).filter(Boolean),t=e.reduce((e,t)=>e+t.maxSeats,0),o=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),t,s.partySize):null;o&&u.push(o);const n=e.map(e=>c.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(s.dogs??0)>0&&n.length&&u.push(`Dogs aren\u2019t allowed in ${n[0].name}. Pick a dog-friendly table.`)}}n&&u.push(`Bookings are paused ${n.from} to ${n.to}${n.reason?` (${n.reason})`:''}.`);return u},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return M}}),_e.bookingExtras=function(e){const t=e,a=e.dogs??(e.dog?1:0),s=[];a&&s.push(O(a,'dog','dogs'));t.highChairs&&s.push(O(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&s.push(O(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&s.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&s.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&s.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&s.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&s.push(`Deposit by ${t.depositMethod}`);return s.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),a=r(_d[2]);const s='For example: birthday, high chair, dog, window seat',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.',n=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const d=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},c=['date','time','partySize','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration'],u=['card','cash','bank transfer','website','other'],l=[{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',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'},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:(a=e.depositPaidAt,a?a.slice(0,10):''),depositDue:e.depositDue??0,status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0};var a},v=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),$=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'']:[!1]);function P(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return v(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return $(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':return Number(t[e]??0);default:return String(t[e]??'').trim()}}function N(e,t){const a=y(e);return c.filter(e=>P(e,a)!==P(e,t))}const S=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},O=(e,t,a)=>`${e} ${1===e?t:a}`;function k(e,t,a,s,o){const n=y(e),d=[];for(const e of[...a].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))'deposit'===e?t.depositOn?t.depositPaid&&!n.depositPaid?d.push(`deposit marked paid (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&n.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${S(Number(t.depositDue??0))}`):d.push('deposit taken off'):'dogs'===e?d.push(!n.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?O(Number(t.dogs),'dog','dogs'):'no dog now'):'highChairs'===e?d.push(t.highChairs?O(Number(t.highChairs),'high chair','high chairs'):'no high chair now'):'wheelchair'===e?d.push(t.wheelchair?O(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now'):'partySize'===e?d.push(`covers ${n.partySize} to ${t.partySize}`):'time'===e?d.push(`time ${n.time} to ${t.time}`):'date'===e?d.push(`date ${n.date} to ${t.date}`):'table'===e?d.push(t.table?`table ${t.table}`:'table taken off'):'status'===e?d.push(`status ${l.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`):'occasion'===e?d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off'):'area'===e?d.push(t.area?`area ${t.area}`:'any area'):'duration'===e?d.push(t.duration?`table time ${t.duration} min`:'table time as usual'):d.push(`${f[e]} changed`);const c=d.join(', ');return`${c.charAt(0).toUpperCase()}${c.slice(1)} by ${s} ${w(o)}`}const M=e=>e.map(e=>f[e]).join(', ')},1130,[1121,1115,1118]); __d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WALKIN_MATCH_MINS",{enumerable:!0,get:function(){return t}}),e.bookingsNearWalkIn=function(s,o,u,d=3){const c=n(o);return s.filter(t=>t.date===c&&!t.walkIn&&('confirmed'===t.status||'pending'===t.status)&&/^\d{2}:\d{2}/.test(t.time||'')).map(t=>({b:t,d:Math.abs((new Date(`${t.date}T${t.time.slice(0,5)}:00`).getTime()-o.getTime())/6e4)})).filter(n=>n.d<=t).sort((t,n)=>(u?Number(n.b.partySize===u)-Number(t.b.partySize===u):0)||t.d-n.d).slice(0,d).map(t=>t.b)},e.walkInMatchQuestion=function(t){return`Is this ${t.name}, ${t.time.slice(0,5)}, ${t.partySize} ${1===t.partySize?'person':'people'}?`};const t=45,n=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1131,[]); __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 y}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return h}}),_e.cancelWalkInWords=x,_e.reinstateWalkInWords=p,_e.cancelWalkInNow=$,_e.reinstateWalkInNow=I,_e.CancelWalkInButton=function({rid:e,b:t,onDone:l,small:s,big:o}){const[c,u]=(0,n.useState)(!1);return y(t)?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(f.Button,{kind:"secondary",small:s,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>u(!0),style:o?{minHeight:64}:s?{minHeight:44}:w}),c?(0,k.jsx)(j,{rid:e,b:t,onClose:()=>u(!1),onDone:l}):null]}):null},_e.CancelWalkInConfirm=j,_e.ReinstateWalkInButton=function({rid:e,b:t,today:l,onDone:o,small:c}){const[u,y]=(0,n.useState)(!1);if(!h(t,l))return null;const x=p(t);if(!u)return(0,k.jsx)(f.Button,{kind:"ghost",small:c,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>y(!0),style:c?{minHeight:44}:w});return(0,k.jsxs)(f.Sheet,{visible:!0,onClose:()=>y(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,k.jsx)(s.default,{accessible:!0,accessibilityLabel:x,children:(0,k.jsx)(f.T,{size:18,colour:b.colours.text,children:x})}),(0,k.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(f.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[w,{flexGrow:1}],onPress:async()=>{await I(e,t),y(!1),o?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,k.jsx)(f.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>y(!1),style:w})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=(e=l)&&e.__esModule?e:{default:e},o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]);const w={minHeight:56},y=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),h=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function x(e){const t=(0,c.tablesOf)(e.table),n=(0,u.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 p(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 $(e,n){await o.repo.bookings.setStatus(n.id,'cancelled'),await o.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,c.tablesOf)(n.table).forEach(t=>c.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function I(e,t){await o.repo.bookings.setStatus(t.id,'seated'),(0,c.tablesOf)(t.table).forEach(t=>c.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function j({rid:e,b:t,onClose:n,onDone:l}){const o=x(t);return(0,k.jsxs)(f.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,k.jsx)(s.default,{accessible:!0,accessibilityLabel:o,children:(0,k.jsx)(f.T,{size:18,colour:b.colours.text,children:o})}),(0,k.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(f.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[w,{flexGrow:1}],onPress:async()=>{await $(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,c.tablesOf)(t.table).length?` ${(0,u.tablesWords)((0,c.tablesOf)(t.table))} free.`:''}`)}}),(0,k.jsx)(f.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:w})]})]})}},1132,[1133,34,102,874,1025,1118,821,794,25]); __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})]})]})}},1133,[34,102,874,1025,1115,1134,1118,821,1003,892,872,794,25]); __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))}},1134,[]); -__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:a,inStaffApp:n,shiftManager:l,big:o,testID:d}){const[r,u]=(0,t.useState)(!1),x=(0,p.useSession)(e=>e.meId),j=(0,b.useOwner)(e=>e.staff.find(e=>e.id===x&&e.active));return s.walkIn||!(0,h.canEditBooking)({variant:c.APP_VARIANT,inStaffApp:n,role:a,shiftManager:l})||x&&!(0,m.canChangeBookings)(j)?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.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}}),r?(0,T.jsx)(B,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:a,hidePrivate:n}){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,60);return o?(0,T.jsx)(B,{rid:e,id:o,who:i,hidePrivate:n,onClose:a}):(0,T.jsxs)(f.Sheet,{visible:!0,onClose:a,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,T.jsx)(f.T,{size:16,colour:j.colours.text,children:"Tip: tap the booking you want to change."}),r.length?r.map(e=>(0,T.jsx)(f.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${e.date===s?'Today':e.date} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${e.date===s?'today':e.date}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56,alignItems:'flex-start'}},e.id)):(0,T.jsx)(f.Muted,{children:"No bookings to edit from today on."}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:a,style:{minHeight:44}})]})},_e.EditBookingSheet=B;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),a=_r(_d[3]),n=(e=a)&&e.__esModule?e:{default:e},l=_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]),j=_r(_d[15]),y=_r(_d[16]),D=_r(_d[17]),C=_r(_d[18]),I=_r(_d[19]),f=_r(_d[20]),T=_r(_d[21]);const v=/^([01]\d|2[0-3]):[0-5]\d$/,w=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const k=e=>e?(e/100).toFixed(e%100?2:0):'',S=e=>{const t=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(t)&&t>=0?Math.round(100*t):NaN},P=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',$=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')}`:''},N=e=>e.charAt(0).toUpperCase()+e.slice(1);function E({title:e,children:t,testID:s}){return(0,T.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,T.jsx)(f.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const z=({label:e,value:t,onChange:s,max:i=20,testID:a})=>(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:e}),(0,T.jsx)(f.Stepper,{testID:a,value:t,min:0,max:i,onChange:s,label:e})]});function B({rid:e,id:a,who:p,onClose:b,hidePrivate:m='display'===c.APP_VARIANT}){const B=(0,l.useBookings)(e),A=B.find(e=>e.id===a),O=(0,r.useRestaurant)(e),R=(0,o.usePlan)(e),L=(0,d.useBlocks)(e=>e.blocks),[F,W]=(0,t.useState)(A?(0,h.draftOf)(A):null),[M,_]=(0,t.useState)(null),[H,V]=(0,t.useState)(null),[Y,G]=(0,t.useState)(k(A?(0,h.draftOf)(A).depositDue:0)),[U,X]=(0,t.useState)(k(A?(0,h.draftOf)(A).depositAmount:0)),[q,J]=(0,t.useState)(P(A?(0,h.draftOf)(A).depositDate:''));if(!A||!F||!O)return null;const K=e=>{_(null),V(null),W({...F,...e})},Q=w(F.time),Z=v.test(Q),ee=F.area?R.areas.filter(e=>e.name===F.area).map(e=>e.id):null,te=e=>!ee||e.split('+').every(e=>ee.includes(R.tables.find(t=>t.name===e)?.areaId??'')),se=(0,x.tableOptions)(R,B.filter(e=>e.date===F.date),F.table).filter(e=>te(e)||e===F.table),ie=!(F.depositOn&&(Number.isNaN(S(Y||'0'))||F.depositPaid&&(Number.isNaN(S(U||'0'))||q.trim()&&!$(q)))),ae={...F,time:Q,depositDue:S(Y||'0')||0,depositAmount:S(U||'0')||0,depositDate:$(q)},ne=(0,h.changedFields)(A,ae),le=O.settings.turnMins??90,oe=async()=>{const t=(0,h.editPatch)(A,ae,{by:p||'Team member',app:c.APP_VARIANT});if(Object.keys(t).length&&await l.repo.bookings.update(A.id,t),'seated'===A.status&&'table'in t&&t.table!==A.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(A.table),a=s(t.table),n=o.useFloor.getState(),l=i.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!a.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),a.forEach(t=>n.setLive(e,t,{stage:l,dirty:!1}))}V(`Saved. Changed: ${(0,h.editedWords)(ne)}.`),_(null),b()},de=F.allergies??[],re=e=>K({allergyNone:!1,allergies:de.some(t=>t.allergen===e)?de.filter(t=>t.allergen!==e):[...de,{allergen:e,severity:'allergy'}]}),ce=(0,h.historyLines)(A);return(0,T.jsxs)(f.Sheet,{visible:!0,onClose:b,title:`Edit booking \xb7 ${A.name} \xb7 ${A.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,T.jsx)(n.default,{style:{alignItems:'center'},children:(0,T.jsx)(C.DepositChip,{b:A,money:!0,big:!0,testID:"edit-deposit"})}),(0,h.isWixBooking)(A)?(0,T.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:h.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:h.WIX_EDIT_NOTE})}):null,(0,T.jsx)(f.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,T.jsxs)(E,{title:"Deposit",testID:"edit-section-deposit",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No deposit",selected:!F.depositOn,testID:"edit-deposit-none",onPress:()=>K({depositOn:!1,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit due",selected:!!F.depositOn&&!F.depositPaid,testID:"edit-deposit-due",onPress:()=>K({depositOn:!0,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit paid",selected:!!F.depositOn&&!!F.depositPaid,testID:"edit-deposit-paid",onPress:()=>{U||X(Y),q||J(P((0,y.ymd)(new Date))),K({depositOn:!0,depositPaid:!0})}})]}),F.depositOn?(0,T.jsx)(f.Field,{label:"Deposit due (\xa3)",value:Y,onChangeText:e=>{G(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,F.depositOn&&F.depositPaid?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Amount paid (\xa3)",value:U,onChangeText:e=>{X(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"How was it paid?"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.DEPOSIT_METHODS.map(e=>(0,T.jsx)(f.Chip,{label:N(e),selected:F.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>K({depositMethod:e})},e))}),(0,T.jsx)(f.Field,{label:"Date paid (DD/MM/YYYY)",value:q,onChangeText:e=>{J((0,s.slashDate)(e,q)),K({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),q.trim()&&!$(q)?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,ie?null:(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,T.jsx)(f.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,T.jsxs)(E,{title:"When",testID:"edit-section-when",children:[(0,T.jsx)(D.BookingDatePicker,{r:O,today:new Date,value:F.date,onChange:e=>K({date:e})}),(0,T.jsx)(f.Field,{label:"Time (24-hour, for example 19:15)",value:F.time,onChangeText:e=>K({time:e}),testID:"edit-time"}),Z?null:(0,T.jsx)(f.T,{size:15,colour:j.colours.amber,children:"Write the time like 19:15."}),(0,T.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,T.jsx)(f.T,{size:18,center:!0,children:"Covers"}),(0,T.jsx)(i.PartySizeInput,{value:F.partySize,onChange:e=>K({partySize:e}),label:"Covers",testID:"edit-covers"})]}),(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:"Table time"}),(0,T.jsx)(f.Stepper,{testID:"edit-duration",value:F.duration||0,min:0,max:360,step:15,onChange:e=>K({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,T.jsxs)(E,{title:"Where",testID:"edit-section-where",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"Any area",selected:!F.area,testID:"edit-area-any",onPress:()=>K({area:''})}),R.areas.map(e=>(0,T.jsx)(f.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:F.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>K({area:e.name})},e.id))]}),(0,T.jsx)(f.T,{size:18,weight:"semibold",center:!0,children:(0,x.tableButtonLabel)(F.table)}),(0,T.jsxs)(f.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Button,{kind:F.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(F.table?'':', chosen'),onPress:()=>K({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),se.map(e=>(0,T.jsx)(f.Button,{kind:e===F.table?'primary':'secondary',label:(0,x.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,x.tableButtonLabel)(e)}${e===F.table?', chosen':''}`,onPress:()=>K({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,T.jsxs)(E,{title:"Guest",testID:"edit-section-guest",children:[(0,T.jsx)(f.Field,{label:"Name",value:F.name,onChangeText:e=>K({name:e}),testID:"edit-name"}),m?(0,T.jsx)(f.Muted,{center:!0,children:"Phone and email can be changed in the Managers app. Use Show number on the booking to see the number."}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Phone",value:F.phone,onChangeText:e=>K({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,T.jsx)(f.Field,{label:"Email",value:F.email,onChangeText:e=>K({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Booked by"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.SOURCES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>K({source:e.id})},e.id))}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.TAGS.map(e=>{const t=(F.tags??[]).includes(e);return(0,T.jsx)(f.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>K({tags:t?(F.tags??[]).filter(t=>t!==e):[...F.tags??[],e].sort()})},e)})})]}),(0,T.jsxs)(E,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,T.jsx)(z,{label:"Dogs",value:F.dogs??0,max:6,onChange:e=>K({dogs:e}),testID:"edit-dogs"}),(0,T.jsx)(z,{label:"High chairs",value:F.highChairs??0,max:10,onChange:e=>K({highChairs:e}),testID:"edit-high-chairs"}),(0,T.jsx)(z,{label:"Wheelchair users",value:F.wheelchair??0,max:10,onChange:e=>K({wheelchair:e}),testID:"edit-wheelchair"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Occasion"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.OCCASIONS.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:(F.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>K({occasion:e.id})},e.id||'none'))})]}),(0,T.jsxs)(E,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No allergies",selected:!!F.allergyNone&&!de.length,testID:"edit-allergy-none",onPress:()=>K({allergyNone:!0,allergies:[]})}),u.ALLERGENS.map(e=>(0,T.jsx)(f.Chip,{label:e.short,selected:de.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>re(e.id)},e.id))]}),de.map(e=>(0,T.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,T.jsxs)(f.T,{size:15,center:!0,children:[u.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:u.SEVERITIES.map(t=>(0,T.jsx)(f.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>K({allergies:de.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,T.jsx)(f.Field,{label:"Anything else about allergies",value:F.allergyNote,onChangeText:e=>K({allergyNote:e}),testID:"edit-allergy-note"}),ne.includes('allergies')&&de.length?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,T.jsx)(z,{label:"Vegan",value:F.vegan??0,max:F.partySize,onChange:e=>K({vegan:e}),testID:"edit-vegan"}),(0,T.jsx)(z,{label:"Vegetarian",value:F.vegetarian??0,max:F.partySize,onChange:e=>K({vegetarian:e}),testID:"edit-vegetarian"})]}),'cancelled'!==A.status?(0,T.jsxs)(E,{title:"Status",testID:"edit-section-status",children:[(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.EDIT_STATUSES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>K({status:e.id})},e.id))}),(0,T.jsx)(f.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,T.jsx)(E,{title:"Notes",testID:"edit-section-notes",children:(0,T.jsx)(f.Field,{label:"Notes",value:F.notes,onChangeText:e=>K({notes:e}),placeholder:h.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),M?(0,T.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:[M.map(e=>(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,H?(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:H}):null,(0,T.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,T.jsx)(f.Button,{label:M?'Save anyway':'Save changes',testID:"edit-save",disabled:!Z||!ie||F.name.trim().length<1||!ne.length,onPress:()=>{const t=Z?(0,d.blockAt)(L,e,F.date,Q):void 0,s=(0,h.editWarnings)(A,ae,B,t,le,R);!s.length||M?oe():_(s)},style:{minHeight:56,flex:1}}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:b,style:{minHeight:56}})]}),ce.length?(0,T.jsx)(E,{title:"Changes",testID:"edit-history",children:ce.slice(0,12).map((e,t)=>(0,T.jsx)(f.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,T.jsx)(I.CancelBookingButton,{rid:e,b:A,name:A.name,big:!0,onDone:()=>b()}),(0,T.jsx)(I.ReinstateBookingButton,{b:A,name:A.name,today:(0,y.ymd)(new Date),onDone:()=>b()})]})}},1135,[34,1059,1120,102,874,1025,1022,876,872,1130,861,1003,892,1023,1115,821,858,1124,1112,1133,794,25]); +__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:a,inStaffApp:n,shiftManager:l,big:o,testID:r}){const[d,u]=(0,t.useState)(!1),x=(0,p.useSession)(e=>e.meId),j=(0,b.useOwner)(e=>e.staff.find(e=>e.id===x&&e.active));return s.walkIn||!(0,h.canEditBooking)({variant:c.APP_VARIANT,inStaffApp:n,role:a,shiftManager:l})||x&&!(0,m.canChangeBookings)(j)?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:r??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),d?(0,T.jsx)(B,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:a,hidePrivate:n}){const[o,r]=(0,t.useState)(null),d=(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,T.jsx)(B,{rid:e,id:o,who:i,hidePrivate:n,onClose:a}):(0,T.jsxs)(f.Sheet,{visible:!0,onClose:a,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),d.length?d.map(e=>(0,T.jsx)(f.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${k(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}, ${k(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>r(e.id),style:{minHeight:56}},e.id)):(0,T.jsx)(f.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:a,style:{minHeight:44}})]})},_e.EditBookingSheet=B;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),a=_r(_d[3]),n=(e=a)&&e.__esModule?e:{default:e},l=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),j=_r(_d[15]),y=_r(_d[16]),D=_r(_d[17]),C=_r(_d[18]),I=_r(_d[19]),f=_r(_d[20]),T=_r(_d[21]);const v=/^([01]\d|2[0-3]):[0-5]\d$/,w=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const k=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,y.ymd)(s)?'Tomorrow':$(e)};const S=e=>e?(e/100).toFixed(e%100?2:0):'',P=e=>{const t=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(t)&&t>=0?Math.round(100*t):NaN},$=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',N=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=>e.charAt(0).toUpperCase()+e.slice(1);function z({title:e,children:t,testID:s}){return(0,T.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,T.jsx)(f.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const A=({label:e,value:t,onChange:s,max:i=20,testID:a})=>(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:e}),(0,T.jsx)(f.Stepper,{testID:a,value:t,min:0,max:i,onChange:s,label:e})]});function B({rid:e,id:a,who:p,onClose:b,hidePrivate:m='display'===c.APP_VARIANT}){const k=(0,l.useBookings)(e),B=k.find(e=>e.id===a),O=(0,d.useRestaurant)(e),R=(0,o.usePlan)(e),L=(0,r.useBlocks)(e=>e.blocks),[F,W]=(0,t.useState)(B?(0,h.draftOf)(B):null),[M,_]=(0,t.useState)(null),[H,V]=(0,t.useState)(null),[Y,G]=(0,t.useState)(S(B?(0,h.draftOf)(B).depositDue:0)),[U,X]=(0,t.useState)(S(B?(0,h.draftOf)(B).depositAmount:0)),[q,J]=(0,t.useState)($(B?(0,h.draftOf)(B).depositDate:''));if(!B||!F||!O)return null;const K=e=>{_(null),V(null),W({...F,...e})},Q=w(F.time),Z=v.test(Q),ee=F.area?R.areas.filter(e=>e.name===F.area).map(e=>e.id):null,te=e=>!ee||e.split('+').every(e=>ee.includes(R.tables.find(t=>t.name===e)?.areaId??'')),se=(0,x.tableOptions)(R,k.filter(e=>e.date===F.date),F.table).filter(e=>te(e)||e===F.table),ie=!(F.depositOn&&(Number.isNaN(P(Y||'0'))||F.depositPaid&&(Number.isNaN(P(U||'0'))||q.trim()&&!N(q)))),ae={...F,time:Q,depositDue:P(Y||'0')||0,depositAmount:P(U||'0')||0,depositDate:N(q)},ne=(0,h.changedFields)(B,ae),le=O.settings.turnMins??90,oe=async()=>{const t=(0,h.editPatch)(B,ae,{by:p||'Team member',app:c.APP_VARIANT});if(Object.keys(t).length&&await l.repo.bookings.update(B.id,t),'seated'===B.status&&'table'in t&&t.table!==B.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(B.table),a=s(t.table),n=o.useFloor.getState(),l=i.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!a.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),a.forEach(t=>n.setLive(e,t,{stage:l,dirty:!1}))}V(`Saved. Changed: ${(0,h.editedWords)(ne)}.`),_(null),b()},re=F.allergies??[],de=e=>K({allergyNone:!1,allergies:re.some(t=>t.allergen===e)?re.filter(t=>t.allergen!==e):[...re,{allergen:e,severity:'allergy'}]}),ce=(0,h.historyLines)(B);return(0,T.jsxs)(f.Sheet,{visible:!0,onClose:b,title:`Edit booking \xb7 ${B.name} \xb7 ${B.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,T.jsx)(n.default,{style:{alignItems:'center'},children:(0,T.jsx)(C.DepositChip,{b:B,money:!0,big:!0,testID:"edit-deposit"})}),(0,h.isWixBooking)(B)?(0,T.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:h.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:h.WIX_EDIT_NOTE})}):null,(0,T.jsx)(f.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,T.jsxs)(z,{title:"Deposit",testID:"edit-section-deposit",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No deposit",selected:!F.depositOn,testID:"edit-deposit-none",onPress:()=>K({depositOn:!1,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit due",selected:!!F.depositOn&&!F.depositPaid,testID:"edit-deposit-due",onPress:()=>K({depositOn:!0,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit paid",selected:!!F.depositOn&&!!F.depositPaid,testID:"edit-deposit-paid",onPress:()=>{U||X(Y),q||J($((0,y.ymd)(new Date))),K({depositOn:!0,depositPaid:!0})}})]}),F.depositOn?(0,T.jsx)(f.Field,{label:"Deposit due (\xa3)",value:Y,onChangeText:e=>{G(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,F.depositOn&&F.depositPaid?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Amount paid (\xa3)",value:U,onChangeText:e=>{X(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"How was it paid?"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.DEPOSIT_METHODS.map(e=>(0,T.jsx)(f.Chip,{label:E(e),selected:F.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>K({depositMethod:e})},e))}),(0,T.jsx)(f.Field,{label:"Date paid (DD/MM/YYYY)",value:q,onChangeText:e=>{J((0,s.slashDate)(e,q)),K({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),q.trim()&&!N(q)?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,ie?null:(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,T.jsx)(f.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,T.jsxs)(z,{title:"When",testID:"edit-section-when",children:[(0,T.jsx)(D.BookingDatePicker,{r:O,today:new Date,value:F.date,onChange:e=>K({date:e})}),(0,T.jsx)(f.Field,{label:"Time (24-hour, for example 19:15)",value:F.time,onChangeText:e=>K({time:e}),testID:"edit-time"}),Z?null:(0,T.jsx)(f.T,{size:15,colour:j.colours.amber,children:"Write the time like 19:15."}),(0,T.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,T.jsx)(f.T,{size:18,center:!0,children:"Covers"}),(0,T.jsx)(i.PartySizeInput,{value:F.partySize,onChange:e=>K({partySize:e}),label:"Covers",testID:"edit-covers"})]}),(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:"Table time"}),(0,T.jsx)(f.Stepper,{testID:"edit-duration",value:F.duration||0,min:0,max:360,step:15,onChange:e=>K({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,T.jsxs)(z,{title:"Where",testID:"edit-section-where",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"Any area",selected:!F.area,testID:"edit-area-any",onPress:()=>K({area:''})}),R.areas.map(e=>(0,T.jsx)(f.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:F.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>K({area:e.name})},e.id))]}),(0,T.jsx)(f.T,{size:18,weight:"semibold",center:!0,children:(0,x.tableButtonLabel)(F.table)}),(0,T.jsxs)(f.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Button,{kind:F.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(F.table?'':', chosen'),onPress:()=>K({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),se.map(e=>(0,T.jsx)(f.Button,{kind:e===F.table?'primary':'secondary',label:(0,x.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,x.tableButtonLabel)(e)}${e===F.table?', chosen':''}`,onPress:()=>K({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,T.jsxs)(z,{title:"Guest",testID:"edit-section-guest",children:[(0,T.jsx)(f.Field,{label:"Name",value:F.name,onChangeText:e=>K({name:e}),testID:"edit-name"}),m?(0,T.jsx)(f.Muted,{center:!0,children:"Phone and email can be changed in the Managers app. Use Show number on the booking to see the number."}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Phone",value:F.phone,onChangeText:e=>K({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,T.jsx)(f.Field,{label:"Email",value:F.email,onChangeText:e=>K({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Booked by"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.SOURCES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>K({source:e.id})},e.id))}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.TAGS.map(e=>{const t=(F.tags??[]).includes(e);return(0,T.jsx)(f.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>K({tags:t?(F.tags??[]).filter(t=>t!==e):[...F.tags??[],e].sort()})},e)})})]}),(0,T.jsxs)(z,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,T.jsx)(A,{label:"Dogs",value:F.dogs??0,max:6,onChange:e=>K({dogs:e}),testID:"edit-dogs"}),(0,T.jsx)(A,{label:"High chairs",value:F.highChairs??0,max:10,onChange:e=>K({highChairs:e}),testID:"edit-high-chairs"}),(0,T.jsx)(A,{label:"Wheelchair users",value:F.wheelchair??0,max:10,onChange:e=>K({wheelchair:e}),testID:"edit-wheelchair"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Occasion"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.OCCASIONS.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:(F.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>K({occasion:e.id})},e.id||'none'))})]}),(0,T.jsxs)(z,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No allergies",selected:!!F.allergyNone&&!re.length,testID:"edit-allergy-none",onPress:()=>K({allergyNone:!0,allergies:[]})}),u.ALLERGENS.map(e=>(0,T.jsx)(f.Chip,{label:e.short,selected:re.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>de(e.id)},e.id))]}),re.map(e=>(0,T.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,T.jsxs)(f.T,{size:15,center:!0,children:[u.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:u.SEVERITIES.map(t=>(0,T.jsx)(f.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>K({allergies:re.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,T.jsx)(f.Field,{label:"Anything else about allergies",value:F.allergyNote,onChangeText:e=>K({allergyNote:e}),testID:"edit-allergy-note"}),ne.includes('allergies')&&re.length?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,T.jsx)(A,{label:"Vegan",value:F.vegan??0,max:F.partySize,onChange:e=>K({vegan:e}),testID:"edit-vegan"}),(0,T.jsx)(A,{label:"Vegetarian",value:F.vegetarian??0,max:F.partySize,onChange:e=>K({vegetarian:e}),testID:"edit-vegetarian"})]}),'cancelled'!==B.status?(0,T.jsxs)(z,{title:"Status",testID:"edit-section-status",children:[(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.EDIT_STATUSES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>K({status:e.id})},e.id))}),(0,T.jsx)(f.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,T.jsx)(z,{title:"Notes",testID:"edit-section-notes",children:(0,T.jsx)(f.Field,{label:"Notes",value:F.notes,onChangeText:e=>K({notes:e}),placeholder:h.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),M?(0,T.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:[M.map(e=>(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,H?(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:H}):null,(0,T.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,T.jsx)(f.Button,{label:M?'Save anyway':'Save changes',testID:"edit-save",disabled:!Z||!ie||F.name.trim().length<1||!ne.length,onPress:()=>{const t=Z?(0,r.blockAt)(L,e,F.date,Q):void 0,s=(0,h.editWarnings)(B,ae,k,t,le,R);!s.length||M?oe():_(s)},style:{minHeight:56,flex:1}}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:b,style:{minHeight:56}})]}),ce.length?(0,T.jsx)(z,{title:"Changes",testID:"edit-history",children:ce.slice(0,12).map((e,t)=>(0,T.jsx)(f.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,T.jsx)(I.CancelBookingButton,{rid:e,b:B,name:B.name,big:!0,onDone:()=>b()}),(0,T.jsx)(I.ReinstateBookingButton,{b:B,name:B.name,today:(0,y.ymd)(new Date),onDone:()=>b()})]})}},1135,[34,1059,1120,102,874,1025,1022,876,872,1130,861,1003,892,1023,1115,821,858,1124,1112,1133,794,25]); __d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceSlot",{enumerable:!0,get:function(){return w}}),_e.voiceAppFor=h,_e.useVoiceTarget=p,_e.VoiceSlot=function({size:e=56,layer:t=0}){const u=p(),c=(0,n.useRef)(null),l=(0,n.useRef)(y++).current,{width:f,height:h,fontScale:v}=(0,o.default)(),A=()=>{if(t{if(c.current!==e||!s||tu+.5?w.getState().owner===l&&w.setState({rect:null,owner:0}):w.setState({rect:{x:n,y:o,size:s},owner:l})})},W=(0,n.useRef)(A);return W.current=A,(0,n.useLayoutEffect)(()=>{if(u?.on)return S.set(l,{layer:t,measure:()=>W.current()}),()=>{S.delete(l),w.getState().owner===l&&w.setState({rect:null,owner:0}),requestAnimationFrame(b)}},[u?.on,t]),(0,n.useLayoutEffect)(()=>{A();const e=requestAnimationFrame(A);return()=>cancelAnimationFrame(e)},[f,h,v,u?.on]),(0,n.useEffect)(()=>{const e=c.current;if(!u?.on||'undefined'==typeof ResizeObserver||!e?.parentElement)return;const t=new ResizeObserver(A);return t.observe(e.parentElement),e.parentElement.parentElement&&t.observe(e.parentElement.parentElement),()=>t.disconnect()},[u?.on]),(0,n.useEffect)(()=>()=>{w.getState().owner===l&&w.setState({rect:null,owner:0})},[]),(0,n.useEffect)(()=>{u?.on||w.getState().owner!==l||w.setState({rect:null,owner:0})},[u?.on]),u?.on?(0,m.jsx)(s.default,{ref:c,testID:"voice-slot",onLayout:A,style:{width:e,height:e,flexShrink:0}}):null};var t=r(d[0]),n=r(d[1]),o=e(r(d[2])),s=e(r(d[3])),u=r(d[4]),c=r(d[5]),l=r(d[6]),f=r(d[7]),m=r(d[8]);const w=(0,u.create)(()=>({rect:null,owner:0}));function h(e){return'customer'===c.APP_VARIANT||/^\/(customer|table|demo)/.test(e)?null:e.startsWith('/owner')||e.startsWith('/admin')?'owner':e.startsWith('/team')?'staff':e.startsWith('/kitchen')?'chef':e.startsWith('/display')?'display':null}function p(){const e=(0,t.usePathname)()||'/',n=(0,l.useCtx)(6e4),o=(0,f.useVoiceSettings)(e=>e.enabled),s=h(e);if(!s)return null;const u='owner'===s?'owner'===n.role?'owner':'manager'===n.role?'manager':'staff':s;return{app:s,role:u,actions:'staff'===u?'staff':s,on:(0,f.voiceOn)(o,n.rid,u)}}let y=1;const S=new Map,E=()=>{let e=-1;return S.forEach(t=>{t.layer>e&&(e=t.layer)}),e};function b(){const e=E();S.forEach(t=>{t.layer===e&&t.measure()})}},1136,[30,34,426,102,846,872,1084,1137,25]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_ROLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"VOICE_ROLE_LABEL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useVoiceSettings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"voiceOn",{enumerable:!0,get:function(){return f}}),_e.micExplainedFor=function(e){try{if('1'===b()?.getItem(s(e)))return!0}catch{}return u.getState().micExplained},_e.setMicExplainedFor=function(e){try{b()?.setItem(s(e),'1')}catch{}u.getState().setMicExplained(!0)};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},c=r(d[1]),l=r(d[2]);const o=['owner','manager','staff','chef','display'],p={owner:'Owner (Managers app)',manager:'Managers (Managers app)',staff:'Staff app (full voice assistant, no money or HR)',chef:'Head Chef app',display:'Main Display'},u=(0,c.create)()((0,l.persist)(e=>({enabled:{},micExplained:!1,setEnabled:(n,t,c)=>e(e=>({enabled:{...e.enabled,[n]:{...e.enabled[n]??{},[t]:c}}})),setMicExplained:n=>e({micExplained:n})}),{name:'covercharge-voice-v1',version:4,storage:(0,l.createJSONStorage)(()=>t.default),migrate:(e,n)=>({enabled:n<2?{}:e?.enabled??{},micExplained:!!e?.micExplained}),merge:(e,n)=>({...n,enabled:e?.enabled??n.enabled,micExplained:e?.micExplained??n.micExplained}),partialize:e=>({enabled:e.enabled,micExplained:e.micExplained})})),f=(e,n,t)=>!1!==e[n]?.[t],s=e=>`cc-voice-mic-explained-${e}`,b=()=>{try{return'undefined'!=typeof window?window.localStorage:void 0}catch{return}}},1137,[839,846,849]); __d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VAT",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return n}}),e.dishCost=i,Object.defineProperty(e,"gpPct",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"priceForTarget",{enumerable:!0,get:function(){return c}}),e.costings=function(r,c,s,u){const d=(0,t.dishStats)(r);return c.map(t=>{const c=r.find(r=>r.id===t.dishId);if(!c||null==c.price)return null;const p=i(t,s),l=n(c.price),f=o(p,c.price),b=d.find(t=>t.item.id===c.id)?.sold??0;return{item:c,recipe:t,cost:p,priceInc:c.price,priceEx:l,gp:f,cashGp:l-p,below:ft.prevCost&&t.prevCost!==t.cost).map(s=>{const u=(s.cost-(s.prevCost??s.cost))/(s.prevCost??1)*100,d=r.filter(t=>t.lines.some(t=>t.ing===s.id)).map(r=>{const u=t.find(t=>t.id===r.dishId);if(!u||null==u.price)return null;const d=o(i(r,n,{ing:s.id,cost:s.prevCost}),u.price),p=o(i(r,n),u.price);return{item:u,before:d,after:p,dropped:d>=c&&pt.dropped),below:d.filter(t=>t.below)}})},e.weekGp=function(t,r,n){const i=t.reduce((t,r)=>t+r.priceEx*r.soldWeek,0),o=t.reduce((t,r)=>t+r.cost*r.soldWeek,0),c=o+r+Math.max(0,n);return{sales:i,theoCost:o,actualCost:c,theo:i?(i-o)/i*100:0,actual:i?(i-c)/i*100:0}},Object.defineProperty(e,"fmtQty",{enumerable:!0,get:function(){return s}});var t=_r(_d[0]);const r=.2,n=t=>Math.round(t/1.2);function i(t,r,n){return Math.round(t.lines.reduce((t,i)=>{const o=r.find(t=>t.id===i.ing);return t+(n&&n.ing===i.ing?n.cost:o?.cost??0)*i.qty},0))}const o=(t,r)=>{const i=n(r);return i>0?(i-t)/i*100:0},c=(t,r)=>50*Math.ceil(t/(1-r/100)*1.2/50);const s=(t,r)=>`${Number.isInteger(t)?t:t.toFixed(t<1?3:2).replace(/0+$/,'').replace(/\.$/,'')} ${'each'===r?'':r}`.trim()},1138,[1139]); @@ -1384,7 +1384,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}},1301,[827,860,34,102,794,861,867,1154,1302,874,821,25]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1302,[934,988,1154]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1303,[30,34,872,1304,1368,25]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ge}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:b,headerExtra:K,subHeader:He,noVoice:Pe=!1}={}){const Ue=(0,N.default)(),Je=b??Ue.width,Xe=Ue.height,Ze=Je<700,et=Je>=Xe,tt=!Ze&&et&&Je>=600,lt=tt,st=Math.round(Math.min(520,Math.max(Je>=1e3?448:280,.3*Je))),it=$.default.useRef(null),ot=$.default.useRef(0),[nt,at]=(0,T.useState)({w:0,h:0}),rt=(0,X.useOwner)(e=>e.site),dt=(0,Y.useRestaurant)(rt);(0,Ie.useAlertWatcher)(rt,{enabled:!e});const ct=(0,Y.useOrders)(rt),ut=(0,Y.useBookings)(rt),ht=(0,Y.useEvents)(rt),gt=(0,Y.useStore)(e=>e.skipMinutes),bt=(0,Y.useStore)(e=>e.clock.mode),yt=(0,Y.useNow)(5e3),pt=(0,X.useOwner)(e=>e.staff),ft=(0,X.useOwner)(e=>e.attendance),xt=(0,X.useOwner)(e=>e.shifts);$.default.useEffect(()=>{(0,ee.ensureAttendance)((0,q.ymd)(yt),yt)},[(0,q.ymd)(yt)]);const mt=ft.filter(e=>e.in&&!e.out&&yt.getTime()-new Date(e.in).getTime()<72e6&&yt.getTime()>=new Date(e.in).getTime()),jt=Ve(pt.find(e=>e.id===mt[0]?.staffId)?.name)||'Duty Manager',wt=k.IS_CAR?'Car':'Display';(0,v.useSoldOutLink)(!1,e?void 0:wt,!0);const kt=(0,q.ymd)(yt),It=(0,R.useTravelDay)('display',kt),Dt=(0,Z.useFrontDoor)(kt,et),vt=(0,te.useDisplaySettings)(rt),St=vt.privacy,Ct=(0,ce.useSaverSync)(),Tt=(0,te.usePlan)(rt),$t=(0,te.useFloor)(e=>e.live[rt]),Bt=(0,De.useBlocks)(e=>e.blocks),[Rt,Lt]=(0,T.useState)('plan'),[Wt,zt]=(0,T.useState)(!1),[Mt,Ht]=(0,T.useState)('all'),[Pt,Et]=(0,T.useState)(null),[Ot,At]=(0,T.useState)(null),[Nt,_t]=(0,T.useState)(null),[Gt,Vt]=(0,T.useState)(!1),[Ft,Ut]=(0,T.useState)(!1),[Kt,qt]=(0,T.useState)(null),[Yt,Qt]=(0,T.useState)(!1),[Jt,Xt]=(0,T.useState)(!1),[Zt,el]=(0,T.useState)(null),[tl,ll]=(0,T.useState)(null),[sl,il]=(0,T.useState)(null),ol=$.default.useRef(0),nl=e=>{ol.current=Date.now(),il(e)};$.default.useEffect(()=>{if(!sl)return;const e=setInterval(()=>{Date.now()-ol.current>=Te.DAY_IDLE_MS&&il(null)},5e3);return()=>clearInterval(e)},[sl]);const al=(0,Y.useWaitlist)(rt),rl=(0,Y.useStore)(e=>e.walkIns[rt]??0),[dl,cl]=(0,T.useState)(!1),[ul,hl]=(0,T.useState)(!1),[gl,bl]=(0,T.useState)(!1);(0,F.useReviewAlerts)(rt);const[yl,pl]=(0,T.useState)({view:0,content:0}),[fl,xl]=(0,T.useState)(null);$.default.useEffect(()=>{fl&&((0,S.notify)({id:`floor-note:${Date.now()}`,title:fl,timeoutMs:4500,big:!0,testID:'floor-toast'}),xl(null))},[fl]),$.default.useEffect(()=>{if(!e)return(0,L.setDisplaySilent)(!0),()=>(0,L.setDisplaySilent)(!1)},[e]);const[ml,jl]=(0,T.useState)(null),wl=$.default.useRef(0),[kl,Il]=(0,T.useState)(null);$.default.useEffect(()=>{if(!ml)return;wl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-wl.current;if(e>=Ge)return jl(null),void xl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Il(e>=105e3?Math.ceil((Ge-e)/1e3):null)},1e3);return()=>clearInterval(e)},[ml]);const Dl=e=>e.date!==kt?_t({title:`Guest details \xb7 ${(0,Te.dayWord)(e.date,kt)} ${e.time}`,body:(0,Ae.jsx)(Ae.Fragment,{children:(0,me.bookingDetails)(e)})}):_t({title:`Guest details \xb7 ${e.time}`,body:(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(Qe,{rid:rt,id:e.id,turnBase:dt.settings.turnMins}),e.walkIn?null:(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ae.jsx)(ye.CancelWalkInButton,{rid:rt,b:e,big:!0,onDone:e=>{_t(null),xl(e)}}):null,e.walkIn?(0,Ae.jsx)(ye.ReinstateWalkInButton,{rid:rt,b:e,today:kt,onDone:e=>{_t(null),xl(e)}}):null,(0,me.bookingDetails)(e)]})}),vl=ut.filter(e=>e.date===kt).sort((e,t)=>e.time.localeCompare(t.time)),Sl=vl.filter(e=>!['cancelled','noshow'].includes(e.status)),Cl=ct.filter(Fe).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Tl=(0,T.useMemo)(()=>(0,c.forecastToday)(dt,ut,ct,ht,yt),[dt,ut,ct,ht,yt.getTime()/6e4|0]),$l=(0,De.closedAreasAt)(Bt,rt,kt,(0,q.hm)(yt)),Bl=[...$l].join(','),Rl=(0,T.useMemo)(()=>(0,le.floorView)(Tt,ut,ct,$t??{},yt,dt.settings.turnMins,$l),[Tt,ut,ct,$t,yt.getTime(),Bl]),Ll=(0,xe.hoursFor)(dt,yt),Wl=Ll?.open??new Date(`${kt}T12:00:00`),zl=Ll?.close??new Date(`${kt}T21:00:00`),Ml=(0,q.addMins)(Wl,-Wl.getMinutes()),Hl=(0,q.addMins)(zl,30),Pl=e=>new Date(`${kt}T${e}:00`),El=(0,De.blocksOn)(Bt,rt,kt).map(e=>({from:Pl(e.from),to:Pl(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(dt,yt,kt)),Ol=Object.keys(Rl).filter(e=>'blocked'===Rl[e]?.status),Al=sl&&sl!==kt?sl:kt,Nl=Al!==kt,_l=(0,Te.dayWord)(Al,kt),Gl=/^(Today|Yesterday|Tomorrow)$/.test(_l),Vl=Nl?(0,Te.bookingsForDay)(ut,Al,kt).sort((e,t)=>e.time.localeCompare(t.time)):vl,Fl=(0,q.parseYmd)(Al);Fl.setHours(12);const Ul=Nl?(0,xe.hoursFor)(dt,Fl):Ll,Kl=Ul?.open??new Date(`${Al}T12:00:00`),ql=Ul?.close??new Date(`${Al}T21:00:00`),Yl=e=>new Date(`${Al}T${e}:00`),Ql=[...Nl?(0,De.blocksOn)(Bt,rt,Al).map(e=>({from:Yl(e.from),to:Yl(e.to),label:e.reason??'Paused'})):El,...Nl?(0,o.queuedServicePauses)(dt,Fl,Al):[]],Jl=(0,o.queuedServiceSessions)(dt,Fl),Xl=s.IS_QUEUED_VENUE&&(void 0===Jl||!Jl.length),Zl=(0,Ae.jsxs)(A.default,{testID:"queued-hours-gate",style:[We.look.panel,{padding:14,gap:8}],children:[(0,Ae.jsx)(G.T,{weight:"semibold",children:void 0===Jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ae.jsx)(G.Muted,{children:i.queuedVenues[rt]?.hours.note})]}),es=Nl?Ul||Vl.length?AlNl?(0,le.dayFloorView)(Tt,Vl,Al):Rl,[Nl,Tt,Vl,Al,Rl]),[ls,ss]=(0,T.useState)(null),is=Nl?Vl.filter(e=>!['cancelled','noshow'].includes(e.status)):Sl,os=is.reduce((e,t)=>e+t.partySize,0),ns=(0,u.coversSplit)(is,Al),as=(0,$e.cancelledDayTally)(ut,Al),rs=(0,Be.cancellationsFor)(ut,Al,e=>e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)','')),ds=(0,$e.cancelledTallyWords)(as,Gl?_l.toLowerCase():Nl?`on ${_l}`:'today'),cs=Bt.filter(e=>e.rid===rt&&e.date===Al&&!e.removedAt),us=(0,Ce.chartBands)(cs,60*Kl.getHours()+Kl.getMinutes(),60*ql.getHours()+ql.getMinutes()),hs=new Set((0,Ce.blockedHours)(us)),gs=yt.getHours()+(yt.getMinutes()>=30?1:0),bs=Tl.hours.filter(e=>e.hour>=gs&&!hs.has(e.hour)),ys=bs.reduce((e,t)=>e+t.coversHigh,0),ps=bs.reduce((e,t)=>e+t.coversLow,0),fs=Math.round((ps+ys)/2),xs=!Tl.example&&Tl.open&&Tl.enough&&ys>0?`Usually ${(0,c.coversRange)(fs,fs)} more`:void 0,ms=async(e,t)=>{const l=Rl[e]?.booking;if(!l||e===t)return;const s=Rl[t]?.status;if(s&&!['free','soon'].includes(s))return void xl('dirty'===s?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${le.STATUS[s].label.toLowerCase()}. Pick a free table.`);await Y.repo.bookings.update(l.id,{table:t});const i=$t?.[e]?.stage;te.useFloor.getState().setLive(rt,t,{stage:i??'seated',dirty:!1}),te.useFloor.getState().setLive(rt,e,{stage:void 0,dirty:!0}),xl(`${(0,ue.privName)(l,St)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`)},js=tl?ut.find(e=>e.id===tl.id):void 0,ws=tl&&js?(()=>{const e=js.walkIn?(0,ue.privName)(js,St):Ve(js.name),t=(0,fe.seatsOf)(Tt,tl.tables).total,l=(0,fe.seatLine)(t,js.partySize),s=(0,fe.pickClashes)(js,tl.tables,ut.filter(e=>e.date===js.date),dt.settings.turnMins),i=(0,fe.tableKey)(tl.tables)!==(0,fe.tableKey)((0,te.tablesOf)(js.table));return(0,Ae.jsxs)(A.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:Q.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:Q.colours.gold,padding:10},children:[(0,Ae.jsxs)(A.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Te.dayWord)(js.date,kt)} ${js.time}. Tap tables on the plan to add or take them off. ${(0,fe.tablesWords)(tl.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,Ae.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Te.dayWord)(js.date,kt)," ",js.time]}),(0,Ae.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[(0,fe.tablesWords)(tl.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,Ae.jsxs)(G.Row,{gap:8,wrap:!0,children:[(0,Ae.jsx)(G.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,fe.tablesWords)(tl.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(js){try{await(0,pe.saveBookingTables)(rt,js,tl.tables),xl((0,fe.savedWords)(e,js.partySize,tl.tables,t))}catch(t){xl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}ll(null)}else ll(null)}}),(0,Ae.jsx)(G.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>ll(null)})]})]})})():null,ks=Tt.areas.filter(e=>Tt.tables.some(t=>t.areaId===e.id)),Is=e=>{const t=Tt.tables.filter(t=>t.areaId===e);return Nl?`${t.filter(e=>!ts[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Rl[e.name]?.status??'free')).length}/${t.length} free`},Ds='all'===Mt||ks.some(e=>e.id===Mt)?Mt:'all',vs=e=>(0,Ae.jsx)(se.FloorCanvas,{plan:Tt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:tt,big:!0,view:ts,privacy:St,turnBase:dt.settings.turnMins,highlight:tl?tl.tables:Ot?[Ot]:void 0,onTap:e=>{return t=e.name,void(tl?ll(e=>e?{...e,tables:(0,fe.toggleTable)(e.tables,t)}:e):Nl?ss(t):Ot?(t!==Ot&&ms(Ot,t),At(null)):Et(t));var t},onDrop:(e,t)=>tl||Nl?void 0:ms(e.name,t.name)}),Ss=Ze?1:et||ks.length>2?2:1,Cs=e=>{const t=Tt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},Ts=[];for(let e=0;e{const t=(0,se.areaBounds)(Tt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,se.minReadableScale)(Tt,e.id)}}),nt.w,nt.h):null,Bs=e=>(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between',height:ie.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,children:Is(e.id)})]}),Rs=(0,Ae.jsx)(A.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-nt.w)>1||Math.abs(l-nt.h)>1)&&at({w:t,h:l})},children:$s?(0,Ae.jsx)(O.default,{style:{flex:1},scrollEnabled:$s.scroll,showsVerticalScrollIndicator:$s.scroll,contentContainerStyle:{gap:ie.GRID_GAP},children:$s.rows.map((e,t)=>(0,Ae.jsx)(A.default,{style:{height:$s.rowHeights[t],flexDirection:'row',gap:ie.GRID_GAP},children:e.map(e=>{const t=ks.find(t=>t.id===e);return(0,Ae.jsxs)(A.default,{testID:`area-cell-${e}`,style:{width:$s.cellW,gap:2},children:[Bs(t),(0,Ae.jsx)(A.default,{style:{flex:1},children:vs(e)})]},e)})},t))}):null}),Ls=(0,Ae.jsxs)(A.default,{testID:"venue-plan",style:{flex:Ze?void 0:1,gap:10,minWidth:0},children:[(0,Ae.jsx)(r.TableNumberWarning,{plan:Tt}),Tt.tables.length?null:(0,Ae.jsxs)(A.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ae.jsx)(G.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ae.jsx)(G.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS?(0,Ae.jsx)(G.Muted,{center:!0,testID:"display-venue-hours",children:(s.IS_WILDINGS?a.WILDINGS_GUIDE:s.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ae.jsx)(qe,{chipId:"all",compact:!Ze,label:"Whole venue",selected:'all'===Ds,onPress:()=>Ht('all')},"__all"),...ks.map(e=>(0,Ae.jsx)(qe,{chipId:e.id,compact:!Ze,label:`${e.name}${(0,oe.areaMarks)(e)}`,colour:(0,Q.brandColour)(e.colour),sub:Ze?$l.has(e.id)?'closed':Ds===e.id?Is(e.id):void 0:void 0,selected:Ds===e.id,onPress:()=>Ht(e.id)},e.id))];return Ze?(0,Ae.jsx)(A.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ae.jsx)(O.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;pl(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>pl(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:yl.view>0&&yl.content>0&&yl.content<=yl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:yl.view>0&&yl.content<=yl.view+1?'100%':void 0},children:e})})(),(0,Ae.jsx)(g.FloorLegend,{}),ws,Ot?(0,Ae.jsxs)(G.Row,{gap:8,style:{backgroundColor:Q.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ae.jsxs)(G.T,{weight:"semibold",colour:Q.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Ot),": tap the new table."]}),(0,Ae.jsx)(G.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>At(null)})]}):null,'all'===Ds&&tt?Rs:'all'===Ds?(0,Ae.jsx)(A.default,{style:{flex:Ze?void 0:1,gap:12,minHeight:lt?void 0:360},children:Ts.map((e,t)=>(0,Ae.jsxs)(A.default,{style:{flex:Ze?void 0:Math.max(.3,...e.map(e=>Cs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ae.jsxs)(A.default,{style:{flex:1,gap:2},children:[Ze?(0,Ae.jsxs)(A.default,{style:{alignItems:'center',gap:4},children:[(0,Ae.jsxs)(G.T,{center:!0,size:18,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{center:!0,size:14,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.Muted,{center:!0,children:Is(e.id)})]}):(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.Muted,{children:Is(e.id)})]}),(0,Ae.jsx)(A.default,{style:Ze?{height:Math.max(280,Math.round((Je-40)*Cs(e.id)))}:{flex:1},children:vs(e.id)})]},e.id)),e.length{if(Nl)return void el(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rl[t]?Et(t):Dl(e)}},Al)}),zs='timeline'===Rt,Ms=Wt?(0,Ae.jsx)(H.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>zt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ae.jsxs)(A.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:Q.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ae.jsx)(E.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>zt(!1),style:{minHeight:64,minWidth:Je<600?120:180,paddingHorizontal:Je<600?14:22,borderRadius:16,borderWidth:2,borderColor:Q.colours.goldLight,backgroundColor:Q.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(G.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ae.jsx)(A.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ae.jsx)(G.T,{size:22,weight:"semibold",colour:Q.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${Nl?(0,Te.dayLong)(Al):'Today'}`})}),Je<600?null:(0,Ae.jsx)(A.default,{style:{minWidth:180}})]}),Xl?Zl:(0,Ae.jsx)(A.default,{style:{flex:1,minHeight:0},children:(0,Ae.jsx)(re.Timeline,{hideNow:!0,fit:!0,plan:Tt,bookings:Nl?Vl:vl,now:Nl?Kl:yt,privacy:St,turnBase:dt.settings.turnMins,t0:Nl?(0,q.addMins)(Kl,-Kl.getMinutes()):Ml,t1:Nl?(0,q.addMins)(ql,30):Hl,pauses:Nl?Ql:El,blockedTables:Nl?[]:Ol,onOpen:e=>{if(zt(!1),Nl)return void el(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rl[t]?Et(t):Dl(e)}},`full-${Al}`)})]})}):null,Hs=Nl?(0,Ae.jsxs)(A.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:Q.colours.gold,backgroundColor:Q.colours.goldTint},children:[(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:Gl?`Showing ${_l} \xb7 ${(0,q.niceDate)((0,q.parseYmd)(Al))}`:`Showing ${(0,Te.dayWord)(Al,kt)}`}),(0,Ae.jsx)(A.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${ds}. Showing ${(0,Te.dayLong)(Al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ae.jsx)(G.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ll(null),nl(null)},style:{minHeight:44}})]}):null,Ps=(0,Ae.jsx)(A.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:Ze?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,l])=>{const i='timeline'===e===(zs||Wt);return(0,Ae.jsx)(E.default,{testID:l,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Lt('plan'),zt(!0)):(zt(!1),Lt('plan'))},style:{flex:Ze?1:void 0,minHeight:Ze?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?Q.colours.gold:'transparent',...We.look.web(i?{backgroundImage:s.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:s.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Ae.jsx)(G.T,{size:Ze?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Es='display'!==k.APP_VARIANT||e?Ps:(0,Ae.jsxs)(A.default,{testID:"display-view-row",style:{flexDirection:Ze?'column':'row',flexWrap:Ze?'nowrap':'wrap',gap:6,alignItems:Ze?'stretch':'center'},children:[Ps,(0,Ae.jsx)(w.DisplayRotaKitchenButtons,{phone:Ze,shifts:xt,staff:pt,today:kt})]}),Os=(0,h.useBookingWrite)(),As=e=>(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"Walk-in",onPress:Dt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint}),(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"New booking",onPress:Dt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint}),(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Ut(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint})]});(0,Oe.useDisplayNotices)(rt,!e);const Ns=Ze?180:168,[_s,Gs]=(0,T.useState)(Ns),Vs=$.default.useRef(Ns),Fs=$.default.useRef(null),Us=$.default.useRef(null),Ks=()=>{const e=Fs.current,t=Us.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Xe<820?8:12,o=44+(Xe<820?4:8),n=i>Vs.current?Math.ceil(i-Vs.current):Se.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Ns,Math.floor(t-s-l)-n-o));Math.abs(Vs.current-a)>=2&&(Vs.current=a,Gs(a))})})};$.default.useEffect(()=>{const e=setTimeout(Ks,60);return()=>clearTimeout(e)},[Je,Xe]);const qs=(0,Ae.jsxs)(A.default,{ref:Us,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ks()},style:{flexDirection:'row',flexWrap:Je>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ze?12:6,justifyContent:Ze?'center':void 0,borderTopWidth:1,borderTopColor:Q.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ae.jsx)(Ee.DisplayClockButton,{}),(0,Ae.jsx)(ae.HoldToEdit,{quiet:!0,onUnlock:()=>{Il(null),jl({at:Date.now()})},onHint:()=>xl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ae.jsx)(ve.BlockBookingsButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,display:!0,day:Al}),Tt.areas.some(e=>e.outdoor)?(0,Ae.jsx)(ve.CloseGardenButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,short:!0}):null,(0,Ae.jsx)(E.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>bl(!0),style:({pressed:e})=>({...We.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR?null:(0,Ae.jsx)(f.GiftQrButton,{rid:rt,venue:dt.name})]}),Ys=Cl.length?(0,Ae.jsxs)(A.default,{testID:"takeaway-panel",style:[We.look.panel,{overflow:'hidden'}],children:[(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ae.jsx)(G.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ae.jsxs)(G.T,{size:12,colour:Q.colours.muted,children:[Cl.length," live"]})]}),(0,Ae.jsx)(A.default,{style:{padding:10},children:(0,Ae.jsx)(Ye,{list:Cl,me:jt,compact:!0,bookings:ut})})]}):null,Qs=(Le.DueToday,Nl?Vl:vl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Js=Nl?Gl?`${_l}\u2019s guests`:`Guests ${_l}`:'Today\u2019s guests',Xs=(0,Ae.jsxs)(Ae.Fragment,{children:[0===Qs.length?(0,Ae.jsx)(G.Muted,{children:Nl?Al{const t=(0,J.isSeatedHighlight)(e.status,{otherDay:Nl}),l=(0,he.guestRowText)(e,{name:e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)',''),seated:t}),s=Q.colours.text,i=t?Q.colours.goldLight:Q.colours.muted,o=Q.colours.gold,n=l.depositWarn?Q.colours.amber:Q.colours.goldLight;return(0,Ae.jsxs)(E.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Nl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Xt(!1),el(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,J.seatedHighlightStyle)({backgroundColor:e?_e:Ne,borderColor:Q.colours.gold,borderLeftColor:Q.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:Q.colours.hairline,backgroundColor:e?Q.colours.tilePressed:'transparent'},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ae.jsx)(G.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Ae.jsx)(G.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Ae.jsx)(A.default,{style:{paddingTop:2},children:(0,Ae.jsx)(M.AllergyIcon,{text:l.allergy,size:22,colour:Q.colours.amber,ink:Q.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Ae.jsxs)(G.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ae.jsx)(G.T,{size:16,colour:s,children:l.people}),l.deposit?(0,Ae.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,Ae.jsx)(G.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Ae.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}),(0,Ae.jsx)(G.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,Ae.jsx)(G.T,{size:16,children:" "}):null,l.dog?(0,Ae.jsx)(A.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ae.jsx)(ge.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,Ae.jsx)(Re.CancellationsSection,{items:rs,dayWord:Nl?Gl?_l.toLowerCase():`on ${_l}`:'today'})]}),Zs=(0,Ae.jsx)(O.default,{testID:"display-guest-list",accessibilityLabel:Js,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Xs}),ei=P.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Xt(!1)}}),ti=(0,Ae.jsxs)(E.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Js}, ${Qs.length}`,accessibilityState:{expanded:Jt},'aria-expanded':Jt,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Xt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:Jt?Q.colours.gold:Q.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?Q.colours.tilePressed:Jt?Q.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ae.jsx)(G.T,{size:16,weight:"bold",colour:Q.colours.gold,children:Qs.length}),(0,Ae.jsx)(A.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(A.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ae.jsxs)(G.T,{size:13,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,children:[Js," ",Jt?'\u2039':'\u203a']})})})]}),li=Jt?(0,Ae.jsxs)(A.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ae.jsxs)(A.default,{testID:"guests-drawer",...ei.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Je)),backgroundColor:Q.colours.surface,borderRightWidth:1,borderColor:Q.colours.gold,borderRadius:14,...We.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ae.jsxs)(A.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Ae.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Js.toUpperCase()," (",Qs.length,")"]}),(0,Ae.jsx)(l.GoldClose,{testID:"guests-close",label:`Close ${Js}`,onPress:()=>Xt(!1),style:{marginRight:-6}})]}),as.count?(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,testID:"cancelled-day-tally-guests",children:ds}):null]}),Zs]}),(0,Ae.jsx)(E.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Js}`,accessibilityRole:"button",onPress:()=>Xt(!1),style:{flex:1}})]}):null,si=Xl?Zl:s.IS_KIRKTON&&!Object.values(dt.kitchenHours??{}).some(Boolean)?(0,Ae.jsxs)(A.default,{testID:"kirkton-hours-to-confirm",style:[We.look.panel,{padding:14,gap:8}],children:[(0,Ae.jsx)(G.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ae.jsx)(G.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ae.jsx)(Se.DayGraph,{busyThreshold:(0,t.venueBusy)(dt,ut,yt).busy,todays:Vl,open:Kl,close:ql,now:yt,turnBase:dt.settings.turnMins,blocks:cs,pauses:Ql,compact:Ze,dense:!Ze,fit:tt,tight:tt&&Xe<600,height:Ns,forecastNote:Nl?void 0:xs,emptyText:es,past:Al{Nl?Xt(!0):zt(!0)},ai=(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',padding:Xe<820?8:12,paddingTop:Xe<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[It?null:ti,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[It?null:Hs,It?(0,Ae.jsx)(O.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ae.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"})}):zs?Ws:Ls,Ms,li]}),(0,Ae.jsxs)(A.default,{testID:"display-side",style:{width:st,gap:Xe<820?4:8,minHeight:0},children:[(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:As(!1)}),(0,Ae.jsx)(A.default,{style:{flexShrink:0},children:Es}),It?null:(0,Ae.jsx)(A.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,compact:Xe<820,snug:Xe<820,tight:Xe<700,sound:(0,L.flapSoundOn)(),onPress:ni})}),It?null:(0,Ae.jsx)(A.default,{ref:Fs,testID:"day-graph-slot",onLayout:Ks,style:{flexGrow:0,flexShrink:1,flexBasis:Ns+52,minHeight:Xe<600?90:120,overflow:'visible'},children:ii}),(0,Ae.jsxs)(O.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Ae.jsx)(E.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>hl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ae.jsx)(G.T,{center:!0,weight:"semibold",children:"Reviews"})}),Ys,(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt})]})]})]});return(0,Ae.jsxs)(_.SafeAreaView,{style:{flex:1,backgroundColor:Q.colours.bg},onTouchStart:()=>{ol.current=Date.now()},onMouseDown:()=>{ol.current=Date.now()},children:[Ze?(0,Ae.jsxs)(A.default,{style:{flex:1},children:[(0,Ae.jsxs)(O.default,{ref:it,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ae.jsxs)(A.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ae.jsx)(A.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ae.jsx)(j.ExitButton,{})}),(0,Ae.jsx)(U.RestaurantLogo,{rid:rt,size:64}),(0,Ae.jsx)(G.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:dt.name}),(0,Ae.jsx)(U.PoweredBy,{}),(0,Ae.jsx)(C.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ae.jsx)(A.default,{accessible:!0,accessibilityLabel:`Current time ${(0,q.hm)(yt)}`,children:(0,Ae.jsx)(G.T,{center:!0,size:30,weight:"semibold",colour:Q.colours.goldLight,children:(0,q.hm)(yt)})}),(0,Ae.jsx)(Me.ShellfishChip,{rid:rt,by:jt,app:"display",size:"m"}),(0,Ae.jsx)(Me.SundayRoastChip,{rid:rt,by:jt,app:"display",size:"m"}),K]}),He,oi,(0,Ae.jsx)(A.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ae.jsx)(Ke,{phone:!0,split:ns,items:[{label:`Tables \xb7 ${_l}`,value:is.length,testID:'badge-tables'},{label:`Covers \xb7 ${_l}`,value:os,testID:'badge-covers'},{label:'Takeaway',value:Cl.length,alert:Cl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Vt(!0)}]})}),(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{gap:8},children:As(!0)}),(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),Es,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[zs?Ws:Ls,Ms]}),(0,Ae.jsxs)(A.default,{onLayout:e=>{ot.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[We.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ae.jsxs)(G.T,{center:!0,size:20,weight:"semibold",colour:Q.colours.goldLight,accessibilityRole:"header",children:[Js," (",Qs.length,")"]}),(0,Ae.jsx)(A.default,{testID:"display-guest-list",accessibilityLabel:Js,style:{gap:4},children:Xs})]}),Ys,ii,(0,Ae.jsx)(A.default,{testID:"covers-dock",children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,compact:!0,sound:(0,L.flapSoundOn)(),onPress:()=>it.current?.scrollTo({y:ot.current,animated:!0})})}),(0,Ae.jsxs)(A.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ae.jsx)(G.T,{center:!0,size:14,colour:St?Q.colours.muted:Q.colours.amber,children:St?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ae.jsx)(G.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Ae.jsx)(G.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>hl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),qs]}),e?null:(0,Ae.jsx)(A.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:Q.colours.hairline},children:(0,Ae.jsx)(z.VoiceSlot,{size:56})})]}):(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Je>=1e3?18:14,paddingVertical:Xe<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),...We.look.web({backgroundImage:s.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Ae.jsx)(A.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ae.jsx)(U.RestaurantBrand,{rid:dt.id,size:Je<900?32:40,beside:!0})}),(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ae.jsx)(G.T,{size:Je<900?18:21,weight:"semibold",colour:Q.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,q.hm)(yt)}),Je>=900?(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,children:(0,q.niceDate)(yt)}):null]})]}),It?(0,Ae.jsx)(A.default,{style:{width:220}}):(0,Ae.jsx)(A.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:oi}),(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ae.jsx)(Me.ShellfishChip,{rid:rt,by:jt,app:"display",size:Je<1200?'xs':Je<1280||Xe<700?'s':'m'}),(0,Ae.jsx)(E.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.muted,children:"?"})}),'simulated'===bt?(0,Ae.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>gt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(G.T,{size:11,colour:Q.colours.muted,children:"+15"})}):null,e?null:(0,Ae.jsx)(j.ExitButton,{}),K,Pe?null:(0,Ae.jsx)(z.VoiceSlot,{size:44})]})]}),He,It?null:(0,Ae.jsxs)(A.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,Ae.jsx)(Ke,{splitOnly:!0,split:ns,items:[]}),(0,Ae.jsx)(A.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Je>=1e3?18:14)+(e?0:52)+('simulated'===bt?52:0),zIndex:4},children:(0,Ae.jsx)(Me.SundayRoastChip,{rid:rt,by:jt,app:"display",size:Je<1100||Xe<700?'s':'m'})})]}),tt?ai:(ri=(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:As(!1)}),Es]}),(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),It?(0,Ae.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"}):(0,Ae.jsx)(Ae.Fragment,{children:(0,Ae.jsxs)(A.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[ti,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Hs,zs?Ws:Ls,Ms,li]})]})}),Ys,It?null:(0,Ae.jsx)(A.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,sound:(0,L.flapSoundOn)(),onPress:ni})}),It?null:(0,Ae.jsx)(A.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Ns+Se.DAY_GRAPH_CHROME},children:ii})]}),(0,Ae.jsx)(O.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:ri})),qs]}),(0,Ae.jsx)(I.SoldOutStrip,{rid:rt,by:wt,onOpen:()=>bl(!0)}),(0,Ae.jsx)(D.SoldOutSheet,{visible:gl,onClose:()=>bl(!1),rid:rt,by:wt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ae.jsx)(p.TableOrderCue,{rid:rt}),Dt.elements,Ft?(0,Ae.jsx)(y.EditBookingPicker,{rid:rt,today:kt,who:jt,hidePrivate:!0,onClose:()=>Ut(!1)}):null,Kt?(0,Ae.jsx)(y.EditBookingSheet,{rid:rt,id:Kt,who:jt,hidePrivate:!0,onClose:()=>qt(null)}):null,Pt?(0,Ae.jsx)(me.TableSheet,{rid:rt,name:Pt,view:Rl,plan:Tt,todays:vl,now:yt,privacy:St,turnBase:dt.settings.turnMins,onClose:()=>Et(null),onWalkIn:e=>Dt.openWalkInAt(e),onMove:e=>At(e),onDetails:Dl}):null,ls?(()=>{const e=ts[ls],t=e?.dayBookings??[];return(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>ss(null),title:`${(0,d.tableNumbers)(ls)} \xb7 ${Gl?_l:(0,Te.dayLong)(Al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ae.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${Gl?_l.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${Gl?_l.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ue.privName)(e,St):Ve(e.name);return(0,Ae.jsx)(G.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,fe.tablesWords)((0,te.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ss(null),el(e.id)},style:{minHeight:56}},e.id)}),(0,Ae.jsx)(G.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ss(null),style:{minHeight:56}})]})})():null,Zt?(()=>{const e=ut.find(e=>e.id===Zt);return e?(0,Ae.jsx)(be.GuestActionsSheet,{rid:rt,b:e,name:e.walkIn?(0,ue.privName)(e,St):Ve(e.name),view:Rl,now:yt,otherDay:e.date!==kt,turnBase:dt.settings.turnMins,onClose:()=>el(null),onDetails:Dl,onDone:xl,onPickOnPlan:(e,t)=>{Xt(!1),Lt('plan'),Ht('all'),ll({id:e.id,tables:t})}}):null})():null,Nt?(0,Ae.jsx)(me.DetailsPanel,{title:Nt.title,onClose:()=>_t(null),children:Nt.body}):null,Yt?(0,Ae.jsx)(me.ServiceSummary,{r:dt,todays:vl,orders:ct,waitlistAll:al,walkInCount:rl,onClose:()=>Qt(!1)}):null,dl?(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>cl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ae.jsx)(g.FloorLegend,{}),(0,Ae.jsx)(G.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>cl(!1)})]}):null,ul?(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>hl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ae.jsx)(V.ReviewsSection,{rid:rt,mode:"read",venueName:dt.name}),(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>hl(!1)})]}):null,Gt?(0,Ae.jsxs)(me.DetailsPanel,{title:"Takeaway",onClose:()=>Vt(!1),children:[(0,Ae.jsx)(G.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ae.jsx)(Ye,{list:Cl,me:jt,bookings:ut})]}):null,ml?(0,Ae.jsx)(A.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:Q.colours.bg},children:(0,Ae.jsx)(ne.PlanDesigner,{initial:Tt,venue:dt.name,mode:"display",startStep:"arrange",onActivity:()=>{wl.current=Date.now(),null!==kl&&Il(null)},notice:null!==kl?`Locking again in ${kl} s \xb7 touch to keep editing`:null,onSave:e=>{te.useFloor.getState().setPlan(rt,e),jl(null),xl('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{te.useFloor.getState().setPlan(rt,e),xl('Live seating plan updated on every screen.')},onCancel:()=>{jl(null),xl('No changes kept. Editing is locked again.')}},ml.at)}):null,e?null:(0,Ae.jsx)(de.Screensaver,{rid:rt,idleMins:vt.idleMins,pinOn:vt.pinOn,wake:vt,tonightCards:vt.tonightCards,cfg:Ct}),e?null:(0,Ae.jsx)(we.PrintHost,{rid:rt}),e?null:(0,Ae.jsx)(je.AlertHost,{variant:"display",rid:rt,skipTakeaway:!0}),e?null:(0,Ae.jsx)(W.SeatAllergenReminder,{rid:rt}),e?null:(0,Ae.jsx)(ke.TakeawayTakeover,{rid:rt,me:jt})]});var ri};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=e(T),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=_r(_d[30]),z=_r(_d[31]),M=_r(_d[32]),H=e(_r(_d[33])),P=e(_r(_d[34])),E=e(_r(_d[35])),O=e(_r(_d[36])),A=e(_r(_d[37])),N=e(_r(_d[38])),_=_r(_d[39]),G=_r(_d[40]),V=_r(_d[41]),F=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]),Pe=_r(_d[88]),Ee=_r(_d[89]),Oe=_r(_d[90]),Ae=_r(_d[91]);const Ne='#221C12',_e='#2E2618',Ge=12e4,Ve=e=>(e??'').replace(' (example)',''),Fe=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Ue=e=>e.slotTime?(0,q.hm)(new Date(e.slotTime)):'ASAP';function Ke({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,Ae.jsxs)(A.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Ae.jsx)(A.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,Ae.jsxs)(A.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,Ae.jsx)(G.T,{size:l?24:19,weight:"semibold",colour:e.alert?Q.colours.amber:Q.colours.text,children:e.value}),(0,Ae.jsx)(G.T,{size:l?14:12,colour:Q.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ae.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ae.jsx)($.default.Fragment,{children:i},e.testID)})}),s?(0,Ae.jsx)(A.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,Ae.jsx)(G.T,{size:14,colour:Q.colours.muted,children:"No Covers yet"}):(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ae.jsx)(G.T,{size:i?13:14,weight:"semibold",colour:Q.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,Ae.jsx)(G.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,Ae.jsxs)(A.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:Q.colours.gold},children:[(0,Ae.jsx)(A.default,{style:{width:`${s.walkInPct}%`,backgroundColor:Q.colours.gold}}),(0,Ae.jsx)(A.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function qe({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,Ae.jsxs)(E.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Ae.jsx)(A.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Ae.jsx)(G.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?Q.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,Ae.jsx)(G.T,{size:12,colour:Q.colours.muted,children:l}):null]})}function Ye({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,Pe.statusBlock)(e,t,(0,Pe.linkedBooking)(e,s));return e.length?(0,Ae.jsx)(A.default,{style:{gap:8},children:e.map(e=>(0,Ae.jsxs)(A.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:Q.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?Q.colours.ok:e.allergies.length?Q.colours.red:Q.colours.gold},children:[(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Ae.jsxs)(G.T,{size:l?16:18,weight:"bold",children:[Ue(e)," \xb7 ",Ve(e.customerName)]}),(0,Ae.jsx)(G.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,Ae.jsxs)(G.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,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:Q.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,K.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ae.jsx)(He.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ae.jsxs)(G.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ae.jsx)(G.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>Y.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Ae.jsx)(G.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Ae.jsx)(G.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Ae.jsx)(we.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ae.jsx)(G.Muted,{children:"No takeaway orders right now."})}function Qe({rid:e,id:t,turnBase:l}){const s=(0,Y.useBookings)(e).find(e=>e.id===t);return s?(0,Ae.jsx)(b.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1304,[1141,796,5,6,1305,828,853,1117,860,1140,1306,1307,1308,1114,1135,1309,1310,1315,1316,1317,872,1318,1153,980,1122,1319,34,1094,1172,1044,1110,1136,1320,395,380,402,295,102,426,36,794,1204,1208,873,861,858,874,821,1113,892,1119,1084,1025,1100,1127,1321,1126,1322,1329,1331,1334,1337,1333,1338,1340,1341,1132,1116,1118,878,1345,1193,1346,1203,1195,1022,1351,1359,1360,1097,1134,1362,1363,1364,1166,1365,1165,1159,869,1366,1367,25]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ge}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:b,headerExtra:K,subHeader:Me,noVoice:Pe=!1}={}){const Ue=(0,N.default)(),Je=b??Ue.width,Xe=Ue.height,Ze=Je<700,et=Je>=Xe,tt=!Ze&&et&&Je>=600,st=tt,lt=Math.round(Math.min(520,Math.max(Je>=1e3?448:280,.3*Je))),it=$.default.useRef(null),ot=$.default.useRef(0),[nt,at]=(0,T.useState)({w:0,h:0}),rt=(0,X.useOwner)(e=>e.site),dt=(0,Y.useRestaurant)(rt);(0,Ie.useAlertWatcher)(rt,{enabled:!e});const ct=(0,Y.useOrders)(rt),ut=(0,Y.useBookings)(rt),ht=(0,Y.useEvents)(rt),gt=(0,Y.useStore)(e=>e.skipMinutes),bt=(0,Y.useStore)(e=>e.clock.mode),yt=(0,Y.useNow)(5e3),pt=(0,X.useOwner)(e=>e.staff),ft=(0,X.useOwner)(e=>e.attendance),mt=(0,X.useOwner)(e=>e.shifts);$.default.useEffect(()=>{(0,ee.ensureAttendance)((0,q.ymd)(yt),yt)},[(0,q.ymd)(yt)]);const xt=ft.filter(e=>e.in&&!e.out&&yt.getTime()-new Date(e.in).getTime()<72e6&&yt.getTime()>=new Date(e.in).getTime()),jt=Fe(pt.find(e=>e.id===xt[0]?.staffId)?.name)||'Duty Manager',wt=k.IS_CAR?'Car':'Display';(0,D.useSoldOutLink)(!1,e?void 0:wt,!0);const kt=(0,q.ymd)(yt),It=(0,R.useTravelDay)('display',kt),vt=(0,Z.useFrontDoor)(kt,et),Dt=(0,te.useDisplaySettings)(rt),St=Dt.privacy,Ct=(0,ce.useSaverSync)(),Tt=(0,te.usePlan)(rt),$t=(0,te.useFloor)(e=>e.live[rt]),Bt=(0,ve.useBlocks)(e=>e.blocks),[Rt,Lt]=(0,T.useState)('plan'),[zt,Wt]=(0,T.useState)(!1),[Ht,Mt]=(0,T.useState)('all'),[Pt,Et]=(0,T.useState)(null),[At,Ot]=(0,T.useState)(null),[Nt,_t]=(0,T.useState)(null),[Gt,Ft]=(0,T.useState)(!1),[Vt,Ut]=(0,T.useState)(!1),[Kt,qt]=(0,T.useState)(null),[Yt,Qt]=(0,T.useState)(!1),[Jt,Xt]=(0,T.useState)(!1),[Zt,es]=(0,T.useState)(null),[ts,ss]=(0,T.useState)(null),[ls,is]=(0,T.useState)(null),os=$.default.useRef(0),ns=e=>{os.current=Date.now(),is(e)};$.default.useEffect(()=>{if(!ls)return;const e=setInterval(()=>{Date.now()-os.current>=Te.DAY_IDLE_MS&&is(null)},5e3);return()=>clearInterval(e)},[ls]);const as=(0,Y.useWaitlist)(rt),rs=(0,Y.useStore)(e=>e.walkIns[rt]??0),[ds,cs]=(0,T.useState)(!1),[us,hs]=(0,T.useState)(!1),[gs,bs]=(0,T.useState)(!1);(0,V.useReviewAlerts)(rt);const[ys,ps]=(0,T.useState)({view:0,content:0}),[fs,ms]=(0,T.useState)(null);$.default.useEffect(()=>{fs&&((0,S.notify)({id:`floor-note:${Date.now()}`,title:fs,timeoutMs:4500,big:!0,testID:'floor-toast'}),ms(null))},[fs]),$.default.useEffect(()=>{if(!e)return(0,L.setDisplaySilent)(!0),()=>(0,L.setDisplaySilent)(!1)},[e]);const[xs,js]=(0,T.useState)(null),ws=$.default.useRef(0),[ks,Is]=(0,T.useState)(null);$.default.useEffect(()=>{if(!xs)return;ws.current=Date.now();const e=setInterval(()=>{const e=Date.now()-ws.current;if(e>=Ge)return js(null),void ms('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Is(e>=105e3?Math.ceil((Ge-e)/1e3):null)},1e3);return()=>clearInterval(e)},[xs]);const vs=e=>e.date!==kt?_t({title:`Guest details \xb7 ${(0,Te.dayWord)(e.date,kt)} ${e.time}`,body:(0,Oe.jsxs)(Oe.Fragment,{children:[!e.walkIn&&e.date>kt?(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Te.dayWord)(e.date,kt)}, ${e.time}`,disabled:!Fl.ok,accessibilityHint:Fl.hint,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}):null,(0,xe.bookingDetails)(e)]})}):_t({title:`Guest details \xb7 ${e.time}`,body:(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsx)(Qe,{rid:rt,id:e.id,turnBase:dt.settings.turnMins}),e.walkIn?null:(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}),e.walkIn?(0,Oe.jsx)(ye.CancelWalkInButton,{rid:rt,b:e,big:!0,onDone:e=>{_t(null),ms(e)}}):null,e.walkIn?(0,Oe.jsx)(ye.ReinstateWalkInButton,{rid:rt,b:e,today:kt,onDone:e=>{_t(null),ms(e)}}):null,(0,xe.bookingDetails)(e)]})}),Ds=ut.filter(e=>e.date===kt).sort((e,t)=>e.time.localeCompare(t.time)),Ss=Ds.filter(e=>!['cancelled','noshow'].includes(e.status)),Cs=ct.filter(Ve).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ts=(0,T.useMemo)(()=>(0,c.forecastToday)(dt,ut,ct,ht,yt),[dt,ut,ct,ht,yt.getTime()/6e4|0]),$s=(0,ve.closedAreasAt)(Bt,rt,kt,(0,q.hm)(yt)),Bs=[...$s].join(','),Rs=(0,T.useMemo)(()=>(0,se.floorView)(Tt,ut,ct,$t??{},yt,dt.settings.turnMins,$s),[Tt,ut,ct,$t,yt.getTime(),Bs]),Ls=(0,me.hoursFor)(dt,yt),zs=Ls?.open??new Date(`${kt}T12:00:00`),Ws=Ls?.close??new Date(`${kt}T21:00:00`),Hs=(0,q.addMins)(zs,-zs.getMinutes()),Ms=(0,q.addMins)(Ws,30),Ps=e=>new Date(`${kt}T${e}:00`),Es=(0,ve.blocksOn)(Bt,rt,kt).map(e=>({from:Ps(e.from),to:Ps(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(dt,yt,kt)),As=Object.keys(Rs).filter(e=>'blocked'===Rs[e]?.status),Os=ls&&ls!==kt?ls:kt,Ns=Os!==kt,_s=(0,Te.dayWord)(Os,kt),Gs=/^(Today|Yesterday|Tomorrow)$/.test(_s),Fs=Ns?(0,Te.bookingsForDay)(ut,Os,kt).sort((e,t)=>e.time.localeCompare(t.time)):Ds,Vs=(0,q.parseYmd)(Os);Vs.setHours(12);const Us=Ns?(0,me.hoursFor)(dt,Vs):Ls,Ks=Us?.open??new Date(`${Os}T12:00:00`),qs=Us?.close??new Date(`${Os}T21:00:00`),Ys=e=>new Date(`${Os}T${e}:00`),Qs=[...Ns?(0,ve.blocksOn)(Bt,rt,Os).map(e=>({from:Ys(e.from),to:Ys(e.to),label:e.reason??'Paused'})):Es,...Ns?(0,o.queuedServicePauses)(dt,Vs,Os):[]],Js=(0,o.queuedServiceSessions)(dt,Vs),Xs=l.IS_QUEUED_VENUE&&(void 0===Js||!Js.length),Zs=(0,Oe.jsxs)(O.default,{testID:"queued-hours-gate",style:[ze.look.panel,{padding:14,gap:8}],children:[(0,Oe.jsx)(G.T,{weight:"semibold",children:void 0===Js?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Oe.jsx)(G.Muted,{children:i.queuedVenues[rt]?.hours.note})]}),el=Ns?Us||Fs.length?OsNs?(0,se.dayFloorView)(Tt,Fs,Os):Rs,[Ns,Tt,Fs,Os,Rs]),[sl,ll]=(0,T.useState)(null),[il,ol]=(0,T.useState)(null),[nl,al]=(0,T.useState)(null),rl=Ns?Fs.filter(e=>!['cancelled','noshow'].includes(e.status)):Ss,dl=rl.reduce((e,t)=>e+t.partySize,0),cl=(0,u.coversSplit)(rl,Os),ul=(0,$e.cancelledDayTally)(ut,Os),hl=(0,Be.cancellationsFor)(ut,Os,e=>e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)','')),gl=(0,$e.cancelledTallyWords)(ul,Gs?_s.toLowerCase():Ns?`on ${_s}`:'today'),bl=Bt.filter(e=>e.rid===rt&&e.date===Os&&!e.removedAt),yl=(0,Ce.chartBands)(bl,60*Ks.getHours()+Ks.getMinutes(),60*qs.getHours()+qs.getMinutes()),pl=new Set((0,Ce.blockedHours)(yl)),fl=yt.getHours()+(yt.getMinutes()>=30?1:0),ml=Ts.hours.filter(e=>e.hour>=fl&&!pl.has(e.hour)),xl=ml.reduce((e,t)=>e+t.coversHigh,0),jl=ml.reduce((e,t)=>e+t.coversLow,0),wl=Math.round((jl+xl)/2),kl=!Ts.example&&Ts.open&&Ts.enough&&xl>0?`Usually ${(0,c.coversRange)(wl,wl)} more`:void 0,Il=async(e,t)=>{const s=Rs[e]?.booking;if(!s||e===t)return;const l=Rs[t]?.status;if(l&&!['free','soon'].includes(l))return void ms('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${se.STATUS[l].label.toLowerCase()}. Pick a free table.`);await Y.repo.bookings.update(s.id,{table:t});const i=$t?.[e]?.stage;te.useFloor.getState().setLive(rt,t,{stage:i??'seated',dirty:!1}),te.useFloor.getState().setLive(rt,e,{stage:void 0,dirty:!0}),ms(`${(0,ue.privName)(s,St)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`)},vl=e=>{if(ts)return ol(null),void ss(t=>t?{...t,tables:(0,fe.toggleTable)(t.tables,e)}:t);Ns?ll(e):At?(e!==At&&Il(At,e),Ot(null)):Et(e)},Dl=ts?ut.find(e=>e.id===ts.id):void 0,Sl=ts&&Dl?(()=>{const e=Dl.walkIn?(0,ue.privName)(Dl,St):Fe(Dl.name),t=(0,fe.seatsOf)(Tt,ts.tables).total,s=(0,fe.seatLine)(t,Dl.partySize),l=(0,fe.pickClashes)(Dl,ts.tables,ut.filter(e=>e.date===Dl.date),dt.settings.turnMins),i=(0,fe.tableKey)(ts.tables)!==(0,fe.tableKey)((0,te.tablesOf)(Dl.table));return(0,Oe.jsxs)(O.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:Q.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:Q.colours.gold,padding:10},children:[(0,Oe.jsxs)(O.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Te.dayWord)(Dl.date,kt)} ${Dl.time}. Tap tables on the plan to add or take them off. ${(0,fe.tablesWords)(ts.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Te.dayWord)(Dl.date,kt)," ",Dl.time]}),(0,Oe.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[(0,fe.tablesWords)(ts.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),il?(0,Oe.jsx)(O.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:il,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:Q.colours.amber,backgroundColor:Q.colours.amberBg},children:(0,Oe.jsx)(G.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:il})}):null,(0,Oe.jsxs)(G.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Oe.jsx)(G.Button,{testID:il?'plan-pick-overcap-yes':'plan-pick-save',label:il?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${il?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,fe.tablesWords)(ts.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Dl)return void ss(null);const s=(0,fe.overCapacityAsk)(ts.tables,t,Dl.partySize);if(!s||il){ol(null);try{await(0,pe.saveBookingTables)(rt,Dl,ts.tables),ms((0,fe.savedWords)(e,Dl.partySize,ts.tables,t))}catch(t){ms(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}ss(null)}else ol(s)}}),(0,Oe.jsx)(G.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{ol(null),ss(null)}})]})]})})():null,Cl=Tt.areas.filter(e=>Tt.tables.some(t=>t.areaId===e.id)),Tl=e=>{const t=Tt.tables.filter(t=>t.areaId===e);return Ns?`${t.filter(e=>!tl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Rs[e.name]?.status??'free')).length}/${t.length} free`},$l='all'===Ht||Cl.some(e=>e.id===Ht)?Ht:'all',Bl=e=>(0,Oe.jsx)(le.FloorCanvas,{plan:Tt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:tt,big:!0,view:tl,privacy:St,turnBase:dt.settings.turnMins,highlight:ts?ts.tables:At?[At]:void 0,onTap:e=>vl(e.name),onDrop:(e,t)=>ts||Ns?void 0:Il(e.name,t.name)}),Rl=Ze?1:et||Cl.length>2?2:1,Ll=e=>{const t=Tt.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},zl=[];for(let e=0;e{const t=(0,le.areaBounds)(Tt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,le.minReadableScale)(Tt,e.id)}}),nt.w,nt.h):null,Hl=e=>(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between',height:ie.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,children:Tl(e.id)})]}),Ml=(0,Oe.jsx)(O.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-nt.w)>1||Math.abs(s-nt.h)>1)&&at({w:t,h:s})},children:Wl?(0,Oe.jsx)(A.default,{style:{flex:1},scrollEnabled:Wl.scroll,showsVerticalScrollIndicator:Wl.scroll,contentContainerStyle:{gap:ie.GRID_GAP},children:Wl.rows.map((e,t)=>(0,Oe.jsx)(O.default,{style:{height:Wl.rowHeights[t],flexDirection:'row',gap:ie.GRID_GAP},children:e.map(e=>{const t=Cl.find(t=>t.id===e);return(0,Oe.jsxs)(O.default,{testID:`area-cell-${e}`,style:{width:Wl.cellW,gap:2},children:[Hl(t),(0,Oe.jsx)(O.default,{style:{flex:1},children:Bl(e)})]},e)})},t))}):null}),Pl=(0,Oe.jsxs)(O.default,{testID:"venue-plan",style:{flex:Ze?void 0:1,gap:10,minWidth:0},children:[(0,Oe.jsx)(r.TableNumberWarning,{plan:Tt}),Tt.tables.length?null:(0,Oe.jsxs)(O.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Oe.jsx)(G.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Oe.jsx)(G.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,Oe.jsx)(G.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,Oe.jsx)(qe,{chipId:"all",compact:!Ze,label:"Whole venue",selected:'all'===$l,onPress:()=>Mt('all')},"__all"),...Cl.map(e=>(0,Oe.jsx)(qe,{chipId:e.id,compact:!Ze,label:`${e.name}${(0,oe.areaMarks)(e)}`,colour:(0,Q.brandColour)(e.colour),sub:Ze?$s.has(e.id)?'closed':$l===e.id?Tl(e.id):void 0:void 0,selected:$l===e.id,onPress:()=>Mt(e.id)},e.id))];return Ze?(0,Oe.jsx)(O.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Oe.jsx)(A.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;ps(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>ps(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:ys.view>0&&ys.content>0&&ys.content<=ys.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:ys.view>0&&ys.content<=ys.view+1?'100%':void 0},children:e})})(),(0,Oe.jsx)(g.FloorLegend,{}),Sl,At?(0,Oe.jsxs)(G.Row,{gap:8,style:{backgroundColor:Q.colours.goldTint,borderRadius:10,padding:8},children:[(0,Oe.jsxs)(G.T,{weight:"semibold",colour:Q.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(At),": tap the new table."]}),(0,Oe.jsx)(G.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ot(null)})]}):null,'all'===$l&&tt?Ml:'all'===$l?(0,Oe.jsx)(O.default,{style:{flex:Ze?void 0:1,gap:12,minHeight:st?void 0:360},children:zl.map((e,t)=>(0,Oe.jsxs)(O.default,{style:{flex:Ze?void 0:Math.max(.3,...e.map(e=>Ll(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Oe.jsxs)(O.default,{style:{flex:1,gap:2},children:[Ze?(0,Oe.jsxs)(O.default,{style:{alignItems:'center',gap:4},children:[(0,Oe.jsxs)(G.T,{center:!0,size:18,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{center:!0,size:14,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.Muted,{center:!0,children:Tl(e.id)})]}):(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.Muted,{children:Tl(e.id)})]}),(0,Oe.jsx)(O.default,{style:Ze?{height:Math.max(280,Math.round((Je-40)*Ll(e.id)))}:{flex:1},children:Bl(e.id)})]},e.id)),e.length{if(Ns)return void es(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rs[t]?Et(t):vs(e)}},Os)}),Al='timeline'===Rt,Ol=zt?(0,Oe.jsx)(M.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Wt(!1),supportedOrientations:['landscape','portrait'],children:(0,Oe.jsxs)(O.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:Q.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Oe.jsx)(E.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Wt(!1),style:{minHeight:64,minWidth:Je<600?120:180,paddingHorizontal:Je<600?14:22,borderRadius:16,borderWidth:2,borderColor:Q.colours.goldLight,backgroundColor:Q.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(G.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Oe.jsx)(O.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Oe.jsx)(G.T,{size:22,weight:"semibold",colour:Q.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${Ns?(0,Te.dayLong)(Os):'Today'}`})}),Je<600?null:(0,Oe.jsx)(O.default,{style:{minWidth:180}})]}),Xs?Zs:(0,Oe.jsx)(O.default,{style:{flex:1,minHeight:0},children:(0,Oe.jsx)(re.Timeline,{hideNow:!0,fit:!0,plan:Tt,bookings:Ns?Fs:Ds,now:Ns?Ks:yt,privacy:St,turnBase:dt.settings.turnMins,t0:Ns?(0,q.addMins)(Ks,-Ks.getMinutes()):Hs,t1:Ns?(0,q.addMins)(qs,30):Ms,pauses:Ns?Qs:Es,blockedTables:Ns?[]:As,onOpen:e=>{if(Wt(!1),Ns)return void es(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rs[t]?Et(t):vs(e)}},`full-${Os}`)})]})}):null,Nl=Ns?(0,Oe.jsxs)(O.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:Q.colours.gold,backgroundColor:Q.colours.goldTint},children:[(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:Gs?`Showing ${_s} \xb7 ${(0,q.niceDate)((0,q.parseYmd)(Os))}`:`Showing ${(0,Te.dayWord)(Os,kt)}`}),(0,Oe.jsx)(O.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${gl}. Showing ${(0,Te.dayLong)(Os)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Oe.jsx)(G.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ss(null),ns(null)},style:{minHeight:44}})]}):null,_l=(0,Oe.jsx)(O.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:Ze?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(Al||zt);return(0,Oe.jsx)(E.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?(Lt('plan'),Wt(!0)):(Wt(!1),Lt('plan'))},style:{flex:Ze?1:void 0,minHeight:Ze?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?Q.colours.gold:'transparent',...ze.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,Oe.jsx)(G.T,{size:Ze?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Gl='display'!==k.APP_VARIANT||e?_l:(0,Oe.jsxs)(O.default,{testID:"display-view-row",style:{flexDirection:Ze?'column':'row',flexWrap:Ze?'nowrap':'wrap',gap:6,alignItems:Ze?'stretch':'center'},children:[_l,(0,Oe.jsx)(w.DisplayRotaKitchenButtons,{phone:Ze,shifts:mt,staff:pt,today:kt})]}),Fl=(0,h.useBookingWrite)(),Vl=e=>(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsx)(We.BigAction,{premium:!0,label:"Walk-in",onPress:vt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint}),(0,Oe.jsx)(We.BigAction,{premium:!0,label:"New booking",onPress:vt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint}),(0,Oe.jsx)(We.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Ut(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint})]});(0,Ae.useDisplayNotices)(rt,!e);const Ul=Ze?180:168,[Kl,ql]=(0,T.useState)(Ul),Yl=$.default.useRef(Ul),Ql=$.default.useRef(null),Jl=$.default.useRef(null),Xl=()=>{const e=Ql.current,t=Jl.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,s,l,i)=>{t.measureInWindow((e,t)=>{const l=Xe<820?8:12,o=44+(Xe<820?4:8),n=i>Yl.current?Math.ceil(i-Yl.current):Se.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Ul,Math.floor(t-l-s)-n-o));Math.abs(Yl.current-a)>=2&&(Yl.current=a,ql(a))})})};$.default.useEffect(()=>{const e=setTimeout(Xl,60);return()=>clearTimeout(e)},[Je,Xe]);const Zl=(0,Oe.jsxs)(O.default,{ref:Jl,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xl()},style:{flexDirection:'row',flexWrap:Je>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ze?12:6,justifyContent:Ze?'center':void 0,borderTopWidth:1,borderTopColor:Q.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Oe.jsx)(Ee.DisplayClockButton,{}),(0,Oe.jsx)(ae.HoldToEdit,{quiet:!0,onUnlock:()=>{Is(null),js({at:Date.now()})},onHint:()=>ms('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Oe.jsx)(De.BlockBookingsButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,display:!0,day:Os}),Tt.areas.some(e=>e.outdoor)?(0,Oe.jsx)(De.CloseGardenButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,short:!0}):null,(0,Oe.jsx)(E.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>bs(!0),style:({pressed:e})=>({...ze.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR?null:(0,Oe.jsx)(f.GiftQrButton,{rid:rt,venue:dt.name})]}),ei=Cs.length?(0,Oe.jsxs)(O.default,{testID:"takeaway-panel",style:[ze.look.panel,{overflow:'hidden'}],children:[(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Oe.jsx)(G.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Oe.jsxs)(G.T,{size:12,colour:Q.colours.muted,children:[Cs.length," live"]})]}),(0,Oe.jsx)(O.default,{style:{padding:10},children:(0,Oe.jsx)(Ye,{list:Cs,me:jt,compact:!0,bookings:ut})})]}):null,ti=(Le.DueToday,Ns?Fs:Ds.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),si=Ns?Gs?`${_s}\u2019s guests`:`Guests ${_s}`:'Today\u2019s guests',li=(0,Oe.jsxs)(Oe.Fragment,{children:[0===ti.length?(0,Oe.jsx)(G.Muted,{children:Ns?Os{const t=(0,J.isSeatedHighlight)(e.status,{otherDay:Ns}),s=(0,he.guestRowText)(e,{name:e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)',''),seated:t}),l=Q.colours.text,i=t?Q.colours.goldLight:Q.colours.muted,o=Q.colours.gold,n=s.depositWarn?Q.colours.amber:Q.colours.goldLight;return(0,Oe.jsxs)(E.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:s.a11y,accessibilityHint:Ns?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Xt(!1),es(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,J.seatedHighlightStyle)({backgroundColor:e?_e:Ne,borderColor:Q.colours.gold,borderLeftColor:Q.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:Q.colours.hairline,backgroundColor:e?Q.colours.tilePressed:'transparent'},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Oe.jsx)(G.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:s.time}),(0,Oe.jsx)(G.T,{size:18,weight:"semibold",colour:l,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:s.name}),s.allergy?(0,Oe.jsx)(O.default,{style:{paddingTop:2},children:(0,Oe.jsx)(H.AllergyIcon,{text:s.allergy,size:22,colour:Q.colours.amber,ink:Q.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Oe.jsxs)(G.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Oe.jsx)(G.T,{size:16,colour:l,children:s.people}),s.deposit?(0,Oe.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}):null,s.deposit?(0,Oe.jsx)(G.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:s.deposit}):null,(0,Oe.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}),(0,Oe.jsx)(G.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===s.table?i:l,children:s.table}),s.dog?(0,Oe.jsx)(G.T,{size:16,children:" "}):null,s.dog?(0,Oe.jsx)(O.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Oe.jsx)(ge.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,Oe.jsx)(Re.CancellationsSection,{items:hl,dayWord:Ns?Gs?_s.toLowerCase():`on ${_s}`:'today'})]}),ii=(0,Oe.jsx)(A.default,{testID:"display-guest-list",accessibilityLabel:si,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:li}),oi=P.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Xt(!1)}}),ni=(0,Oe.jsxs)(E.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${si}, ${ti.length}`,accessibilityState:{expanded:Jt},'aria-expanded':Jt,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Xt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:Jt?Q.colours.gold:Q.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?Q.colours.tilePressed:Jt?Q.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Oe.jsx)(G.T,{size:16,weight:"bold",colour:Q.colours.gold,children:ti.length}),(0,Oe.jsx)(O.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(O.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Oe.jsxs)(G.T,{size:13,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,children:[si," ",Jt?'\u2039':'\u203a']})})})]}),ai=Jt?(0,Oe.jsxs)(O.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Oe.jsxs)(O.default,{testID:"guests-drawer",...oi.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Je)),backgroundColor:Q.colours.surface,borderRightWidth:1,borderColor:Q.colours.gold,borderRadius:14,...ze.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Oe.jsxs)(O.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[si.toUpperCase()," (",ti.length,")"]}),(0,Oe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${si}`,onPress:()=>Xt(!1),style:{marginRight:-6}})]}),ul.count?(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,testID:"cancelled-day-tally-guests",children:gl}):null]}),ii]}),(0,Oe.jsx)(E.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${si}`,accessibilityRole:"button",onPress:()=>Xt(!1),style:{flex:1}})]}):null,ri=Xs?Zs:l.IS_KIRKTON&&!Object.values(dt.kitchenHours??{}).some(Boolean)?(0,Oe.jsxs)(O.default,{testID:"kirkton-hours-to-confirm",style:[ze.look.panel,{padding:14,gap:8}],children:[(0,Oe.jsx)(G.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Oe.jsx)(G.Muted,{children:"No service hours have been set for this venue."})]}):(0,Oe.jsx)(Se.DayGraph,{busyThreshold:(0,t.venueBusy)(dt,ut,yt).busy,todays:Fs,open:Ks,close:qs,now:yt,turnBase:dt.settings.turnMins,blocks:bl,pauses:Qs,compact:Ze,dense:!Ze,fit:tt,tight:tt&&Xe<600,height:Ul,forecastNote:Ns?void 0:kl,emptyText:el,past:Os{Ns?Xt(!0):Wt(!0)},hi=(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',padding:Xe<820?8:12,paddingTop:Xe<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[It?null:ni,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[It?null:Nl,It?(0,Oe.jsx)(A.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Oe.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"})}):Al?El:Pl,Ol,ai]}),(0,Oe.jsxs)(O.default,{testID:"display-side",style:{width:lt,gap:Xe<820?4:8,minHeight:0},children:[(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Vl(!1)}),(0,Oe.jsx)(O.default,{style:{flexShrink:0},children:Gl}),It?null:(0,Oe.jsx)(O.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,compact:Xe<820,snug:Xe<820,tight:Xe<700,sound:(0,L.flapSoundOn)(),onPress:ui})}),It?null:(0,Oe.jsx)(O.default,{ref:Ql,testID:"day-graph-slot",onLayout:Xl,style:{flexGrow:0,flexShrink:1,flexBasis:Ul+52,minHeight:Xe<600?90:120,overflow:'visible'},children:di}),(0,Oe.jsxs)(A.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Oe.jsx)(E.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>hs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Oe.jsx)(G.T,{center:!0,weight:"semibold",children:"Reviews"})}),ei,(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt})]})]})]});return(0,Oe.jsxs)(_.SafeAreaView,{style:{flex:1,backgroundColor:Q.colours.bg},onTouchStart:()=>{os.current=Date.now()},onMouseDown:()=>{os.current=Date.now()},children:[Ze?(0,Oe.jsxs)(O.default,{style:{flex:1},children:[(0,Oe.jsxs)(A.default,{ref:it,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Oe.jsxs)(O.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Oe.jsx)(O.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Oe.jsx)(j.ExitButton,{})}),(0,Oe.jsx)(U.RestaurantLogo,{rid:rt,size:64}),(0,Oe.jsx)(G.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:dt.name}),(0,Oe.jsx)(U.PoweredBy,{}),(0,Oe.jsx)(C.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Oe.jsx)(O.default,{accessible:!0,accessibilityLabel:`Current time ${(0,q.hm)(yt)}`,children:(0,Oe.jsx)(G.T,{center:!0,size:30,weight:"semibold",colour:Q.colours.goldLight,children:(0,q.hm)(yt)})}),(0,Oe.jsx)(He.ShellfishChip,{rid:rt,by:jt,app:"display",size:"m"}),(0,Oe.jsx)(He.SundayRoastChip,{rid:rt,by:jt,app:"display",size:"m"}),K]}),Me,ci,(0,Oe.jsx)(O.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Oe.jsx)(Ke,{phone:!0,split:cl,items:[{label:`Tables \xb7 ${_s}`,value:rl.length,testID:'badge-tables'},{label:`Covers \xb7 ${_s}`,value:dl,testID:'badge-covers'},{label:'Takeaway',value:Cs.length,alert:Cs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Ft(!0)}]})}),(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{gap:8},children:Vl(!0)}),(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),Gl,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[Al?El:Pl,Ol]}),(0,Oe.jsxs)(O.default,{onLayout:e=>{ot.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[ze.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Oe.jsxs)(G.T,{center:!0,size:20,weight:"semibold",colour:Q.colours.goldLight,accessibilityRole:"header",children:[si," (",ti.length,")"]}),(0,Oe.jsx)(O.default,{testID:"display-guest-list",accessibilityLabel:si,style:{gap:4},children:li})]}),ei,di,(0,Oe.jsx)(O.default,{testID:"covers-dock",children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,compact:!0,sound:(0,L.flapSoundOn)(),onPress:()=>it.current?.scrollTo({y:ot.current,animated:!0})})}),(0,Oe.jsxs)(O.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Oe.jsx)(G.T,{center:!0,size:14,colour:St?Q.colours.muted:Q.colours.amber,children:St?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Oe.jsx)(G.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cs(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Oe.jsx)(G.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>hs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zl]}),e?null:(0,Oe.jsx)(O.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:Q.colours.hairline},children:(0,Oe.jsx)(W.VoiceSlot,{size:56})})]}):(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Je>=1e3?18:14,paddingVertical:Xe<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),...ze.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Oe.jsx)(O.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Oe.jsx)(U.RestaurantBrand,{rid:dt.id,size:Je<900?32:40,beside:!0})}),(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Oe.jsx)(G.T,{size:Je<900?18:21,weight:"semibold",colour:Q.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,q.hm)(yt)}),Je>=900?(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,children:(0,q.niceDate)(yt)}):null]})]}),It?(0,Oe.jsx)(O.default,{style:{width:220}}):(0,Oe.jsx)(O.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:ci}),(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Oe.jsx)(He.ShellfishChip,{rid:rt,by:jt,app:"display",size:Je<1200?'xs':Je<1280||Xe<700?'s':'m'}),(0,Oe.jsx)(E.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cs(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.muted,children:"?"})}),'simulated'===bt?(0,Oe.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>gt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(G.T,{size:11,colour:Q.colours.muted,children:"+15"})}):null,e?null:(0,Oe.jsx)(j.ExitButton,{}),K,Pe?null:(0,Oe.jsx)(W.VoiceSlot,{size:44})]})]}),Me,It?null:(0,Oe.jsxs)(O.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,Oe.jsx)(Ke,{splitOnly:!0,split:cl,items:[]}),(0,Oe.jsx)(O.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Je>=1e3?18:14)+(e?0:52)+('simulated'===bt?52:0),zIndex:4},children:(0,Oe.jsx)(He.SundayRoastChip,{rid:rt,by:jt,app:"display",size:Je<1100||Xe<700?'s':'m'})})]}),tt?hi:(gi=(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Vl(!1)}),Gl]}),(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),It?(0,Oe.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"}):(0,Oe.jsx)(Oe.Fragment,{children:(0,Oe.jsxs)(O.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[ni,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Nl,Al?El:Pl,Ol,ai]})]})}),ei,It?null:(0,Oe.jsx)(O.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,sound:(0,L.flapSoundOn)(),onPress:ui})}),It?null:(0,Oe.jsx)(O.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Ul+Se.DAY_GRAPH_CHROME},children:di})]}),(0,Oe.jsx)(A.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:gi})),Zl]}),(0,Oe.jsx)(I.SoldOutStrip,{rid:rt,by:wt,onOpen:()=>bs(!0)}),(0,Oe.jsx)(v.SoldOutSheet,{visible:gs,onClose:()=>bs(!1),rid:rt,by:wt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Oe.jsx)(p.TableOrderCue,{rid:rt}),vt.elements,Vt?(0,Oe.jsx)(y.EditBookingPicker,{rid:rt,today:kt,who:jt,hidePrivate:!0,onClose:()=>Ut(!1)}):null,Kt?(0,Oe.jsx)(y.EditBookingSheet,{rid:rt,id:Kt,who:jt,hidePrivate:!0,onClose:()=>qt(null)}):null,Pt?(0,Oe.jsx)(xe.TableSheet,{rid:rt,name:Pt,view:Rs,plan:Tt,todays:Ds,now:yt,privacy:St,turnBase:dt.settings.turnMins,onClose:()=>Et(null),onWalkIn:e=>vt.openWalkInAt(e),onMove:e=>Ot(e),onDetails:vs}):null,sl?(()=>{const e=tl[sl],t=e?.dayBookings??[];return(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>{al(null),ll(null)},title:`${(0,d.tableNumbersA11y)(sl)} \xb7 ${Gs?_s:(0,Te.dayLong)(Os)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Oe.jsxs)(G.T,{size:16,center:!0,colour:Q.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${Gs?_s.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${Gs?_s.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ue.privName)(e,St):Fe(e.name);return(0,Oe.jsx)(G.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,fe.tablesWords)((0,te.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ll(null),es(e.id)},style:{minHeight:56}},e.id)}),Os>=kt?(()=>{const t=e?.table.maxSeats??0,s=ut.filter(e=>e.date===Os&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,te.tablesOf)(e.table).includes(sl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Oe.jsxs)(O.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",center:!0,colour:Q.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(sl)]}),nl?(0,Oe.jsxs)(O.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:nl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:Q.colours.amber,backgroundColor:Q.colours.amberBg},children:[(0,Oe.jsx)(G.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:nl.ask}),(0,Oe.jsxs)(G.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Oe.jsx)(G.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!Fl.ok,accessibilityHint:Fl.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=ut.find(e=>e.id===nl.id);if(al(null),!e)return;const s=Fe(e.name);try{await(0,pe.saveBookingTables)(rt,e,[sl]),ms((0,fe.savedWords)(s,e.partySize,[sl],t))}catch(e){ms(`Couldn\u2019t save tables for ${s}: ${String(e?.message??e).slice(0,120)}`)}ll(null)}}),(0,Oe.jsx)(G.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>al(null)})]})]}):null,nl?null:s.slice(0,12).map(e=>{const s=Fe(e.name),l=e.partySize>t;return(0,Oe.jsx)(G.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:!Fl.ok,accessibilityHint:Fl.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(sl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{const l=(0,fe.overCapacityAsk)([sl],t,e.partySize);if(l)al({id:e.id,ask:l});else{try{await(0,pe.saveBookingTables)(rt,e,[sl]),ms((0,fe.savedWords)(s,e.partySize,[sl],t))}catch(e){ms(`Couldn\u2019t save tables for ${s}: ${String(e?.message??e).slice(0,120)}`)}ll(null)}},style:{minHeight:56}},e.id)})]}):null})():null,(0,Oe.jsx)(G.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{al(null),ll(null)},style:{minHeight:56}})]})})():null,Zt?(()=>{const e=ut.find(e=>e.id===Zt);return e?(0,Oe.jsx)(be.GuestActionsSheet,{rid:rt,b:e,name:e.walkIn?(0,ue.privName)(e,St):Fe(e.name),view:Rs,now:yt,otherDay:e.date!==kt,turnBase:dt.settings.turnMins,onClose:()=>es(null),onDetails:vs,onDone:ms,onEdit:e=>{es(null),qt(e.id)},onPickOnPlan:(e,t)=>{Xt(!1),Lt('plan'),Mt('all'),ss({id:e.id,tables:t})}}):null})():null,Nt?(0,Oe.jsx)(xe.DetailsPanel,{title:Nt.title,onClose:()=>_t(null),children:Nt.body}):null,Yt?(0,Oe.jsx)(xe.ServiceSummary,{r:dt,todays:Ds,orders:ct,waitlistAll:as,walkInCount:rs,onClose:()=>Qt(!1)}):null,ds?(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>cs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Oe.jsx)(g.FloorLegend,{}),(0,Oe.jsx)(G.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>cs(!1)})]}):null,us?(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>hs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Oe.jsx)(F.ReviewsSection,{rid:rt,mode:"read",venueName:dt.name}),(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>hs(!1)})]}):null,Gt?(0,Oe.jsxs)(xe.DetailsPanel,{title:"Takeaway",onClose:()=>Ft(!1),children:[(0,Oe.jsx)(G.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Oe.jsx)(Ye,{list:Cs,me:jt,bookings:ut})]}):null,xs?(0,Oe.jsx)(O.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:Q.colours.bg},children:(0,Oe.jsx)(ne.PlanDesigner,{initial:Tt,venue:dt.name,mode:"display",startStep:"arrange",onActivity:()=>{ws.current=Date.now(),null!==ks&&Is(null)},notice:null!==ks?`Locking again in ${ks} s \xb7 touch to keep editing`:null,onSave:e=>{te.useFloor.getState().setPlan(rt,e),js(null),ms('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{te.useFloor.getState().setPlan(rt,e),ms('Live seating plan updated on every screen.')},onCancel:()=>{js(null),ms('No changes kept. Editing is locked again.')}},xs.at)}):null,e?null:(0,Oe.jsx)(de.Screensaver,{rid:rt,idleMins:Dt.idleMins,pinOn:Dt.pinOn,wake:Dt,tonightCards:Dt.tonightCards,cfg:Ct}),e?null:(0,Oe.jsx)(we.PrintHost,{rid:rt}),e?null:(0,Oe.jsx)(je.AlertHost,{variant:"display",rid:rt,skipTakeaway:!0}),e?null:(0,Oe.jsx)(z.SeatAllergenReminder,{rid:rt}),e?null:(0,Oe.jsx)(ke.TakeawayTakeover,{rid:rt,me:jt})]});var gi};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),D=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=e(T),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),z=_r(_d[30]),W=_r(_d[31]),H=_r(_d[32]),M=e(_r(_d[33])),P=e(_r(_d[34])),E=e(_r(_d[35])),A=e(_r(_d[36])),O=e(_r(_d[37])),N=e(_r(_d[38])),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),me=_r(_d[69]),xe=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),ve=_r(_d[75]),De=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),ze=_r(_d[84]),We=_r(_d[85]),He=_r(_d[86]),Me=_r(_d[87]),Pe=_r(_d[88]),Ee=_r(_d[89]),Ae=_r(_d[90]),Oe=_r(_d[91]);const Ne='#221C12',_e='#2E2618',Ge=12e4,Fe=e=>(e??'').replace(' (example)',''),Ve=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Ue=e=>e.slotTime?(0,q.hm)(new Date(e.slotTime)):'ASAP';function Ke({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:o}){return(0,Oe.jsxs)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Oe.jsx)(O.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,Oe.jsxs)(O.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,Oe.jsx)(G.T,{size:s?24:19,weight:"semibold",colour:e.alert?Q.colours.amber:Q.colours.text,children:e.value}),(0,Oe.jsx)(G.T,{size:s?14:12,colour:Q.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Oe.jsx)(E.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,Oe.jsx)($.default.Fragment,{children:i},e.testID)})}),l?(0,Oe.jsx)(O.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Oe.jsx)(G.T,{size:14,colour:Q.colours.muted,children:"No Covers yet"}):(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Oe.jsx)(G.T,{size:i?13:14,weight:"semibold",colour:Q.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Oe.jsx)(G.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Oe.jsxs)(O.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:Q.colours.gold},children:[(0,Oe.jsx)(O.default,{style:{width:`${l.walkInPct}%`,backgroundColor:Q.colours.gold}}),(0,Oe.jsx)(O.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function qe({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:o,compact:n}){return(0,Oe.jsxs)(E.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Oe.jsx)(O.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Oe.jsx)(G.T,{size:n?12:14,weight:l?'semibold':'medium',colour:l?Q.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Oe.jsx)(G.T,{size:12,colour:Q.colours.muted,children:s}):null]})}function Ye({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Pe.statusBlock)(e,t,(0,Pe.linkedBooking)(e,l));return e.length?(0,Oe.jsx)(O.default,{style:{gap:8},children:e.map(e=>(0,Oe.jsxs)(O.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:Q.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?Q.colours.ok:e.allergies.length?Q.colours.red:Q.colours.gold},children:[(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Oe.jsxs)(G.T,{size:s?16:18,weight:"bold",children:[Ue(e)," \xb7 ",Fe(e.customerName)]}),(0,Oe.jsx)(G.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,Oe.jsxs)(G.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,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:Q.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,K.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Oe.jsx)(Me.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Oe.jsxs)(G.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Oe.jsx)(G.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>Y.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Oe.jsx)(G.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Oe.jsx)(G.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Oe.jsx)(we.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Oe.jsx)(G.Muted,{children:"No takeaway orders right now."})}function Qe({rid:e,id:t,turnBase:s}){const l=(0,Y.useBookings)(e).find(e=>e.id===t);return l?(0,Oe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1304,[1141,796,5,6,1305,828,853,1117,860,1140,1306,1307,1308,1114,1135,1309,1310,1315,1316,1317,872,1318,1153,980,1122,1319,34,1094,1172,1044,1110,1136,1320,395,380,402,295,102,426,36,794,1204,1208,873,861,858,874,821,1113,892,1119,1084,1025,1100,1127,1321,1126,1322,1329,1331,1334,1337,1333,1338,1340,1341,1132,1116,1118,878,1345,1193,1346,1203,1195,1022,1351,1359,1360,1097,1134,1362,1363,1364,1166,1365,1165,1159,869,1366,1367,25]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1306,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1307,[1023,1084]); @@ -1411,7 +1411,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.listSavedPlans=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))},_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const{data:c,error:u}=await(0,n.getSupabase)().from('table_plans').insert({venue_id:a,name:o.name,is_active:!1,areas:t.areas??[],tables:t.tables??[],joins:t.joins??[],sections:t.sections??[],fixtures:t.fixtures??[],updated_by:s()}).select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').single();if(u)throw u;return l(c)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return c(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:c(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}function c(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1328,[1327,1021,872,934,988]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1329,[34,236,402,102,821,794,1166,1330,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},1330,[]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return w}}),_e.Timeline=function({plan:e,bookings:T,now:C,privacy:S,onOpen:v,turnBase:I,t0:D,t1:E,height:z,pauses:L,blockedTables:R,hideNow:$,compact:_=!1,fit:O=!1}){const B=(0,o.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),W=T.filter(e=>!['cancelled','noshow'].includes(e.status)),[N,F]=(0,o.useState)(0),A=O&&!W.some(e=>!e.table)?B.filter(e=>'__none'!==e.key):B,P=O&&N>0?Math.max(w,Math.min(k,Math.floor(N/Math.max(1,A.length)))):k,H=P<44,Y=(0,o.useMemo)(()=>(0,c.clashes)(W,I),[W,I]),V=Math.max(1,Math.ceil((E.getTime()-D.getTime())/9e5)),[U,X]=(0,o.useState)(0),G=Math.max(30,U-M-2),q=Math.min(V,Math.max(1,Math.floor(G/j))),J=U>0?Math.max(j,Math.floor(G/q*100)/100):j,[K,Q]=(0,o.useState)(0),Z=Math.max(0,V-q),ee=Math.max(0,Math.min(Z,K)),te=(0,u.addMins)(D,15*ee),le=(0,u.addMins)(te,15*q),oe=e=>(e.getTime()-te.getTime())/9e5*J,[ie,ne]=(0,o.useState)(null),re=(0,o.useRef)(null);(0,o.useEffect)(()=>{const e=$?0:Math.floor((C.getTime()-D.getTime())/9e5)-Math.floor(q/3);Q(Math.max(0,Math.min(Z,e)))},[D.getTime(),q,Z,$]);const[se,ae]=(0,o.useState)(''),[de,ce]=(0,o.useState)(null),he=(0,o.useRef)(null);he.current=de,(0,o.useEffect)(()=>{if(!de)return;const e=setTimeout(()=>ce(null),s.ARM_MS);return()=>clearTimeout(e)},[de]);const ue=de?W.find(e=>e.id===de.id):void 0,be=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(he.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(he.current,e.id,Date.now()),onResponderGrant:e=>{re.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:l=>{if(!re.current||!(0,s.isArmed)(he.current,e.id,Date.now()))return;const o=l.nativeEvent.pageX-re.current.x,i=l.nativeEvent.pageY-re.current.y;(Math.abs(i)>=6||Math.abs(o)>=6)&&ne({id:e.id,row:t,dy:i})},onResponderRelease:l=>{const o=re.current;re.current=null,ne(null);const n=l.nativeEvent.pageX-(o?.x??0),r=l.nativeEvent.pageY-(o?.y??0),d=(0,s.releaseOn)(he.current,e.id,!(Math.abs(n)<6&&Math.abs(r)<6),Date.now());if(ce(d.arm),'select'===d.action){ae('');try{i.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void ae('');if('none'===d.action)return;ae('');const h=A.findIndex(e=>e.key===t),f=Math.max(0,Math.min(A.length-1,h+Math.round(r/P))),g=(0,b.dragTables)(e.table,t,A[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),ae(`${(0,p.privName)(e,S)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,u.hm)((0,c.startOf)(e))}`)):Math.abs(n)>=6&&Math.abs(r)

=600||se?(0,y.jsx)(r.default,{style:{flex:U>=600?1:void 0,flexBasis:U>=600?void 0:'100%',minWidth:0},children:(0,y.jsx)(x.T,{size:13,center:U<600,colour:g.colours.muted,numberOfLines:U>=600?1:2,testID:"timeline-hint",children:se||s.SELECT_HINT})}):null,L?.length?(0,y.jsxs)(x.Row,{gap:4,children:[(0,y.jsx)(r.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:13,children:"Blocked"})]}):null,(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.goldLight,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(r.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))})}),(0,y.jsx)(r.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})})]}):null]}):(0,y.jsxs)(y.Fragment,{children:[_?(0,y.jsxs)(r.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,y.jsx)(r.default,{style:{alignSelf:'center'},children:(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'})}),(0,y.jsx)(x.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),se?(0,y.jsx)(r.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:se})}):null]}):(0,y.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(x.Row,{gap:8,children:[(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'}),(0,y.jsx)(r.default,{style:{flex:1,minWidth:0},children:(0,y.jsx)(x.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,y.jsx)(r.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{size:13,colour:g.colours.goldLight,children:se})})]}),(0,y.jsxs)(x.T,{center:!0,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})]}):null,L?.length?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(r.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:14,children:"Blocked"})]}):null]}),(0,y.jsxs)(r.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-U)>1&&X(t)},style:{flex:z?void 0:1,height:z,flexShrink:_?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,y.jsxs)(r.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:g.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,y.jsx)(r.default,{testID:"timeline-table-head",style:{width:M,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:(0,y.jsx)(x.T,{size:13,weight:"semibold",colour:g.colours.goldLight,children:"Table"})}),(0,y.jsxs)(r.default,{style:{width:q*J,flexShrink:0},children:[Array.from({length:Math.ceil(q/4)},(e,t)=>(0,y.jsx)(r.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*J,top:26,bottom:0,width:1,backgroundColor:g.colours.border}},t)),Array.from({length:Math.ceil(q/4)},(e,t)=>{const l=4*t*J,o=Math.max(0,Math.min(q*J-56,l-28));return(0,y.jsx)(r.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:o,width:56,top:4,height:22,justifyContent:'center'},children:(0,y.jsx)(x.T,{size:15,weight:"semibold",colour:g.colours.goldLight,center:!0,numberOfLines:1,children:(0,u.hm)((0,u.addMins)(te,60*t))})},`l${t}`)})]})]}),(0,y.jsxs)(n.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-N)>1&&F(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,y.jsx)(r.default,{style:{width:M,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:A.map((e,t,l)=>(0,y.jsx)(r.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:P,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:H?(0,y.jsxs)(r.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,y.jsx)(r.default,{style:{width:q*J,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!he.current,onResponderRelease:()=>{ce(null),ae('')},children:(0,y.jsxs)(r.default,{style:{width:q*J},children:[(L??[]).map((e,t)=>{const l=Math.max(0,oe(e.from)),o=Math.min(q*J,oe(e.to));return o<=l?null:(0,y.jsx)(r.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,u.hm)(e.from)} to ${(0,u.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:o-l,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),A.map((e,o,i)=>{return(0,y.jsxs)(r.default,{testID:`tl-row-${e.key}`,style:{height:P,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:o>0&&i[o-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(q/4)},(e,l)=>(0,y.jsx)(r.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*J,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),R?.includes(e.key)?(0,y.jsx)(r.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,y.jsx)(x.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,W.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)te)).map(t=>{const o=ie?.id===t.id&&ie.row===e.key?ie:null,i=oe((0,c.startOf)(t)),n=Math.max(0,Math.min(q*J-44,i)),a=Math.min(q*J,oe((0,u.addMins)((0,c.startOf)(t),(0,c.durOf)(t,I)))),d=Math.min(q*J-n,Math.max(44,a-Math.max(0,i))),b=Y.has(t.id),j=de?.id===t.id;return(0,y.jsx)(r.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,p.privName)(t,S)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,u.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,I)} min${b?', clash':''}${(0,h.depositView)(t,!0)?`, ${(0,h.depositView)(t,!0).a11y}`:''}${j?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:j},accessibilityHint:j?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:j?'1':'0'},...be(t,e.key),style:[{position:'absolute',left:n,top:(H?2:4)+(o?o.dy:0),width:d,height:P-(H?4:8),borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:j?3:b?2.5:1,borderColor:j?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...j?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:o?40:j?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:j?'ns-resize':'pointer',touchAction:j?'none':'pan-y'},o?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,y.jsx)(x.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:H?1:2,style:{lineHeight:16},children:d<100?H&&d>=70?`${t.partySize} \xb7 ${(0,u.hm)((0,c.startOf)(t))}`:String(t.partySize):(0,y.jsxs)(y.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key||H?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,p.privName)(t,S)," \xb7 ",t.partySize,H?' \xb7 ':'\n',(0,u.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,h.depositView)(t,!0)?d>=150?` \xb7 ${(0,h.depositView)(t,!0).label}`:'Deposit paid'===(0,h.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&me>=0&&me<=q*J?(0,y.jsx)(r.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:me,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,y.jsx)(r.default,{style:{position:'absolute',top:0,left:Math.max(-me,Math.min(-18,q*J-me-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,y.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,u.hm)(C)})})}):null]})})]}),ue?(0,y.jsx)(r.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,y.jsxs)(x.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,y.jsx)(r.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,p.privName)(ue,S)} ${s.SELECTED_A11Y}`,children:(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,p.privName)(ue,S)," \xb7 ",ue.partySize]})}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{ce(null),v(ue)}}),(0,y.jsx)(x.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{ce(null),ae('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=_r(_d[2]),i=e(_r(_d[3]));_r(_d[4]);var n=e(_r(_d[5])),r=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),u=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),x=_r(_d[16]),p=_r(_d[17]),y=_r(_d[18]);const j=30,k=52,w=28,M=120},1331,[828,860,34,281,236,295,102,1128,874,1025,1100,14,858,1118,1332,821,794,1333,25]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return w}}),_e.Timeline=function({plan:e,bookings:T,now:C,privacy:S,onOpen:v,turnBase:I,t0:D,t1:z,height:E,pauses:$,blockedTables:L,hideNow:R,compact:_=!1,fit:O=!1}){const B=(0,o.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),W=T.filter(e=>!['cancelled','noshow'].includes(e.status)),[N,A]=(0,o.useState)(0),F=O&&!W.some(e=>!e.table)?B.filter(e=>'__none'!==e.key):B,P=O&&N>0?Math.max(w,Math.min(k,Math.floor(N/Math.max(1,F.length)))):k,H=P<44,Y=(0,o.useMemo)(()=>(0,c.clashes)(W,I),[W,I]),V=Math.max(1,Math.ceil((z.getTime()-D.getTime())/9e5)),[U,X]=(0,o.useState)(0),G=Math.max(30,U-M-2),q=Math.min(V,Math.max(1,Math.floor(G/j))),J=U>0?Math.max(j,Math.floor(G/q*100)/100):j,[K,Q]=(0,o.useState)(0),Z=Math.max(0,V-q),ee=Math.max(0,Math.min(Z,K)),te=(0,u.addMins)(D,15*ee),le=(0,u.addMins)(te,15*q),oe=e=>(e.getTime()-te.getTime())/9e5*J,[ie,re]=(0,o.useState)(null),ne=(0,o.useRef)(null);(0,o.useEffect)(()=>{const e=R?0:Math.floor((C.getTime()-D.getTime())/9e5)-Math.floor(q/3);Q(Math.max(0,Math.min(Z,e)))},[D.getTime(),q,Z,R]);const[se,ae]=(0,o.useState)(''),[de,ce]=(0,o.useState)(null),he=(0,o.useRef)(null);he.current=de,(0,o.useEffect)(()=>{if(!de)return;const e=setTimeout(()=>ce(null),s.ARM_MS);return()=>clearTimeout(e)},[de]);const ue=de?W.find(e=>e.id===de.id):void 0,be=(t,l)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(he.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(he.current,t.id,Date.now()),onResponderGrant:e=>{ne.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!ne.current||!(0,s.isArmed)(he.current,t.id,Date.now()))return;const o=e.nativeEvent.pageX-ne.current.x,i=e.nativeEvent.pageY-ne.current.y;(Math.abs(i)>=6||Math.abs(o)>=6)&&re({id:t.id,row:l,dy:i})},onResponderRelease:o=>{const r=ne.current;ne.current=null,re(null);const n=o.nativeEvent.pageX-(r?.x??0),d=o.nativeEvent.pageY-(r?.y??0),h=(0,s.releaseOn)(he.current,t.id,!(Math.abs(n)<6&&Math.abs(d)<6),Date.now());if(ce(h.arm),'select'===h.action){ae('');try{i.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void ae('');if('none'===h.action)return;ae('');const f=F.findIndex(e=>e.key===l),g=Math.max(0,Math.min(F.length-1,f+Math.round(d/P))),x=(0,b.dragTables)(t.table,l,F[g].key);if(x){a.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,b.overCapacityAsk)(x.split('+'),(0,b.seatsOf)(e,x.split('+')).total,t.partySize);ae(`${(0,p.privName)(t,S)} \u2192 ${(0,b.tablesWords)(x.split('+'))}, still ${(0,u.hm)((0,c.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`)}else Math.abs(n)>=6&&Math.abs(d)

=600||se?(0,y.jsx)(n.default,{style:{flex:U>=600?1:void 0,flexBasis:U>=600?void 0:'100%',minWidth:0},children:(0,y.jsx)(x.T,{size:13,center:U<600,colour:g.colours.muted,numberOfLines:U>=600?1:2,testID:"timeline-hint",children:se||s.SELECT_HINT})}):null,$?.length?(0,y.jsxs)(x.Row,{gap:4,children:[(0,y.jsx)(n.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:13,children:"Blocked"})]}):null,(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.goldLight,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(n.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))})}),(0,y.jsx)(n.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})})]}):null]}):(0,y.jsxs)(y.Fragment,{children:[_?(0,y.jsxs)(n.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,y.jsx)(n.default,{style:{alignSelf:'center'},children:(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'})}),(0,y.jsx)(x.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),se?(0,y.jsx)(n.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:se})}):null]}):(0,y.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(x.Row,{gap:8,children:[(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'}),(0,y.jsx)(n.default,{style:{flex:1,minWidth:0},children:(0,y.jsx)(x.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,y.jsx)(n.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{size:13,colour:g.colours.goldLight,children:se})})]}),(0,y.jsxs)(x.T,{center:!0,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})]}):null,$?.length?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(n.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:14,children:"Blocked"})]}):null]}),(0,y.jsxs)(n.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-U)>1&&X(t)},style:{flex:E?void 0:1,height:E,flexShrink:_?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,y.jsxs)(n.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:g.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,y.jsx)(n.default,{testID:"timeline-table-head",style:{width:M,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:(0,y.jsx)(x.T,{size:13,weight:"semibold",colour:g.colours.goldLight,children:"Table"})}),(0,y.jsxs)(n.default,{style:{width:q*J,flexShrink:0},children:[Array.from({length:Math.ceil(q/4)},(e,t)=>(0,y.jsx)(n.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*J,top:26,bottom:0,width:1,backgroundColor:g.colours.border}},t)),Array.from({length:Math.ceil(q/4)},(e,t)=>{const l=4*t*J,o=Math.max(0,Math.min(q*J-56,l-28));return(0,y.jsx)(n.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:o,width:56,top:4,height:22,justifyContent:'center'},children:(0,y.jsx)(x.T,{size:15,weight:"semibold",colour:g.colours.goldLight,center:!0,numberOfLines:1,children:(0,u.hm)((0,u.addMins)(te,60*t))})},`l${t}`)})]})]}),(0,y.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-N)>1&&A(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,y.jsx)(n.default,{style:{width:M,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:F.map((e,t,l)=>(0,y.jsx)(n.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:P,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:H?(0,y.jsxs)(n.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,y.jsx)(n.default,{style:{width:q*J,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!he.current,onResponderRelease:()=>{ce(null),ae('')},children:(0,y.jsxs)(n.default,{style:{width:q*J},children:[($??[]).map((e,t)=>{const l=Math.max(0,oe(e.from)),o=Math.min(q*J,oe(e.to));return o<=l?null:(0,y.jsx)(n.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,u.hm)(e.from)} to ${(0,u.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:o-l,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),F.map((e,o,i)=>{return(0,y.jsxs)(n.default,{testID:`tl-row-${e.key}`,style:{height:P,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:o>0&&i[o-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(q/4)},(e,l)=>(0,y.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*J,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),L?.includes(e.key)?(0,y.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,y.jsx)(x.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(r=e.key,W.filter(e=>('__none'===r?!e.table:(0,d.tablesOf)(e.table).includes(r))&&(0,c.startOf)(e)te)).map(t=>{const o=ie?.id===t.id&&ie.row===e.key?ie:null,i=oe((0,c.startOf)(t)),r=Math.max(0,Math.min(q*J-44,i)),a=Math.min(q*J,oe((0,u.addMins)((0,c.startOf)(t),(0,c.durOf)(t,I)))),d=Math.min(q*J-r,Math.max(44,a-Math.max(0,i))),b=Y.has(t.id),j=de?.id===t.id;return(0,y.jsx)(n.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,p.privName)(t,S)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,u.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,I)} min${b?', clash':''}${(0,h.depositView)(t,!0)?`, ${(0,h.depositView)(t,!0).a11y}`:''}${j?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:j},accessibilityHint:j?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:j?'1':'0'},...be(t,e.key),style:[{position:'absolute',left:r,top:(H?2:4)+(o?o.dy:0),width:d,height:P-(H?4:8),borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:j?3:b?2.5:1,borderColor:j?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...j?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:o?40:j?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:j?'ns-resize':'pointer',touchAction:j?'none':'pan-y'},o?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,y.jsx)(x.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:H?1:2,style:{lineHeight:16},children:d<100?H&&d>=70?`${t.partySize} \xb7 ${(0,u.hm)((0,c.startOf)(t))}`:String(t.partySize):(0,y.jsxs)(y.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key||H?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,p.privName)(t,S)," \xb7 ",t.partySize,H?' \xb7 ':'\n',(0,u.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,h.depositView)(t,!0)?d>=150?` \xb7 ${(0,h.depositView)(t,!0).label}`:'Deposit paid'===(0,h.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var r}),!R&&me>=0&&me<=q*J?(0,y.jsx)(n.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:me,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,y.jsx)(n.default,{style:{position:'absolute',top:0,left:Math.max(-me,Math.min(-18,q*J-me-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,y.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,u.hm)(C)})})}):null]})})]}),ue?(0,y.jsx)(n.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,y.jsxs)(x.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,y.jsx)(n.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,p.privName)(ue,S)} ${s.SELECTED_A11Y}`,children:(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,p.privName)(ue,S)," \xb7 ",ue.partySize]})}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{ce(null),v(ue)}}),(0,y.jsx)(x.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{ce(null),ae('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=_r(_d[2]),i=e(_r(_d[3]));_r(_d[4]);var r=e(_r(_d[5])),n=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),u=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),x=_r(_d[16]),p=_r(_d[17]),y=_r(_d[18]);const j=30,k=52,w=28,M=120},1331,[828,860,34,281,236,295,102,1128,874,1025,1100,14,858,1118,1332,821,794,1333,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1332,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1333,[]); __d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1334,[5,828,34,283,336,236,402,102,426,821,873,794,1026,1000,1315,1335,2,1336,1337,874,858,25]); @@ -1421,10 +1421,10 @@ __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.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1338,[860,14,1025,1339]); __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])},1339,[861]); __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])},1340,[34,102,797,821,25]); -__d(function(_g,r,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:S,name:D,view:P,now:I,onClose:L,onDetails:v,onDone:N,otherDay:T,turnBase:W=90,onPickOnPlan:H}){const[_,z]=(0,l.useState)(!1),M=(0,j.useBookingWrite)(),[A,G]=(0,l.useState)(!1),[O,F]=(0,l.useState)(!1),[R,q]=(0,l.useState)(!1),E=(0,k.guestRowText)(S,{name:D,seated:'seated'===S.status&&!T}),J='seated'===S.status&&!T,K=S.table?J?`Seated \xb7 ${(0,a.tableCardLabel)(S.table)}`:(0,a.tableCardLabel)(S.table):J?'Seated':'No table yet',Q=T?[]:(0,y.guestActions)(S,D,P,I).filter(e=>'details'!==e.id),U=(0,g.tableActions)(S,D),V={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},X=async t=>{const s={...S,table:t};t!==S.table&&await u.repo.bookings.update(S.id,{table:t}),await(0,b.seatBookingNow)(e,s),N(`${D} seated at ${(0,y.tableWords)(t)}.`),L()},Y=async t=>'seat'===t.id&&t.table?X(t.table):'pick'===t.id?z(e=>!e):'details'===t.id?(L(),v(S)):'finished'===t.id?('seated'===S.status?await(0,b.finishBookingNow)(e,S):await u.repo.bookings.setStatus(S.id,'finished'),N('seated'===S.status&&S.table?`${D} finished. ${(0,y.tableWords)(S.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),L()):'noshow'===t.id?(await u.repo.bookings.setStatus(S.id,'noshow'),N(`${D} marked as a no-show.`),L()):void 0,Z=_?(0,y.freeTablesNow)(P,S.partySize).slice(0,8):[];if(A)return(0,w.jsx)(h.TablePicker,{rid:e,booking:S,name:D,turnBase:W,onClose:L,onSaved:N,onPickOnPlan:H?e=>{L(),H(S,e)}:void 0});if(O)return(0,w.jsx)(f.CancelWalkInConfirm,{rid:e,b:S,onClose:L,onDone:N});if(R)return(0,w.jsx)(p.CancelBookingConfirm,{rid:e,b:S,name:D,onClose:L,onDone:N});const ee=[...Q];return(0,w.jsxs)(c.Sheet,{visible:!0,onClose:L,title:`${S.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,w.jsx)(o.default,{accessible:!0,accessibilityLabel:E.a11y,testID:"guest-actions-summary",children:(0,w.jsxs)(c.T,{size:18,children:[E.people,E.deposit?(0,w.jsxs)(c.T,{size:18,weight:"semibold",colour:E.depositWarn?x.colours.amber:x.colours.goldLight,children:[" \xb7 ",E.deposit]}):null," \xb7 ",K]})}),(0,w.jsx)(t.ShowNumberButton,{b:S}),(0,w.jsxs)(o.default,{style:{gap:10},children:[ee.map(e=>(0,w.jsxs)(n.default.Fragment,{children:[(0,w.jsx)(c.Button,{kind:B(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:M.hint,disabled:'details'!==e.id&&!M.ok,testID:`guest-act-${e.id}`,onPress:()=>Y(e),style:C}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,w.jsxs)(c.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&_?(0,w.jsxs)(o.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Z.length?(0,w.jsx)(c.Muted,{children:"No free tables right now."}):null,Z.map(e=>(0,w.jsx)(c.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:M.hint,disabled:!M.ok,testID:`guest-pick-${e.table}`,onPress:()=>X(e.table),style:C},e.table))]}):null]},e.id)),U.map(t=>(0,w.jsx)(c.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:M.hint,disabled:!M.ok,testID:`guest-act-${t.id}`,style:C,onPress:async()=>{if(M.ok){if('assign'===t.id)return G(!0);await(0,h.saveBookingTables)(e,S,[]),N(`${D}: table taken off.`),L()}}},t.id)),!T&&(0,f.canCancelWalkIn)(S)?(0,w.jsx)(c.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${S.ref}, ${S.partySize} Covers`,accessibilityHint:M.hint,disabled:!M.ok,testID:"guest-act-cancelwalkin",onPress:()=>F(!0),style:C}):null,(0,$.canCancelBooking)(S)?(0,w.jsx)(c.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${S.time}, ${S.partySize} Covers`,accessibilityHint:M.hint,disabled:!M.ok,testID:"guest-act-cancelbooking",onPress:()=>q(!0),style:C}):null,(0,w.jsx)(c.Button,{kind:"ghost",label:V.label,accessibilityLabel:V.a11y,testID:"guest-act-details",onPress:()=>Y(V),style:C})]}),(0,w.jsx)(c.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:L,style:C})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=e(l),o=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),j=r(d[16]),w=r(d[17]);const C={minHeight:64},B=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1341,[1342,860,1025,34,102,794,1119,874,1344,1338,1118,1116,1132,1133,1134,821,1307,25]); +__d(function(_g,r,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:D,name:v,view:I,now:P,onClose:L,onDetails:z,onDone:H,otherDay:N,turnBase:T=90,onPickOnPlan:W,onEdit:_}){const[A,E]=(0,l.useState)(null),[F,M]=(0,l.useState)(!1),R=(0,w.useBookingWrite)(),[G,O]=(0,l.useState)(!1),[U,q]=(0,l.useState)(!1),[J,K]=(0,l.useState)(!1),Q=(0,k.guestRowText)(D,{name:v,seated:'seated'===D.status&&!N}),V='seated'===D.status&&!N,X=D.table?V?`Seated \xb7 ${(0,a.tableCardLabel)(D.table)}`:(0,a.tableCardLabel)(D.table):V?'Seated':'No table yet',Y=N?[]:(0,y.guestActions)(D,v,I,P).filter(e=>'details'!==e.id),Z=(0,g.tableActions)(D,v),ee={id:'details',label:'Guest details',a11y:`Guest details, ${v}`},te=async t=>{const s={...D,table:t};t!==D.table&&await u.repo.bookings.update(D.id,{table:t}),await(0,b.seatBookingNow)(e,s),H(`${v} seated at ${(0,y.tableWords)(t)}.`),L()},se=async t=>'seat'===t.id&&t.table?te(t.table):'pick'===t.id?M(e=>!e):'details'===t.id?(L(),z(D)):'finished'===t.id?('seated'===D.status?await(0,b.finishBookingNow)(e,D):await u.repo.bookings.setStatus(D.id,'finished'),H('seated'===D.status&&D.table?`${v} finished. ${(0,y.tableWords)(D.table).replace(/^t/,'T')} needs clearing.`:`${v} finished.`),L()):'noshow'===t.id?(await u.repo.bookings.setStatus(D.id,'noshow'),H(`${v} marked as a no-show.`),L()):void 0,ae=F?(0,y.freeTablesNow)(I,D.partySize,!0).slice(0,12):[];if(G)return(0,C.jsx)(p.TablePicker,{rid:e,booking:D,name:v,turnBase:T,onClose:L,onSaved:H,onPickOnPlan:W?e=>{L(),W(D,e)}:void 0});if(U)return(0,C.jsx)(f.CancelWalkInConfirm,{rid:e,b:D,onClose:L,onDone:H});if(J)return(0,C.jsx)($.CancelBookingConfirm,{rid:e,b:D,name:v,onClose:L,onDone:H});const ie=[...Y];return(0,C.jsxs)(c.Sheet,{visible:!0,onClose:L,title:`${D.time} \xb7 ${v}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(o.default,{accessible:!0,accessibilityLabel:Q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(c.T,{size:18,children:[Q.people,Q.deposit?(0,C.jsxs)(c.T,{size:18,weight:"semibold",colour:Q.depositWarn?j.colours.amber:j.colours.goldLight,children:[" \xb7 ",Q.deposit]}):null," \xb7 ",X]})}),(0,C.jsx)(t.ShowNumberButton,{b:D}),(0,C.jsxs)(o.default,{style:{gap:10},children:[ie.map(e=>(0,C.jsxs)(n.default.Fragment,{children:[(0,C.jsx)(c.Button,{kind:B(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:R.hint,disabled:'details'!==e.id&&!R.ok,testID:`guest-act-${e.id}`,onPress:()=>se(e),style:S}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(c.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&F?(0,C.jsxs)(o.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ae.length?(0,C.jsx)(c.Muted,{children:"No free tables right now."}):null,A?(0,C.jsxs)(o.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:A.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[(0,C.jsx)(c.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:A.ask}),(0,C.jsx)(c.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!R.ok,accessibilityHint:R.hint,onPress:()=>{const e=A.table;E(null),te(e)},style:S}),(0,C.jsx)(c.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>E(null),style:S})]}):ae.map(e=>(0,C.jsx)(c.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,g.overCapacityAsk)([e.table],e.seats,D.partySize);t?E({table:e.table,ask:t}):te(e.table)},style:S},e.table))]}):null]},e.id)),Z.map(t=>(0,C.jsx)(c.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:R.hint,disabled:!R.ok,testID:`guest-act-${t.id}`,style:S,onPress:async()=>{if(R.ok){if('assign'===t.id)return O(!0);await(0,p.saveBookingTables)(e,D,[]),H(`${v}: table taken off.`),L()}}},t.id)),!N&&(0,f.canCancelWalkIn)(D)?(0,C.jsx)(c.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${D.ref}, ${D.partySize} Covers`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-cancelwalkin",onPress:()=>q(!0),style:S}):null,(0,x.canCancelBooking)(D)?(0,C.jsx)(c.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${v}, ${D.time}, ${D.partySize} Covers`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-cancelbooking",onPress:()=>K(!0),style:S}):null,!_||D.walkIn||['cancelled','noshow'].includes(D.status)||N&&!(D.date>=(0,h.ymd)(P))?null:(0,C.jsx)(c.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${v}, ${D.time}. Date, time, covers, table, anything.`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-edit",onPress:()=>{L(),_(D)},style:S}),(0,C.jsx)(c.Button,{kind:"ghost",label:ee.label,accessibilityLabel:ee.a11y,testID:"guest-act-details",onPress:()=>se(ee),style:S})]}),(0,C.jsx)(c.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:L,style:S})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=e(l),o=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),$=r(d[14]),x=r(d[15]),j=r(d[16]),w=r(d[17]),C=r(d[18]);const S={minHeight:64},B=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1341,[1342,860,1025,34,102,794,1119,874,1344,1338,1118,858,1116,1132,1133,1134,821,1307,25]); __d(function(g,r,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)(h.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(h.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=h.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,h.canShowNumber)(e,!y||(0,b.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 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,h.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,h.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]),b=r(d[7]),h=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1342,[34,379,402,102,874,1003,892,1023,1343,872,821,794,25]); __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')}`}},1343,[]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1344,[1025,1100]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a,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.maxSeatsc[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1344,[1025,1100]); __d(function(g,_r,_i,_a,_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 I}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const l=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,n.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,C.jsxs)(m.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,C.jsx)(x.T,{size:13,weight:"semibold",colour:T.colours.gold,children:"NEXT HOUR"}),(0,C.jsxs)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,C.jsx)(x.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,C.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?T.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?T.colours.amber:'#3C78B5'},children:[(0,C.jsx)(x.T,{size:13,weight:"semibold",children:e.time}),(0,C.jsxs)(x.T,{size:13,children:[(0,p.privName)(e,s)," \xb7 ",e.partySize]}),(0,C.jsx)(x.T,{size:12,colour:T.colours.muted,accessibilityLabel:e.table?(0,a.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,a.tableNumbers)(e.table)}`:'no table'}),(0,C.jsx)(x.T,{size:12,colour:t<0?T.colours.amber:T.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,C.jsx)(x.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,C.jsx)(x.T,{size:12,children:v.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,C.jsxs)(x.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,C.jsxs)(x.Row,{gap:4,children:[(0,C.jsx)(m.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:v.STATUS[e].colour}}),(0,C.jsx)(x.T,{size:12,colour:T.colours.muted,children:v.STATUS[e].label})]},e)),(0,C.jsx)(x.T,{size:12,colour:T.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,u.useState)(20);return(0,u.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,u.useEffect)(()=>{l<=0&&s()},[l]),(0,C.jsxs)(x.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,C.jsx)(x.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,C.jsx)(x.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return B}}),_e.TableSheet=function({rid:e,name:t,view:s,plan:i,todays:c,now:h,privacy:w,turnBase:S,onClose:I,onWalkIn:B,onMove:D,onDetails:z}){const M=s[t],N=j.useFloor.getState(),[P,R]=(0,u.useState)(!1),[L,A]=(0,u.useState)(M?.note??''),[W,O]=(0,u.useState)(!1),H=(0,$.useBookingWrite)();if(!M)return null;const F=M.booking,E=['seated','mains','dessert','bill'].includes(M.status),_=c.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,n.minsBetween)(h,(0,v.startOf)(e)))-Math.abs((0,n.minsBetween)(h,(0,v.startOf)(t)))),G=e=>e.partySize<=M.table.maxSeats,U=M.next??M.due,V=(0,v.turnFor)(M.covers||M.table.maxSeats,S);return(0,C.jsxs)(x.Sheet,{visible:!0,onClose:I,title:`${(0,a.tableNumbers)(t)} \xb7 ${v.STATUS[M.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===M.status?(0,C.jsx)(x.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{j.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,C.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(x.Badge,{kind:"neutral",label:`${M.table.minSeats}\u2013${M.table.maxSeats} seats`}),F?(0,C.jsx)(x.Badge,{kind:"gold",label:`${(0,p.privName)(F,w)} \xb7 ${F.partySize} \xb7 ${M.seatedMins}m`}):null,F?(0,C.jsx)(x.Badge,{kind:M.seatedMins>(0,v.durOf)(F,S)?'red':'neutral',label:`Turn about ${(0,v.durOf)(F,S)} min \xb7 free about ${(0,n.hm)((0,v.endOf)(F,S))} (est.)`}):(0,C.jsx)(x.Badge,{kind:"neutral",label:`Turn estimate for ${M.table.maxSeats}: about ${V} min`}),M.next?(0,C.jsx)(x.Badge,{kind:"blue",label:`Next: ${M.next.time} ${(0,p.privName)(M.next,w)} (${M.next.partySize})`}):null,M.allergy?(0,C.jsx)(x.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,C.jsx)(k.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,C.jsx)(o.BookingTableButton,{rid:e,booking:F??U,turnBase:S,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,C.jsx)(r.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,C.jsx)(r.ReinstateWalkInButton,{rid:e,b:F,today:(0,n.ymd)(new Date)}):null,!E&&'blocked'!==M.status&&U?(0,C.jsx)(x.Button,{label:`Seat ${(0,p.privName)(U,w)}`,accessibilityLabel:`Seat ${(0,p.privName)(U,w)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await y.repo.bookings.update(s.id,{table:s.table&&(0,j.tablesOf)(s.table).includes(t)?s.table:t}),await y.repo.bookings.setStatus(s.id,'seated'),(0,f.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==M.status&&U&&(0,v.startOf)(U)<=h?(0,C.jsxs)(x.Row,{gap:8,children:[(0,C.jsx)(x.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,p.privName)(U,w)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await y.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,C.jsx)(x.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,p.privName)(U,w)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await y.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===M.status?null:(0,C.jsxs)(x.Row,{gap:8,children:[(0,C.jsx)(x.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===M.status&&j.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,C.jsx)(x.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,C.jsxs)(m.default,{style:{gap:6},children:[0===_.length?(0,C.jsx)(x.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,C.jsxs)(b.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,p.privName)(s,w)} ${s.time}`,onPress:async()=>{await y.repo.bookings.update(s.id,{table:t}),await y.repo.bookings.setStatus(s.id,'seated'),(0,f.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?T.colours.border:T.colours.amber,backgroundColor:T.colours.surface2},children:[(0,C.jsxs)(x.T,{weight:"semibold",children:[s.time," \xb7 ",(0,p.privName)(s,w)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,a.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,C.jsxs)(x.T,{size:12,colour:T.colours.amber,children:["Bigger than this table (",M.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(x.T,{size:14,colour:T.colours.muted,children:"Course / status"}),(0,C.jsx)(x.Row,{wrap:!0,gap:6,children:v.STAGES.map(s=>(0,C.jsx)(x.Chip,{label:v.STAGE_LABEL[s],selected:M.status===s,onPress:()=>N.setLive(e,t,{stage:s})},s))}),(0,C.jsxs)(x.Row,{wrap:!0,gap:8,children:[F?(0,C.jsx)(x.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,C.jsx)(x.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await y.repo.bookings.setStatus(F.id,'finished'),N.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,C.jsxs)(x.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(x.Button,{kind:"secondary",label:'blocked'===M.status?'Unblock table':'Block table',onPress:()=>{N.setLive(e,t,{blocked:'blocked'!==M.status}),I()},testID:"block-table"}),(0,C.jsx)(x.Button,{kind:"ghost",label:M.note?'Edit note':'Note',onPress:()=>R(!P)}),F||U?(0,C.jsx)(x.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),z(F??U)},testID:"guest-details"}):null]}),P?(0,C.jsxs)(x.Row,{gap:6,children:[(0,C.jsx)(l.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[x.styles.input,{flex:1}]}),(0,C.jsx)(x.Button,{small:!0,label:"Save",onPress:()=>{N.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,w?(0,C.jsx)(x.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,i.joins.some(e=>e.tables.includes(t))?(0,C.jsxs)(x.Muted,{children:["Joins with ",i.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",i.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:a,todays:i,waiting:o,now:r,privacy:c,busy:h,onToast:w}){const[k,$]=(0,u.useState)(''),[B,D]=(0,u.useState)(2),z=(0,j.useFloor)(e=>e.smsLog);return(0,C.jsxs)(I,{title:`Waitlist (${o.length})`,right:(0,C.jsxs)(x.Muted,{children:["new party about ",(0,S.estimateWait)(o.length+1,t.settings.turnMins,h)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,C.jsx)(x.Muted,{children:"Nobody waiting."}):null,o.map((l,o)=>{const u=(0,v.suggestTable)(s,i,a,l.partySize,r,(0,v.turnFor)(l.partySize,t.settings.turnMins)),b=(0,S.estimateWait)(o+1,t.settings.turnMins,h),k=Math.max(0,(0,n.minsBetween)(new Date(l.joinedAt),r)),$=z.find(t=>t.rid===e&&t.text.includes(`#${l.number} `));return(0,C.jsxs)(m.default,{style:{backgroundColor:T.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(x.T,{weight:"semibold",children:["#",l.number," ",(0,p.pv)(l.name,c)," \xb7 ",l.partySize]}),(0,C.jsxs)(x.T,{size:12,colour:k>b?T.colours.amber:T.colours.muted,children:["waited ",k,"m \xb7 quoted about ",b,"m"]})]}),u?(0,C.jsxs)(x.T,{size:12,colour:u.clashes?T.colours.amber:T.colours.ok,children:["Best table: ",u.table," (",u.why,")"]}):(0,C.jsx)(x.T,{size:12,colour:T.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,C.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(x.Button,{small:!0,label:$||'notified'===l.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${l.number}`,onPress:()=>{j.useFloor.getState().logSms(e,r.toISOString(),`#${l.number} ${l.partySize}: Your table at ${t.name} is ready.`),y.repo.waitlist.setStatus(l.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),u?(0,C.jsx)(x.Button,{small:!0,kind:"success",label:`Seat at ${u.table}`,onPress:async()=>{await y.repo.waitlist.setStatus(l.id,'seated'),await y.repo.bookings.seatWalkIn(e,l.partySize,u.table,`From waitlist #${l.number}`),(0,f.resetTableLive)(e,u.table),w(`Waitlist #${l.number} seated at ${u.table}`)}}):null,(0,C.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>y.repo.waitlist.setStatus(l.id,'removed')})]}),'notified'===l.status?(0,C.jsx)(x.Badge,{kind:"ok",label:`Told table ready${$?` ${(0,n.hm)(new Date($.at))}`:''} `}):null]},l.id)}),(0,C.jsxs)(x.Row,{gap:6,children:[(0,C.jsx)(l.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:k,onChangeText:$,style:[x.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,C.jsx)(b.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:T.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(x.T,{weight:"bold",colour:T.colours.gold,children:B})}),(0,C.jsx)(x.Button,{small:!0,label:"Add",disabled:k.trim().length<2,onPress:()=>{y.repo.waitlist.join(e,k.trim(),B),$('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:l,now:a,walkInCount:o,staffOn:r,onSummary:u}){const c=o+l.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)),f=h?c/h:1,p=f>=1.1?T.colours.amber:f>=.85?T.colours.ok:T.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,n.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,n.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,v.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),k=y.filter(e=>e.future&&e.covers>j),S=t.nextHour?.covers??0,$=Math.ceil(S/16);return(0,C.jsxs)(I,{title:"Pace & kitchen",right:(0,C.jsx)(x.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,C.jsxs)(m.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${h}`,style:{gap:4},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{size:14,children:"Covers so far"}),(0,C.jsxs)(x.T,{weight:"bold",colour:p,children:[c," ",(0,C.jsxs)(x.T,{size:13,colour:T.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,C.jsx)(m.default,{style:{height:10,borderRadius:5,backgroundColor:(0,s.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,C.jsx)(m.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,C.jsxs)(x.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,i.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,C.jsx)(x.T,{size:13,colour:T.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,C.jsx)(m.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,C.jsxs)(m.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,C.jsx)(x.T,{size:10,colour:T.colours.muted,children:e.covers||''}),(0,C.jsx)(m.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?T.colours.red:e.future?'#6B5A3A':T.colours.gold}}),(0,C.jsx)(x.T,{size:9,colour:4===t?T.colours.gold:T.colours.muted,children:(0,n.hm)(e.from)})]},t))}),k.map(e=>(0,C.jsxs)(x.T,{size:13,colour:T.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,n.hm)(e.from),"\u2013",(0,n.hm)((0,n.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),$>r?(0,C.jsxs)(x.T,{size:13,colour:T.colours.amber,children:["\u26a0 Next hour about ",S," Covers with ",r," on: about ",$-r," more on the floor suggested."]}):(0,C.jsxs)(x.T,{size:13,colour:T.colours.ok,children:["Staffing looks OK for the next hour (",r," on)."]}),(0,C.jsx)(x.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),r=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,n.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,j.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{children:e}),(0,C.jsx)(x.T,{weight:"semibold",children:t})]},e);return(0,C.jsxs)(x.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(r)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,C.jsx)(x.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return j.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]),c=_r(d[9]);_r(d[10]);var b=e(_r(d[11])),h=e(_r(d[12])),m=e(_r(d[13])),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]),C=_r(d[25]);const I=({title:e,right:t,children:s,testID:l})=>(0,C.jsxs)(m.default,{testID:l,style:{backgroundColor:T.colours.surface,borderRadius:14,borderWidth:1,borderColor:T.colours.border,padding:10,gap:6},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{weight:"semibold",colour:T.colours.gold,children:e}),t]}),s]});const B=e=>(0,C.jsxs)(m.default,{style:{gap:6},children:[(0,C.jsxs)(x.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,C.jsxs)(x.Muted,{children:[e.time," \xb7 ",e.table?(0,j.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,C.jsx)(k.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,C.jsx)(c.BookingNeeds,{b:e,big:!0}),e.notes?(0,C.jsxs)(x.T,{children:["Notes: ",e.notes]}):(0,C.jsx)(x.Muted,{children:"No notes."}),e.allergies.length?(0,C.jsx)(m.default,{style:{backgroundColor:T.colours.redBg,borderRadius:8,padding:8},children:(0,C.jsxs)(x.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,w.allergenLabel)(e.allergen)} \u2014 ${(0,w.severityLabel)(e.severity)}`).join('; ')]})}):(0,C.jsx)(x.Muted,{children:"No allergies declared."}),(0,C.jsx)(t.ShowNumberButton,{b:e},`num-${e.id}`)]});const D=!0},1345,[1342,828,827,860,1140,1114,1132,858,34,1102,236,402,295,102,794,1119,1333,874,1025,861,1112,1100,1292,821,1307,25]); __d(function(g,_r,_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.']}]},1346,[827,34,236,402,102,794,874,1025,1347,821,1348,1350,25]); __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1347,[]); @@ -1491,7 +1491,7 @@ __d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModu __d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4);return(0,f.jsxs)(n.default,{style:{gap:14},children:[g.map(t=>{const u=b.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(n.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(o.default,{testID:`more-page-${t.id}`,accessibilityRole:"button",accessibilityLabel:t.title,onPress:()=>e('more',t.id),style:({pressed:e})=>({padding:12,borderTopWidth:l?1:0,borderColor:i.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,f.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),t.badge?(0,f.jsx)(s.Badge,{kind:"gold",label:t.badge}):null,(0,f.jsx)(s.T,{colour:i.colours.muted,children:"\u203a"})]})},t.id))})]},t):null}),(0,f.jsxs)(s.Muted,{center:!0,children:['staff'===l?'Staff app preview':'Managers app'," \xb7 ",t.APP_VERSION," \xb7 ",'live'===c.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});var t=r(d[0]);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),s=r(d[4]),l=r(d[5]),i=r(d[6]),u=r(d[7]),c=r(d[8]),f=r(d[9]);const b=[],p=e=>{e.forEach(e=>{b.some(t=>t.id===e.id)||b.push(e)})},g=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const h=e=>b.find(t=>t.id===e)},1408,[1015,34,402,102,794,892,821,1084,988,25]); __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'}},1409,[]); __d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1410,[860,34,102,794,892,1025,858,1087,1085,988,1086,5,1000,821,25]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=E,_e.signInWithText=H,_e.SignInWithLink=V,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return!h.IS_CAR&&(v.includes(h.APP_VARIANT)&&!b.PITCH&&!e&&!M())},_e.InviteGate=function(){const[e,H]=(0,u.useState)(p.useSession.persist.hasHydrated()),[D,F]=(0,u.useState)(p.START_INVITE||p.START_HANDOVER?'checking':'done'),[W,L]=(0,u.useState)(null),[K,U]=(0,u.useState)(0),[G,Y]=(0,u.useState)(!1),[$,B]=(0,u.useState)(null),X=(0,p.useSession)(e=>e.meId),Q=(0,p.useSession)(e=>!X||!!e.welcomed[X]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>H(!0));return p.useSession.persist.hasHydrated()&&H(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_HANDOVER&&!p.START_INVITE&&!z){z=!0;const n=await(0,I.claimChromeHandover)(p.START_HANDOVER);if(!t)return;if('ok'===n.status&&n.id.staffRef){R(N(n.id.staffRef)??E({id:n.id.staffRef,name:n.id.displayName||n.id.staffRef,role:'owner'===n.id.role?'owner':'manager'===n.id.role?'manager':'staff',level:'head_chef'===n.id.role?'Head Chef':void 0,job:'',active:!0}))}else if('refused'===n.status&&!e)return L(n.message),void F('done')}if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&L(e)});if(!t)return;if('refused'===e.kind)return L(e.message),void F('done');if('offline'===e.kind)return Y(!0),void(n=setTimeout(()=>{t&&U(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void F('bad')}const o=N(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),B(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}F('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,K]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!X){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t,{app:s,message:l})})}if(G)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===D)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!X&&!b.PITCH)return W&&/already been used/i.test(W)?j(x,'invite-app-used'):W&&(0,S.isPhoneLinked)(W)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):W?j(W,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===D)return(0,w.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,w.jsx)(T.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,w.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F('done')}),(0,w.jsx)(T.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(W&&!X&&(0,S.isPhoneLinked)(W))return(0,w.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:24,weight:"bold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,w.jsx)(T.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,w.jsx)(T.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(W&&!X)return(0,w.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,w.jsx)(T.Muted,{center:!0,children:W}),(0,w.jsx)(T.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,w.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>L(null)})]});if($&&!X)return(0,w.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,w.jsx)(T.Muted,{center:!0,children:$}),(0,w.jsx)(V,{})]});if(!X&&!b.PITCH&&!M())return(0,w.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:W?'This link can\u2019t be used here':'Sign in to CoverCharge'}),W?(0,w.jsx)(T.Muted,{center:!0,children:W}):null,(0,w.jsx)(T.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,w.jsx)(V,{})]});const q=(0,p.rosterPerson)(X);return q&&!Q&&_(q)?(0,w.jsx)(k.LaunchWelcome,{p:q,onDone:()=>p.useSession.getState().markWelcomed(q.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),m=_r(d[12]),k=_r(d[13]),T=_r(d[14]),I=_r(d[15]),b=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),w=_r(d[20]);const x='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,w.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const N=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return R(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=N(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=N(o.id.staffRef)??E({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return R(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function V(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,w.jsxs)(f.default,{style:{gap:6},children:[(0,w.jsx)(T.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsx)(T.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,w.jsx)(T.T,{size:13,colour:m.colours.red,children:t}):null]})}let z=!1;const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1411,[5,1412,1413,1414,1415,1416,34,236,41,102,872,1003,821,1417,794,988,2,1093,1002,892,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=E,_e.signInWithText=H,_e.SignInWithLink=V,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId),n=(0,T.useSync)(e=>'device'===e.kind&&!!e.venueId);return h.IS_CAR?!b.PITCH&&!n:j.includes(h.APP_VARIANT)&&!b.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,H]=(0,u.useState)(p.useSession.persist.hasHydrated()),[D,F]=(0,u.useState)(p.START_INVITE||p.START_HANDOVER?'checking':'done'),[W,L]=(0,u.useState)(null),[K,U]=(0,u.useState)(0),[G,Y]=(0,u.useState)(!1),[$,B]=(0,u.useState)(null),X=(0,p.useSession)(e=>e.meId),Q=(0,p.useSession)(e=>!X||!!e.welcomed[X]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>H(!0));return p.useSession.persist.hasHydrated()&&H(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!j.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_HANDOVER&&!p.START_INVITE&&!z){z=!0;const n=await(0,T.claimChromeHandover)(p.START_HANDOVER);if(!t)return;if('ok'===n.status&&n.id.staffRef){R(N(n.id.staffRef)??E({id:n.id.staffRef,name:n.id.displayName||n.id.staffRef,role:'owner'===n.id.role?'owner':'manager'===n.id.role?'manager':'staff',level:'head_chef'===n.id.role?'Head Chef':void 0,job:'',active:!0}))}else if('refused'===n.status&&!e)return L(n.message),void F('done')}if(p.START_INVITE&&!(e&&await(0,T.signedInHereAs)(e)&&await(0,T.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&L(e)});if(!t)return;if('refused'===e.kind)return L(e.message),void F('done');if('offline'===e.kind)return Y(!0),void(n=setTimeout(()=>{t&&U(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void F('bad')}const o=N(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,T.signedInHereAs)(o.id)){if(await(0,T.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),B(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}F('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,K]),!j.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!X){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t,{app:s,message:l})})}if(G)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===D)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!X&&!b.PITCH)return W&&/already been used/i.test(W)?v(x,'invite-app-used'):W&&(0,S.isPhoneLinked)(W)?v(S.PHONE_LINKED_TEXT,'invite-phone-linked'):W?v(W,'invite-app-refused'):v(P,'invite-app-notsetup');if('bad'===D)return(0,w.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,w.jsx)(I.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,w.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F('done')}),(0,w.jsx)(I.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(W&&!X&&(0,S.isPhoneLinked)(W))return(0,w.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:24,weight:"bold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,w.jsx)(I.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,w.jsx)(I.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(W&&!X)return(0,w.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,w.jsx)(I.Muted,{center:!0,children:W}),(0,w.jsx)(I.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,w.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>L(null)})]});if($&&!X)return(0,w.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,w.jsx)(I.Muted,{center:!0,children:$}),(0,w.jsx)(V,{})]});if(!X&&!b.PITCH&&!M())return(0,w.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:W?'This link can\u2019t be used here':'Sign in to CoverCharge'}),W?(0,w.jsx)(I.Muted,{center:!0,children:W}):null,(0,w.jsx)(I.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,w.jsx)(V,{})]});const q=(0,p.rosterPerson)(X);return q&&!Q&&_(q)?(0,w.jsx)(k.LaunchWelcome,{p:q,onDone:()=>p.useSession.getState().markWelcomed(q.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),m=_r(d[12]),k=_r(d[13]),I=_r(d[14]),T=_r(d[15]),b=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),w=_r(d[20]);const x='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,n)=>(0,w.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:e})}),j=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const N=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return R(t),_(t)?((0,T.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=N(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,T.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=N(o.id.staffRef)??E({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return R(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function V(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,w.jsxs)(f.default,{style:{gap:6},children:[(0,w.jsx)(I.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsx)(I.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,w.jsx)(I.T,{size:13,colour:m.colours.red,children:t}):null]})}let z=!1;const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1411,[5,1412,1413,1414,1415,1416,34,236,41,102,872,1003,821,1417,794,988,2,1093,1002,892,25]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1412,[34,102,873,794,5,6,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1413,[]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1414,[34,102,873,794,25]); diff --git a/display-app/admin.html b/display-app/admin.html index 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 72461a3e6372e0e4bc4092e38b4049a40cac0d2a..e78d2bf3c21515077df8fcbd9b5c1b69a5f1cdfb 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 4cc71db6b1c6f7b7c1fc5fd22646b35e84ec3620..4b4c3d0fd71fd124b41f169b0a0de77251aa746a 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-4b8ca3eb7c"; +const V = "cc-display-10b14e87a0"; const BASE = "/display-app/"; -const PRECACHE = ["/display-app/apple-touch-icon.png", "/display-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/display-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/display-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/display-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/display-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/display-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/display-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/display-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/display-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/display-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/display-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/display-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/display-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/display-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/display-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/display-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/display-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/display-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/display-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/display-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/display-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/display-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/display-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/display-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/display-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/display-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/display-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/display-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/display-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/display-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/display-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/display-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/display-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/display-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/display-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/display-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/display-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/display-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/display-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/display-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/display-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/display-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/display-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/display-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/display-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/display-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/display-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/display-app/brand-logo.png", "/display-app/favicon.ico", "/display-app/icon-192.png", "/display-app/icon-512.png", "/display-app/icon-maskable-192.png", "/display-app/icon-maskable-512.png", "/display-app/manifest.webmanifest", "/display-app/index.html", "/display-app/_expo/static/js/web/bundle.js?v=4b8ca3eb7cb04b869a8a5d2eef90b1691ee06e55054b745ad3a93466358a4fce"]; +const PRECACHE = ["/display-app/apple-touch-icon.png", "/display-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/display-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/display-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/display-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/display-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/display-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/display-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/display-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/display-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/display-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/display-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/display-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/display-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/display-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/display-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/display-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/display-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/display-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/display-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/display-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/display-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/display-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/display-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/display-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/display-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/display-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/display-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/display-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/display-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/display-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/display-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/display-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/display-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/display-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/display-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/display-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/display-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/display-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/display-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/display-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/display-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/display-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/display-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/display-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/display-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/display-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/display-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/display-app/brand-logo.png", "/display-app/favicon.ico", "/display-app/icon-192.png", "/display-app/icon-512.png", "/display-app/icon-maskable-192.png", "/display-app/icon-maskable-512.png", "/display-app/manifest.webmanifest", "/display-app/index.html", "/display-app/_expo/static/js/web/bundle.js?v=10b14e87a0d0fab3b9f1f58d0149a879327e83e551379f02519742f13a6f0bdb"]; // 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 6b239e3d534edbfe8a0bf4574b91cf859e3f9c47..d9fac750961c5f44699e3cb0587385201b266931 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 beffc1a51df9ebedd8d6ca247fcbe8acfe3c0347..24bc4801efa35d197e92d7fa7cbbd6dbfc4128c5 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ -Cover Charge: try the apps (v0.3.12.155) +Cover Charge: try the apps (v0.3.12.156) @@ -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.155)

+

Cover Charge: try the apps (v0.3.12.156)

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

+

Cover Charge v0.3.12.156

diff --git a/owner-app/_expo/static/js/web/bundle.js b/owner-app/_expo/static/js/web/bundle.js index a93b130f388270d098e8a6a862ab0981cd91bcb7..4bd9ec3d7f9eaad33fa0dbab8c9d3ff0614acec5 100644 --- a/owner-app/_expo/static/js/web/bundle.js +++ b/owner-app/_expo/static/js/web/bundle.js @@ -1095,7 +1095,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()})},1012,[34,1013]); __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},1013,[1010,978,1014]); __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'}},1014,[1010]); -__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.155'},1015,[]); +__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.156'},1015,[]); __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});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:h}=await r.select();c&&s(c,h);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},h='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,h.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),h}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),h={...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:h})}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}}},1016,[1017,1018,934,978,1013]); __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())}}}},1018,[978]); @@ -1196,9 +1196,9 @@ __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,"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'},1113,[821]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},1114,[34,102,1115,821,1116,794,25]); __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 b={...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)(b)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(b,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}});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})},1115,[860,1100]); -__d(function(_g,r,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=$,_e.TablePicker=function({rid:e,booking:u,name:p,turnBase:k=90,onClose:v,onSaved:w,onPickOnPlan:T}){const C=(0,b.usePlan)(e),L=(0,c.useBookings)(e),[S,W]=(0,t.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),P=(0,t.useMemo)(()=>(0,h.pickGroups)(C),[C]),z=L.filter(e=>e.date===u.date),O=(0,h.seatsOf)(C,S),D=(0,h.seatLine)(O.total,u.partySize),I=(0,h.pickClashes)(u,S,z,k),B=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,M=(0,h.tableKey)(S)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),N=(0,f.useBlocks)(e=>e.blocks),R=(0,f.blockAt)(N,e,u.date,u.time),_=e=>W(s=>(0,h.toggleTable)(s,e)),Y=async s=>{try{await $(e,u,s),w?.((0,h.savedWords)(p,u.partySize,s,(0,h.seatsOf)(C,s).total)),v()}catch(e){w?.(`Couldn\u2019t save tables for ${p}: ${String(e?.message??e).slice(0,120)}`)}},G=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(S)} picked. ${D.text}.`,children:[(0,x.jsx)(y.T,{size:18,weight:"semibold",colour:g.colours.goldLight,children:(0,h.tablesWords)(S)}),(0,x.jsx)(y.T,{size:17,colour:g.colours.text,children:D.text})]}),R?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${R.from} to ${R.to}${R.reason?` (${R.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.goldMuted},children:(0,x.jsxs)(y.T,{size:16,colour:g.colours.goldLight,children:["New bookings paused ",R.from,"\u2013",R.to,R.reason?` \xb7 ${R.reason}`:'',". You can still save tables for this booking."]})}):null,I.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(I)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.gold},children:(0,x.jsxs)(y.T,{size:16,weight:"semibold",colour:g.colours.goldLight,children:[(0,h.clashWords)(I)," You can still save."]})}):null,(0,x.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(y.Button,{testID:"table-pick-save",label:I.length?'Save anyway':'Save tables',disabled:!M||!S.length,accessibilityLabel:`${I.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(S)} for ${p}. ${D.text}.${I.length?` ${(0,h.clashWords)(I)}`:''}`,onPress:()=>Y(S),style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(y.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${p}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(y.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:v,style:j})]})]});return(0,x.jsxs)(y.Sheet,{visible:!0,onClose:v,title:`Tables \xb7 ${u.time} ${p} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:G,children:[(0,x.jsx)(s.TableNumberWarning,{plan:C}),(0,x.jsx)(y.T,{size:16,colour:g.colours.text,children:"Tap one table, or several to join them. Tap again to take one off."}),T?(0,x.jsx)(y.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${p}`,onPress:()=>T(S),style:j}):null,P.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(y.T,{size:15,weight:"semibold",colour:g.colours.gold,children:e.area}),(0,x.jsx)(y.Row,{gap:8,wrap:!0,children:e.tables.map(e=>{const s=S.includes(e.name),t=B(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:s},'aria-checked':s,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,s,t),onPress:()=>_(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:s?2:1,borderColor:s?g.colours.gold:t?g.colours.goldMuted:g.colours.hairline,borderStyle:t&&!s?'dashed':'solid',backgroundColor:s?g.colours.gold:e?g.colours.tilePressed:g.colours.tile}),children:[(0,x.jsx)(y.T,{size:18,weight:"semibold",colour:s?g.colours.onGold:g.colours.text,children:(0,l.tableNumbers)(e.name)}),(0,x.jsxs)(y.T,{size:14,colour:s?g.colours.onGold:g.colours.muted,children:[e.seats," seats",t?' \xb7 booked':'']})]},e.name)})})]},e.area)),P.length?null:(0,x.jsx)(y.Muted,{children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var s=r(d[0]),l=r(d[1]),t=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),g=r(d[9]),p=r(d[10]),y=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function $(e,s,l){const t=(0,h.tableKey)(l),o=(0,b.tablesOf)(s.table);await c.repo.bookings.update(s.id,(0,u.tablePatch)(t||null)),'seated'===s.status&&s.date===(0,p.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(t).includes(e)).forEach(s=>b.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0})),t&&(0,k.resetTableLive)(e,t))}},1116,[1117,860,34,402,102,874,1025,1115,1118,821,858,794,1119,1022,25]); +__d(function(_g,r,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=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.amber,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(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?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.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=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1116,[1117,860,34,402,102,874,1025,1115,1118,821,858,794,1119,1022,25]); __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])},1117,[34,859,821,794,25]); -__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1118,[860,1100]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.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=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1118,[860,1100]); __d(function(g,_r,_i,_a,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 O}}),_e.useTableNames=N,_e.resetTableLive=M,_e.seatBookingNow=L,_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=F,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return R}}),_e.TablePicker=W,_e.WalkInSheet=E,_e.WalkInMatchPrompt=H,_e.AssignTableSheet=_,_e.undoNotice=Y,_e.NewBookingSheet=U,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[i,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,B.jsxs)(B.Fragment,{children:[s?(0,B.jsx)(E,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,B.jsx)(U,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,i?(0,B.jsx)(_,{booking:i.b,combine:i.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),i=_r(_d[5]),n=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),z=_r(_d[27]),B=_r(_d[28]);const O=Array.from({length:12},(e,t)=>String(t+1));function N(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function M(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}async function L(e,t){await f.repo.bookings.setStatus(t.id,'seated'),M(e,t.table)}function F(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=N(e),a=(0,S.useFloor)(t=>t.live[e])??{},i=(0,S.usePlan)(e),n=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(n,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(i.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,S.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,x.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const R=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function W({use:e,value:t,onPick:s,big:o,best:a,dense:i,bestSet:n,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=i?6:8,y=i?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(n??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,B.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],n=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!n,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,B.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?n?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:n,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:i?58:64,borderRadius:12,borderWidth:n||u?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:n||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:n?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||n?1:.55},children:[(0,B.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,B.jsx)(T.T,{weight:"bold",size:22,colour:n?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,B.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,B.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,B.jsx)(T.T,{size:i?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const A=[1,2,3,4,5,6,7,8];function E({onClose:e,onSeated:a,wide:i,initialTable:y}){const{rid:w,r:C,now:D}=(0,p.useCtx)(15e3),I=F(w,D),[$,P]=(0,r.useState)(2),[O,N]=(0,r.useState)(!1),[R,E]=(0,r.useState)(y??null),_=(0,S.usePlan)(w),Y=(0,f.useBookings)(w),U=(0,v.useBlocks)(e=>e.blocks),q=(0,v.closedAreasAt)(U,w,(0,x.ymd)(D),(0,x.hm)(D)),Q=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(I).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(_,Y.filter(e=>e.date===(0,x.ymd)(D)),e,$,D,(0,k.turnFor)($,C.settings.turnMins),90,void 0,{closed:q})?.table??null},[_,Y,I,$,q.size,D.getTime()]);(0,r.useEffect)(()=>{R&&(0,S.tablesOf)(R).some(e=>'Closed'===I[e]?.label)&&E(null)},[R,q.size]);const[V,G]=(0,r.useState)(!1),[K,X]=(0,r.useState)(''),J=(e,t=String(e),s=()=>{N(!1),P(e)})=>{const o='9+'===t?O:!O&&$===e;return(0,B.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:i?58:60,height:i?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,B.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},Z=(0,B.jsx)(s.PartySizeInput,{value:$,onChange:P,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),ee=(0,B.jsxs)(b.default,{style:{gap:8,width:i?256:void 0},children:[(0,B.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,B.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[A.map(e=>J(e)),J(9,'9+',()=>{N(!0),P(e=>e>=9?e:9)})]}),O?Z:null]}),[te,se]=(0,r.useState)(!1),[oe,le]=(0,r.useState)(null),ae=async(t=R,s=!1)=>{if(!te){if(!s){const e=(0,z.bookingsNearWalkIn)(Y,D,$);if(e.length)return void le({at:t,list:e})}se(!0);try{const s=await f.repo.bookings.seatWalkIn(w,$,t??void 0,K);M(w,t??void 0),a(s),e()}finally{se(!1)}}},ie=async(t,s)=>{if(!te){se(!0);try{const o=s??t.table??null;o&&o!==t.table&&await f.repo.bookings.assignTable(t.id,o),await L(w,{...t,table:o??void 0}),(0,n.notify)({id:`seated:${t.id}`,testID:'walkin-match-toast',timeoutMs:5e3,icon:'\u2713',title:`${t.name} seated \xb7 ${t.partySize} \xb7 ${o?(0,l.tableNumbers)(o):'table to assign'} (booking ${t.ref})`}),le(null),e()}finally{se(!1)}}},ne=(0,B.jsxs)(b.default,{style:{gap:8,flex:i?1:void 0,minWidth:0},children:[(0,B.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,B.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),R?(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>E(null)}):null]}),(0,B.jsx)(W,{use:I,value:R,onPick:e=>{I[e]&&!I[e].busy?ae(e):E(R===e?null:e)},big:i,dense:i,best:Q,bestSet:(0,u.bestTables)(_)}),(0,B.jsxs)(T.Muted,{children:["Tap a free table to seat them there",Q&&!R?` (suggested for ${$}: ${(0,l.tableNumbers)(Q)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(D)}`,maxWidth:i?1100:void 0,testID:"walkin-sheet",children:[(0,B.jsx)(T.Button,{label:`Seat walk-in \xb7 ${$} ${1===$?'person':'people'}${R?` \xb7 ${(0,l.tableNumbers)(R)}`:''}`,disabled:te,onPress:()=>{ae()},testID:"seat-walkin",style:{minHeight:52}}),i?(0,B.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[ee,ne]}):(0,B.jsxs)(B.Fragment,{children:[ee,ne]}),(0,B.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[V?(0,B.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:K,onChangeText:X,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,B.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,B.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]}),oe?(0,B.jsx)(H,{list:oe.list,busy:te,onYes:e=>{ie(e,oe.at)},onNo:()=>{const e=oe.at;le(null),ae(e,!0)},onClose:()=>le(null)}):null]})}function H({list:e,busy:t,onYes:s,onNo:o,onClose:a}){return(0,B.jsx)(T.Sheet,{visible:!0,onClose:a,title:"Booked party?",maxWidth:720,testID:"walkin-match",children:(0,B.jsxs)(b.default,{style:{gap:14},children:[e.map((e,o)=>(0,B.jsxs)(b.default,{testID:`walkin-match-${o}`,style:{gap:12,padding:16,borderRadius:16,borderWidth:2,borderColor:j.colours.gold,backgroundColor:'#15130F'},children:[(0,B.jsx)(b.default,{accessibilityRole:"header",accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:26,weight:"bold",colour:j.colours.goldLight,testID:"walkin-match-question",children:(0,z.walkInMatchQuestion)(e)})}),e.table?(0,B.jsxs)(T.T,{size:17,colour:j.colours.text,children:["Booked table ",(0,l.tableNumbers)(e.table)," \xb7 ",e.ref]}):(0,B.jsx)(T.T,{size:17,colour:j.colours.text,children:e.ref}),(0,B.jsx)(T.Button,{label:"Yes, seat booking",testID:"walkin-match-yes",disabled:t,accessibilityLabel:`Yes, seat ${e.name}'s booking, ${e.partySize} people`,onPress:()=>s(e),style:{minHeight:64}})]},e.id)),(0,B.jsx)(T.Button,{kind:"secondary",label:"No, new walk-in",testID:"walkin-match-no",disabled:t,onPress:o,style:{minHeight:64}})]})})}function _({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:i}=(0,p.useCtx)(15e3),n=F(o,i),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[n,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(i)),t,e.partySize,i,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,i.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),O=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&M(o,l),t()},L=C?(0,B.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,B.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,B.jsx)(b.default,{testID:"combine-short",children:(0,B.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,B.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,B.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>N(I)}),(0,B.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,B.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${R(e)}`,testID:"assign-table-sheet",footer:L,children:[v&&!C?(0,B.jsx)(b.default,{testID:"assign-suggested",children:(0,B.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,B.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,B.jsx)(W,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await N([e])}})]})}function Y(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${R(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function U({date:e,onClose:t,wide:n,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:O}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,L]=(0,r.useState)(ee.blocks),[W,A]=(0,r.useState)(!1),[E,H]=(0,r.useState)(''),[_,Y]=(0,r.useState)(2),[U,q]=(0,r.useState)(null),[Q,V]=(0,r.useState)(''),[G,K]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ie=(0,S.usePlan)(u),ne=(0,P.dogSetUp)(ie),re=!0===te.dog&&ne,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(_,c.settings.turnMins),be=F.filter(e=>e.date===M),he=e=>(0,k.freeTablesAt)(ie,be,_,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(R,u,M,e)}),ge=re&&U?he(U):[];(0,r.useEffect)(()=>{ae(null)},[re,U,_]);const pe=(0,y.bookingSlots)(c,ue,e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),_,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0),e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),me=(0,w.ukPhone)(G),[fe,ye]=(0,r.useState)(!1),ke=U?pe.find(e=>e.time===U):void 0,xe=ke&&ke.left<_?{left:Math.max(0,ke.left),time:ke.time}:null,je=ke&&null!=ke.partiesLeft&&ke.partiesLeft<1?{time:ke.time,cap:ke.partiesCap??0}:null,we=xe||je,Te=U?(0,v.blockAt)(R,u,M,U):void 0,Se='staff'!==z,ve=!!U&&!(0,D.dogTimeOk)(c,F,M,U,de),Ce=!oe.length&&E.trim().length>=2&&!!U&&(!we||fe)&&(0,o.validParty)(_)&&me.ok&&(0,w.emailOk)(X)&&(!Te||Se&&W)&&(!re||ge.length>0)&&!ve,De=te.wheelchair>0||te.stepFree;return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,B.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:_,audience:"staff"}),te.dog&&!ne?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,B.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(L(e),q(null),A(!1))}}),(0,B.jsxs)(T.Row,{gap:6,children:[(0,B.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,B.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,B.jsx)(T.Field,{label:"Name",value:E,onChangeText:H,placeholder:"e.g. Reid",testID:"nb-name"}),(0,B.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&G?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,B.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,B.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(T.T,{center:!0,children:"Covers"}),(0,B.jsx)(s.PartySizeInput,{value:_,onChange:e=>{Y(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!he(e.time).length||!(0,D.dogTimeOk)(c,F,M,e.time,de);return(0,B.jsx)(T.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,v.blockAt)(R,u,M,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:U===e.time,onPress:()=>{q(e.time),A(!1),ye(!1)}},e.time)})}),we?(0,B.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[xe?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(_,xe.left,xe.time)}):null,je?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overPartiesNote)(je.time,je.cap)}):null,(0,B.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&U?(0,B.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,B.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,B.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ie.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),ge.length?(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:ge.slice(0,10).map((e,t)=>(0,B.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${De&&(0,P.accessibleSetUp)(ie)&&!(0,P.isAccessible)(ie,e.table)?' \xb7 not step-free':''}`,selected:(le??ge[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",_," at ",U,". Try another time."]})]}):null,Te?(0,B.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,B.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",Te.from,"\u2013",Te.to,Te.reason?` (${Te.reason})`:'']}),Se?(0,B.jsx)(T.Chip,{label:W?'Manager override on':'Override and book anyway',selected:W,onPress:()=>A(e=>!e)}):(0,B.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,B.jsx)(b.default,{testID:"nb-closed",children:(0,B.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,B.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:_,date:M,time:U,today:(0,x.ymd)(h),bookings:F,audience:"staff",showTables:!1!==c.settings.tableRequests}),De&&!(0,P.accessibleSetUp)(ie)?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,B.jsx)(T.Field,{label:"Notes (optional)",value:Q,onChangeText:V,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,i.depositDue)((0,i.depositOf)(c.settings),_)?(0,B.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,i.depositDue)((0,i.depositOf)(c.settings),_))," (",(0,a.gbp)((0,i.depositOf)(c.settings).perPersonPence)," per person for ",(0,i.depositOf)(c.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,B.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),ve?(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",U,". Try another time: dogs are very welcome then."]}):null,(0,B.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Ce,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||ge.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:_,date:M,time:U,notes:Q.trim(),security:(0,i.depositDue)((0,i.depositOf)(c.settings),_)?'deposit':'none',depositPaid:0,...(0,i.depositDue)((0,i.depositOf)(c.settings),_)?{depositDue:(0,i.depositDue)((0,i.depositOf)(c.settings),_),depositPolicy:(0,i.depositWords)((0,i.depositOf)(c.settings),_,c.name).join(' '),depositRefundable:(0,i.depositOf)(c.settings).refundable,depositCutoffHours:(0,i.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===U)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??ge[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,O)).catch(()=>{}),d?.({date:M,time:U,name:E.trim()}),t()}})]})}},1119,[827,1120,1121,860,867,14,1122,34,859,402,102,872,1084,874,1123,1100,858,821,864,794,1025,1022,1124,1125,1130,1102,1096,1131,25]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,$]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{$(String(e))},[e]);const w=e=>p((0,s.clampParty)(e,b,y)),I=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>w(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:c.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(u.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:c.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?I(-10,'\u221210',"10 fewer people"):null,I(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{$(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&w((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);$(String(e)),w(e)},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:c.colours.border,color:c.colours.text,backgroundColor:c.colours.surface,textAlign:'center',fontSize:20,fontFamily:c.fonts.semibold}}),I(1,'+','One more person'),y-b>=20?I(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),c=r(_d[5]),u=r(_d[6]),d=r(_d[7])},1120,[34,402,412,102,1121,821,794,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return 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.`},1121,[]); @@ -1210,12 +1210,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}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"fitLabel",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"BIG_LABEL_MIN",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"OCC_LABEL_MIN",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"occupiedLabel",{enumerable:!0,get:function(){return S}}),_e.areaBounds=I,_e.minReadableScale=function(e,t){return Math.max(0,...e.tables.filter(e=>e.areaId===t).map(e=>{const t='round'===e.shape?.85:1,o=(7.4399999999999995*Math.max(1,(0,g.tableNumber)(e).length)+6)/(e.w*t),n=22/Math.min(e.w,e.h);return Math.max(o,n)}))},_e.seatSpots=R,_e.FixtureShape=T,_e.FloorCanvas=function(e){const[$,L]=(0,r.useState)({w:0,h:0}),z=e.plan.tables.filter(t=>t.areaId===e.areaId),E=e.crop&&z.length?I(e.plan,e.areaId):{x:0,y:0,w:l.PLAN_W,h:l.PLAN_H},F='live'===e.mode?[...new Map(z.flatMap(t=>{const o=e.view?.[t.name];if(!o?.group||o.group.length<2)return[];const n=[...o.group].sort().join('+');return[[n,{key:n,members:o.group,view:o}]]})).values()]:[],O=28*F.length,D={x:E.x,y:E.y,r:E.x+E.w,b:E.y+E.h},_=$.w?'width'===e.fit?Math.min($.w/l.PLAN_W,e.maxH?e.maxH/l.PLAN_H:9):Math.min($.w/E.w,Math.max(1,$.h-O)/E.h):0,B=e.fill&&'contain'===e.fit&&_>0&&$.h>0,N=B?($.w/_-E.w)/2:0,P=B?(($.h-O)/_-E.h)/2:0,W={x:D.x-N,y:D.y-P,r:D.r+N,b:D.b+P},H=W.r-W.x,G=W.b-W.y,[Y,X]=(0,r.useState)(null),U=(0,r.useRef)(null),[q,J]=(0,r.useState)(null),K=(0,r.useRef)(null);K.current=q,i.default.useEffect(()=>{if(!q)return;const e=setTimeout(()=>J(null),n.ARM_MS);return()=>clearTimeout(e)},[q]);const V='live'===e.mode&&!!e.onDrop,Q=e=>!V||(0,n.isArmed)(K.current,e.id,Date.now()),Z=t=>e.plan.sections.find(e=>e.id===t.sectionId),ee=t=>e.plan.joins.find(e=>e.tables.includes(t.name)),te=i.default.useMemo(()=>(0,g.numberClashes)(e.plan.tables).sameArea,[e.plan.tables]),oe=(t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>Q(t),onResponderTerminationRequest:()=>!Q(t),onResponderGrant:e=>{U.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,id:t.id,kind:o}},onResponderMove:n=>{const r=U.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,a=n.nativeEvent.pageY-r.y;Math.abs(i)+Math.abs(a)<6&&!Y||Q(t)&&('live'!==e.mode||e.onDrop&&e.view&&['seated','mains','dessert','bill'].includes(e.view[t.name]?.status)&&e.view[t.name]?.booking)&&X({id:t.id,dx:i,dy:a,kind:o})},onResponderRelease:r=>{const i=U.current;U.current=null;const s=r.nativeEvent.pageX-(i?.x??0),u=r.nativeEvent.pageY-(i?.y??0);if(X(null),Math.abs(s)+Math.abs(u)<6||!_){if('move'===o){if(V){const e=(0,n.releaseOn)(K.current,t.id,!1,Date.now());if(J(e.arm),'select'===e.action)try{a.default.announceForAccessibility(n.SELECTED_A11Y)}catch{}}e.onTap?.(t)}return}if(V){const e=(0,n.releaseOn)(K.current,t.id,!0,Date.now());if(J(e.arm),'move'!==e.action)return}const h=s/_,c=u/_;if('edit'===e.mode&&'move'===o)e.onMove?.(t,w(v(t.x+h,e.snapOn),0,l.PLAN_W-t.w),w(v(t.y+c,e.snapOn),0,l.PLAN_H-t.h));else if('edit'===e.mode&&'resize'===o)e.onResize?.(t,w(v(t.w+h,e.snapOn),50,400),w(v(t.h+c,e.snapOn),50,300));else if('live'===e.mode&&e.onDrop){const o=t.x+t.w/2+h,n=t.y+t.h/2+c,r=z.find(e=>e.id!==t.id&&o>=e.x-10&&o<=e.x+e.w+10&&n>=e.y-10&&n<=e.y+e.h+10);r&&e.onDrop(t,r)}}}),ne=e=>e*_,re=e=>ne(e-W.x),ie=e=>ne(e-W.y),ae='width'===e.fit?l.PLAN_H*_+O||200:void 0;return(0,x.jsxs)(s.default,{testID:"floor-canvas",onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),style:[{width:'100%',borderRadius:16,overflow:'hidden'},'contain'===e.fit?{flex:1}:{height:ae}],children:[F.map(e=>{const o=z.filter(t=>e.members.includes(t.name)),n=o.length?(Math.min(...o.map(e=>e.x))+Math.max(...o.map(e=>e.x+e.w)))/2:W.x+H/2,r=e.view.booking?.time??e.view.next?.time,i=`${A(e.members)}${r?` \xb7 ${'seated'===e.view.status?'Seated':'Booked'} ${r}`:''}`,a=Math.min(Math.max(0,$.w-8),260);return(0,x.jsx)(s.default,{testID:`joined-label-${e.key}`,accessible:!0,accessibilityLabel:`Joined tables ${i}`,pointerEvents:"none",style:{height:28,width:a,marginLeft:w(ne(n-W.x)-a/2,4,Math.max(4,$.w-a-4)),alignItems:'center',justifyContent:'center',overflow:'hidden',borderRadius:8,borderWidth:1,borderColor:h.colours.gold,backgroundColor:(0,t.soutersSurface)('#0B0B0B')},children:(0,x.jsx)(c.T,{size:16,weight:"bold",colour:h.colours.goldLight,center:!0,numberOfLines:1,children:i})},e.key)}),_?(0,x.jsx)(s.default,{style:{width:ne(H),height:ne(G),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0F0E0C'),borderRadius:16,borderWidth:1,borderColor:h.colours.border,overflow:'hidden'},children:(0,x.jsxs)(s.default,{style:{position:'absolute',left:0,top:0,width:ne(H),height:ne(G)},children:['edit'===e.mode?Array.from({length:l.PLAN_W/(2*l.GRID)},(e,o)=>(0,x.jsx)(s.default,{style:{position:'absolute',left:re(o*l.GRID*2),top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`v${o}`)):null,'edit'===e.mode?Array.from({length:l.PLAN_H/(2*l.GRID)},(e,o)=>(0,x.jsx)(s.default,{style:{position:'absolute',top:ie(o*l.GRID*2),left:0,right:0,height:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`h${o}`)):null,(e.plan.fixtures??[]).filter(t=>t.areaId===e.areaId).map(t=>(0,x.jsx)(T,{f:{...t,x:t.x-W.x,y:t.y-W.y},S:ne,live:'live'===e.mode},t.id)),e.plan.joins.map(e=>{const t=z.filter(t=>e.tables.includes(t.name));if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,x.jsx)(s.default,{testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:re((r+a)/2-u/2),top:ie((i+l)/2)-3,width:ne(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.55)',transform:[{rotate:`${h}rad`}]}},e.id)}),z.map(n=>{const r=e.view?.[n.name],a=r?u.STATUS[r.status]:u.STATUS.free,v=Y?.id===n.id,w=v&&'resize'===Y.kind?Math.max(50,n.w+Y.dx/_):n.w,$=v&&'resize'===Y.kind?Math.max(50,n.h+Y.dy/_):n.h,I=v&&'move'===Y.kind?n.x+Y.dx/_:n.x,T=v&&'move'===Y.kind?n.y+Y.dy/_:n.y,A=e.selected===n.id||e.highlight?.includes(n.name)||q?.id===n.id,L=Z(n),z='edit'===e.mode?'#2A2419':a.colour,E='edit'===e.mode?h.colours.text:a.fg,F='round'===n.shape?ne(Math.min(w,$))/2:ne(10),O='live'===e.mode?(0,g.liveTableLabel)(n,te):(0,l.tableLabel)(n),D=ne(Math.min(w,$))<64,B=r?r.covers>0?r.covers:'soon'===r.status?(r.next??r.dayBookings?.[0])?.partySize??0:0:0,N=e.big&&'live'===e.mode&&r&&!(r.group&&r.group.length>1)&&k.has(r.status)&&B>0,P=N?S(O,B):O,W=M(e.big?Math.max(13,Math.min(34,ne(Math.min(w,$))/3)):Math.max(11,Math.min(22,ne(Math.min(w,$))/4)),P,ne(w)*('round'===n.shape?.85:1),N?C:e.big?j:9),H=ne(w)*('round'===n.shape?.85:1),G=e=>e.length*W*.62+6,X=N&&G(P)>H,U=X&&Math.max(G(O),G(`(${B})`))<=H&&1.2*W*2<=ne($)-4,J=X&&!U,K=Math.max(e.big?11:12,Math.round(.62*W)),V=(ne($)-6-1.4*W)/(1.4*K),Q=V>=2&&ne(w)>=5*K?2:V>=1?1:0,ae=r?.booking&&void 0!==r.seatedMins?r.booking.time:void 0,se='soon'===r?.status?r.next?.time??r.dayBookings?.[0]?.time:void 0,le='edit'===e.mode?`Table ${(0,o.tableNumbers)(O)}, ${(0,l.shapeLabel)(n.shape).toLowerCase()}, ${n.minSeats}\u2013${n.maxSeats} seats${n.online?', bookable online':''}`:'soon'===r?.status?`Table ${(0,o.tableNumbers)(O)}, booked later${se?`, ${se}`:''}${r.group?`, combined with ${r.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`:`Table ${(0,o.tableNumbers)(O)}, ${a.label}${void 0!==r?.seatedMins?`, seated ${r.seatedMins} min`:''}${r?.covers?`, ${r.covers} Covers`:''}${r?.dayBookings?.length?`, booked: ${r.dayBookings.map(e=>`${e.time}, ${e.partySize} Covers`).join('; ')}`:''}${r?.group?`, combined with ${r.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`,de=void 0!==r?.seatedMins&&r.booking?Math.min(1.2,r.seatedMins/(r.booking.durationMins??(0,u.turnFor)(r.booking.partySize,e.turnBase))):null;return(0,x.jsxs)(i.default.Fragment,{children:[R({...n,w:w,h:$}).map((t,o)=>(0,x.jsx)(s.default,{pointerEvents:"none",style:[{position:'absolute',left:re(I+t.x)-Math.max(4,ne(8)),top:ie(T+t.y)-Math.max(4,ne(8)),width:Math.max(8,ne(16)),height:Math.max(8,ne(16)),borderRadius:99,backgroundColor:'edit'===e.mode?'#5A4C33':'rgba(255,255,255,0.16)',borderWidth:1,borderColor:'edit'===e.mode?h.colours.gold:'rgba(255,255,255,0.25)'},y()]},o)),'live'===e.mode&&(ne(w)<44||ne($)<44)?(0,x.jsx)(s.default,{accessible:!1,importantForAccessibility:"no-hide-descendants",'aria-hidden':!0,...oe(n,'move'),style:{position:'absolute',left:re(I+w/2)-Math.max(44,ne(w))/2,top:ie(T+$/2)-Math.max(44,ne($))/2,width:Math.max(44,ne(w)),height:Math.max(44,ne($)),zIndex:2}}):null,(0,x.jsxs)(s.default,{testID:`table-${n.name}`,accessibilityRole:"button",accessibilityLabel:le,onAccessibilityTap:()=>e.onTap?.(n),onKeyDown:t=>{'Enter'!==t?.key&&' '!==t?.key||e.onTap?.(n)},tabIndex:0,...oe(n,'move'),style:[{position:'absolute',left:re(I),top:ie(T),width:ne(w),height:ne($),borderRadius:F,backgroundColor:z,alignItems:'center',justifyContent:'center',padding:2,overflow:J?'visible':'hidden',borderWidth:A?3:e.sectionColours&&L?2.5:1.5,borderColor:A?'#FFFFFF':e.sectionColours&&L?(0,h.brandColour)(L.colour):'edit'===e.mode?h.colours.gold:'rgba(0,0,0,0.35)',transform:[{scale:v?1.06:1}],zIndex:v?50:J?4:3,opacity:v&&'live'===e.mode?.85:1,shadowColor:'#000',shadowOpacity:v?.6:.3,shadowRadius:v?14:6,cursor:'edit'===e.mode?'grab':'pointer',touchAction:'none'},v?null:y()],children:[(0,x.jsxs)(s.default,{style:J?{alignItems:'center',justifyContent:'center',overflow:'visible'}:{alignItems:'center',justifyContent:'center',maxWidth:'100%',maxHeight:'100%',overflow:'hidden'},pointerEvents:"none",children:[N?(0,x.jsx)(c.T,{testID:`table-label-${n.name}`,style:U?{flexShrink:0,lineHeight:Math.round(1.2*W),maxWidth:Math.max(20,H-4)}:J?{...p,whiteSpace:'nowrap',textShadowColor:'rgba(0,0,0,0.9)',textShadowRadius:3,textShadowOffset:{width:0,height:0}}:p,weight:"bold",size:W,colour:J?'#FFFFFF':E,center:!0,numberOfLines:U?2:1,children:P}):(0,x.jsx)(c.T,{style:p,weight:"bold",size:W,colour:E,center:!0,numberOfLines:1,children:O}),'live'===e.mode&&'blocked'===r?.status?(0,x.jsx)(c.T,{style:f,size:Math.max(10,Math.round(.5*W)),weight:"semibold",colour:E,center:!0,numberOfLines:1,children:"Blocked"}):null,N||'live'===e.mode&&r?.group&&r.group.length>1?null:e.big&&'live'===e.mode&&r&&1===Q?'free'!==r.status&&'soon'!==r.status&&(r.covers||ae)?(0,x.jsx)(c.T,{style:f,size:K,weight:"bold",colour:E,center:!0,numberOfLines:1,children:[r.covers?`${r.covers}`:'',ae??''].filter(Boolean).join(' \xb7 ')}):null:e.big&&'live'===e.mode&&r&&2===Q?(0,x.jsxs)(x.Fragment,{children:['soon'!==r.status&&r.covers?(0,x.jsxs)(c.T,{style:f,size:K,weight:"semibold",colour:E,center:!0,children:[r.covers," ",1===r.covers?'Cover':'Covers']}):'free'!==r.status||D?null:(0,x.jsxs)(c.T,{style:f,size:K,colour:E,center:!0,children:[n.minSeats,"\u2013",n.maxSeats]}),'free'!==r.status&&'soon'!==r.status&&ae?(0,x.jsx)(c.T,{style:f,size:K,weight:"bold",colour:E,center:!0,children:ae}):'dirty'===r.status?(0,x.jsx)(c.T,{style:f,size:K,colour:E,center:!0,children:"Clear"}):null]}):e.big&&'live'===e.mode?null:'edit'===e.mode?D?null:(0,x.jsxs)(c.T,{style:f,size:11,colour:h.colours.muted,center:!0,children:[n.minSeats,"\u2013",n.maxSeats,n.online?' \xb7 online':'']}):r?(0,x.jsxs)(x.Fragment,{children:['free'!==r.status||D?null:(0,x.jsxs)(c.T,{style:f,size:11,colour:E,center:!0,children:[n.minSeats,"\u2013",n.maxSeats," seats"]}),void 0!==r.seatedMins?(0,x.jsxs)(c.T,{style:f,size:12,weight:"semibold",colour:E,center:!0,children:[r.seatedMins,"m \xb7 ",r.covers,"\ud83d\udc65"]}):r.orderOnly?(0,x.jsx)(c.T,{style:f,size:11,colour:E,center:!0,children:"Open order"}):null,'dirty'!==r.status||D?null:(0,x.jsx)(c.T,{style:f,size:11,colour:E,center:!0,children:"Clear"}),!D||r.allergy||r.vip?(0,x.jsxs)(c.T,{style:f,size:11,colour:E,center:!0,children:[r.allergy?'\u26a0':'',r.vip?'VIP'===r.vip?'\u2605':'\u2665':'',r.occasion?u.OCCASION_ICON[r.occasion]:'',r.note?'\u270e':'']}):null]}):null]}),null,'live'===e.mode&&r&&!D&&(r.booking??r.next)&&(0,b.needsIcons)(r.booking??r.next).replace('\u26a0\ufe0f','').trim()?(0,x.jsx)(s.default,{pointerEvents:"none",testID:`needs-${n.name}`,style:{position:'absolute',bottom:e.big?-Math.max(9,.55*K):2,right:e.big?-6:4,backgroundColor:(0,t.soutersSurface)('rgba(11,11,11,0.85)'),borderRadius:8,paddingHorizontal:4,borderWidth:1,borderColor:'rgba(255,255,255,0.15)'},children:(0,x.jsx)(c.T,{size:e.big?Math.max(11,.75*K):10,children:(0,b.needsIcons)(r.booking??r.next).replace('\u26a0\ufe0f','').trim()})}):null,L&&'live'===e.mode&&e.sectionColours&&!D&&!e.big?(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:3,right:6,backgroundColor:(0,h.brandColour)(L.colour),borderRadius:6,paddingHorizontal:3},children:(0,x.jsx)(c.T,{size:9,weight:"bold",colour:"#0B0B0B",children:L.server})}):null,null===de||D?null:(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:'15%',right:'15%',bottom:5,height:4,borderRadius:2,backgroundColor:'rgba(0,0,0,0.25)'},children:(0,x.jsx)(s.default,{style:{width:`${Math.min(100,100*de)}%`,height:4,borderRadius:2,backgroundColor:de>=1?'#B3261E':'rgba(0,0,0,0.6)'}})}),ee(n)&&'edit'===e.mode?(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',bottom:2,left:4},children:(0,x.jsx)(c.T,{size:10,colour:h.colours.gold,children:"\u26d3"})}):null]}),'edit'===e.mode&&e.selected===n.id?(0,x.jsx)(s.default,{testID:"resize-handle",accessibilityLabel:"Resize table",...oe(n,'resize'),style:{position:'absolute',left:re(I+w)-14,top:ie(T+$)-14,width:28,height:28,borderRadius:14,backgroundColor:h.colours.gold,borderWidth:2,borderColor:'#fff',zIndex:60,cursor:'nwse-resize',touchAction:'none'}}):null]},n.id)}),0===z.length?(0,x.jsx)(s.default,{style:{position:'absolute',left:0,right:0,top:'45%'},children:(0,x.jsxs)(c.T,{center:!0,colour:h.colours.muted,children:["No tables in this area yet",'edit'===e.mode?' \u2014 add some in Tables':'',"."]})}):null]})}):null]})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),i=e(r),a=e(_r(d[4]));_r(d[5]);var s=e(_r(d[6])),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),c=_r(d[10]),b=_r(d[11]),g=_r(d[12]),x=_r(d[13]);const f={flexShrink:0},p={flexShrink:0,maxWidth:'none'},y=(e=250)=>({transitionProperty:'background-color, border-color, transform, left, top, width, height',transitionDuration:`${e}ms`}),v=(e,t=!0)=>t?Math.round(e/l.GRID)*l.GRID:Math.round(e),w=(e,t,o)=>Math.max(t,Math.min(o,e)),M=(e,t,o,n=9)=>Math.max(n,Math.min(e,(o-6)/(.62*Math.max(1,t.length)))),j=12,C=11,k=new Set(['soon','seated','mains','dessert','bill']),S=(e,t)=>`${e} (${t})`,$=46;function I(e,t){const o=e.tables.filter(e=>e.areaId===t);if(!o.length)return{x:0,y:0,w:l.PLAN_W,h:l.PLAN_H};const n=Math.max(0,Math.min(...o.map(e=>e.x))-$),r=Math.max(0,Math.min(...o.map(e=>e.y))-$);return{x:n,y:r,w:Math.min(l.PLAN_W,Math.max(...o.map(e=>e.x+e.w))+$)-n,h:Math.min(l.PLAN_H,Math.max(...o.map(e=>e.y+e.h))+$)-r}}function R(e){const t=Math.max(1,e.maxSeats),o=[];if('round'===e.shape){const n=e.w/2+9.6,r=e.h/2+9.6;for(let i=0;ie.w,r=Math.ceil(t/2),i=t-r;if(n){for(let t=0;te.w,a=n?{borderColor:'#FFFFFF',borderWidth:2}:null;return'bar'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#2A2216':'#3A2E1C',borderRadius:8,borderWidth:1.5,borderColor:o?'#5A4A30':h.colours.gold},a],children:(0,x.jsx)(c.T,{size:Math.max(9,Math.min(14,t(e.h)/2.4)),weight:"semibold",colour:h.colours.goldLight,children:"BAR"})}):'wall'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#3A3631':'#5C574F',borderRadius:2},a]}):'window'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:'rgba(226,196,137,0.16)',borderColor:'rgba(226,196,137,0.6)',borderWidth:1,borderRadius:2},a],children:!o&&t(i?e.h:e.w)>60?(0,x.jsx)(c.T,{size:9,colour:"#BFDDFF",style:i?{transform:[{rotate:'90deg'}]}:void 0,children:"WINDOW"}):null}):(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{borderColor:o?'#7A6440':h.colours.gold,borderWidth:1.5,borderStyle:'dashed',borderRadius:3,backgroundColor:'rgba(207,164,95,0.08)'},a],children:t(i?e.h:e.w)>40?(0,x.jsx)(c.T,{size:9,colour:h.colours.goldLight,style:i?{transform:[{rotate:'90deg'}]}:void 0,children:"DOOR"}):null})}function A(e){return(0,l.tablesLabel)(e.join('+')).replace(/^Tables? /,'').replace(/ \+ /g,'+')}},1127,[828,860,1128,34,281,236,102,1025,1100,821,794,1102,859,25]); __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])},1129,[34,402,102,874,861,863,821,794,25]); -__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 a}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return o}}),_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 d}}),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 l}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return f}}),_e.changedFields=P,_e.historyText=O,_e.editPatch=function(t,a,s,o=(new Date).toISOString()){const n=P(t,a);if(!n.length)return{};const d={};for(const c of n)switch(c){case'partySize':d.partySize=(0,e.clampParty)(Number(a.partySize));break;case'phone':case'email':case'table':d[c]=String(a[c]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[c]=String(a[c]??'').trim();break;case'area':d.area=(a.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(a.dogs??0)),d.dog=Number(a.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(a.highChairs??0))||void 0;break;case'wheelchair':d.access={...t.access??{},wheelchair:Math.max(0,Number(a.wheelchair??0))||void 0};break;case'occasion':d.occasion=a.occasion||void 0;break;case'allergies':d.allergies=[...a.allergies??[]],d.allergyNone=!!a.allergyNone&&!(a.allergies??[]).length,d.allergyNote=(a.allergyNote??'').trim()||void 0,(a.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(a.vegan??0)||void 0,vegetarian:Number(a.vegetarian??0)||void 0};break;case'deposit':if(!a.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(a.depositDue??0))),a.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(a.depositDate??'')?a.depositDate:o.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(a.depositAmount??0))),depositPaidBy:s.by.slice(0,80),depositPaidAt:e===o.slice(0,10)?o:`${e}T12:00:00.000Z`,depositMethod:a.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=a.status,'seated'!==a.status||t.seatedAt||(d.seatedAt=o),'finished'!==a.status||t.finishedAt||(d.finishedAt=o),'confirmed'!==a.status&&'pending'!==a.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=a.source||void 0;break;case'tags':d.tags=[...(t.tags??[]).filter(e=>!p.includes(e)),...a.tags??[]];break;case'duration':d.durationMins=Number(a.duration??0)>=15?Number(a.duration):void 0}n.includes('table')&&(d.tableSetHere=!0);const c=t;return d.locallyEdited=!0,d.editedFields=[...new Set([...c.editedFields??[],...n])],d.editLog=[...c.editLog??[],{at:o,by:s.by.slice(0,80),app:s.app,fields:n,text:O(t,a,n,s.by.slice(0,80),o)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>b[e]??e).join(', ')} changed by ${e.by} ${N(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,a,s,o,n=90,d){const c=[];if(!P(e,a).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return c;const u={...e,date:a.date,time:a.time,partySize:a.partySize,...Number(a.duration??0)>=15?{durationMins:Number(a.duration)}:{}};if(a.table){const e=(0,t.tableOverlaps)(u,a.table,s.filter(e=>e.date===a.date),n);if(e.length&&c.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),d){const e=a.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>d.tables.find(t=>t.name===e)).filter(Boolean),t=e.reduce((e,t)=>e+t.maxSeats,0);e.length&&td.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(a.dogs??0)>0&&s.length&&c.push(`Dogs aren\u2019t allowed in ${s[0].name}. Pick a dog-friendly table.`)}}o&&c.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return c},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return k}}),_e.bookingExtras=function(e){const t=e,a=e.dogs??(e.dog?1:0),s=[];a&&s.push(w(a,'dog','dogs'));t.highChairs&&s.push(w(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&s.push(w(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&s.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&s.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&s.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&s.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&s.push(`Deposit by ${t.depositMethod}`);return s.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]);const a='For example: birthday, high chair, dog, window seat',s='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.',o=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')},d=['date','time','partySize','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration'],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'}],l=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],h=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],p=['VIP','Regular'],b={date:'date',time:'time',partySize:'covers',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'},f=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:(a=e.depositPaidAt,a?a.slice(0,10):''),depositDue:e.depositDue??0,status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>p.includes(e)).sort(),duration:e.durationMins??0};var a},y=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),$=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'']:[!1]);function v(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return y(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return $(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':return Number(t[e]??0);default:return String(t[e]??'').trim()}}function P(e,t){const a=f(e);return d.filter(e=>v(e,a)!==v(e,t))}const S=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,N=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},w=(e,t,a)=>`${e} ${1===e?t:a}`;function O(e,t,a,s,o){const n=f(e),d=[];for(const e of[...a].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))'deposit'===e?t.depositOn?t.depositPaid&&!n.depositPaid?d.push(`deposit marked paid (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&n.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${S(Number(t.depositDue??0))}`):d.push('deposit taken off'):'dogs'===e?d.push(!n.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?w(Number(t.dogs),'dog','dogs'):'no dog now'):'highChairs'===e?d.push(t.highChairs?w(Number(t.highChairs),'high chair','high chairs'):'no high chair now'):'wheelchair'===e?d.push(t.wheelchair?w(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now'):'partySize'===e?d.push(`covers ${n.partySize} to ${t.partySize}`):'time'===e?d.push(`time ${n.time} to ${t.time}`):'date'===e?d.push(`date ${n.date} to ${t.date}`):'table'===e?d.push(t.table?`table ${t.table}`:'table taken off'):'status'===e?d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`):'occasion'===e?d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off'):'area'===e?d.push(t.area?`area ${t.area}`:'any area'):'duration'===e?d.push(t.duration?`table time ${t.duration} min`:'table time as usual'):d.push(`${b[e]} changed`);const c=d.join(', ');return`${c.charAt(0).toUpperCase()}${c.slice(1)} by ${s} ${N(o)}`}const k=e=>e.map(e=>b[e]).join(', ')},1130,[1121,1115]); +__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 n}}),_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 d}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return l}}),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}}),_e.changedFields=N,_e.historyText=k,_e.editPatch=function(t,a,s,o=(new Date).toISOString()){const n=N(t,a);if(!n.length)return{};const d={};for(const c of n)switch(c){case'partySize':d.partySize=(0,e.clampParty)(Number(a.partySize));break;case'phone':case'email':case'table':d[c]=String(a[c]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[c]=String(a[c]??'').trim();break;case'area':d.area=(a.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(a.dogs??0)),d.dog=Number(a.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(a.highChairs??0))||void 0;break;case'wheelchair':d.access={...t.access??{},wheelchair:Math.max(0,Number(a.wheelchair??0))||void 0};break;case'occasion':d.occasion=a.occasion||void 0;break;case'allergies':d.allergies=[...a.allergies??[]],d.allergyNone=!!a.allergyNone&&!(a.allergies??[]).length,d.allergyNote=(a.allergyNote??'').trim()||void 0,(a.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(a.vegan??0)||void 0,vegetarian:Number(a.vegetarian??0)||void 0};break;case'deposit':if(!a.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(a.depositDue??0))),a.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(a.depositDate??'')?a.depositDate:o.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(a.depositAmount??0))),depositPaidBy:s.by.slice(0,80),depositPaidAt:e===o.slice(0,10)?o:`${e}T12:00:00.000Z`,depositMethod:a.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=a.status,'seated'!==a.status||t.seatedAt||(d.seatedAt=o),'finished'!==a.status||t.finishedAt||(d.finishedAt=o),'confirmed'!==a.status&&'pending'!==a.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=a.source||void 0;break;case'tags':d.tags=[...(t.tags??[]).filter(e=>!b.includes(e)),...a.tags??[]];break;case'duration':d.durationMins=Number(a.duration??0)>=15?Number(a.duration):void 0}n.includes('table')&&(d.tableSetHere=!0);const c=t;return d.locallyEdited=!0,d.editedFields=[...new Set([...c.editedFields??[],...n])],d.editLog=[...c.editLog??[],{at:o,by:s.by.slice(0,80),app:s.app,fields:n,text:k(t,a,n,s.by.slice(0,80),o)}].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} ${w(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,s,o,n,d=90,c){const u=[];if(!N(e,s).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return u;const l={...e,date:s.date,time:s.time,partySize:s.partySize,...Number(s.duration??0)>=15?{durationMins:Number(s.duration)}:{}};if(s.table){const e=(0,t.tableOverlaps)(l,s.table,o.filter(e=>e.date===s.date),d);if(e.length&&u.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),c){const e=s.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>c.tables.find(t=>t.name===e)).filter(Boolean),t=e.reduce((e,t)=>e+t.maxSeats,0),o=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),t,s.partySize):null;o&&u.push(o);const n=e.map(e=>c.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(s.dogs??0)>0&&n.length&&u.push(`Dogs aren\u2019t allowed in ${n[0].name}. Pick a dog-friendly table.`)}}n&&u.push(`Bookings are paused ${n.from} to ${n.to}${n.reason?` (${n.reason})`:''}.`);return u},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return M}}),_e.bookingExtras=function(e){const t=e,a=e.dogs??(e.dog?1:0),s=[];a&&s.push(O(a,'dog','dogs'));t.highChairs&&s.push(O(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&s.push(O(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&s.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&s.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&s.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&s.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&s.push(`Deposit by ${t.depositMethod}`);return s.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),a=r(_d[2]);const s='For example: birthday, high chair, dog, window seat',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.',n=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const d=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},c=['date','time','partySize','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration'],u=['card','cash','bank transfer','website','other'],l=[{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',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'},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:(a=e.depositPaidAt,a?a.slice(0,10):''),depositDue:e.depositDue??0,status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0};var a},v=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),$=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'']:[!1]);function P(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return v(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return $(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':return Number(t[e]??0);default:return String(t[e]??'').trim()}}function N(e,t){const a=y(e);return c.filter(e=>P(e,a)!==P(e,t))}const S=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},O=(e,t,a)=>`${e} ${1===e?t:a}`;function k(e,t,a,s,o){const n=y(e),d=[];for(const e of[...a].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))'deposit'===e?t.depositOn?t.depositPaid&&!n.depositPaid?d.push(`deposit marked paid (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&n.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${S(Number(t.depositDue??0))}`):d.push('deposit taken off'):'dogs'===e?d.push(!n.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?O(Number(t.dogs),'dog','dogs'):'no dog now'):'highChairs'===e?d.push(t.highChairs?O(Number(t.highChairs),'high chair','high chairs'):'no high chair now'):'wheelchair'===e?d.push(t.wheelchair?O(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now'):'partySize'===e?d.push(`covers ${n.partySize} to ${t.partySize}`):'time'===e?d.push(`time ${n.time} to ${t.time}`):'date'===e?d.push(`date ${n.date} to ${t.date}`):'table'===e?d.push(t.table?`table ${t.table}`:'table taken off'):'status'===e?d.push(`status ${l.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`):'occasion'===e?d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off'):'area'===e?d.push(t.area?`area ${t.area}`:'any area'):'duration'===e?d.push(t.duration?`table time ${t.duration} min`:'table time as usual'):d.push(`${f[e]} changed`);const c=d.join(', ');return`${c.charAt(0).toUpperCase()}${c.slice(1)} by ${s} ${w(o)}`}const M=e=>e.map(e=>f[e]).join(', ')},1130,[1121,1115,1118]); __d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WALKIN_MATCH_MINS",{enumerable:!0,get:function(){return t}}),e.bookingsNearWalkIn=function(s,o,u,d=3){const c=n(o);return s.filter(t=>t.date===c&&!t.walkIn&&('confirmed'===t.status||'pending'===t.status)&&/^\d{2}:\d{2}/.test(t.time||'')).map(t=>({b:t,d:Math.abs((new Date(`${t.date}T${t.time.slice(0,5)}:00`).getTime()-o.getTime())/6e4)})).filter(n=>n.d<=t).sort((t,n)=>(u?Number(n.b.partySize===u)-Number(t.b.partySize===u):0)||t.d-n.d).slice(0,d).map(t=>t.b)},e.walkInMatchQuestion=function(t){return`Is this ${t.name}, ${t.time.slice(0,5)}, ${t.partySize} ${1===t.partySize?'person':'people'}?`};const t=45,n=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1131,[]); __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 y}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return h}}),_e.cancelWalkInWords=x,_e.reinstateWalkInWords=p,_e.cancelWalkInNow=$,_e.reinstateWalkInNow=I,_e.CancelWalkInButton=function({rid:e,b:t,onDone:l,small:s,big:o}){const[c,u]=(0,n.useState)(!1);return y(t)?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(f.Button,{kind:"secondary",small:s,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>u(!0),style:o?{minHeight:64}:s?{minHeight:44}:w}),c?(0,k.jsx)(j,{rid:e,b:t,onClose:()=>u(!1),onDone:l}):null]}):null},_e.CancelWalkInConfirm=j,_e.ReinstateWalkInButton=function({rid:e,b:t,today:l,onDone:o,small:c}){const[u,y]=(0,n.useState)(!1);if(!h(t,l))return null;const x=p(t);if(!u)return(0,k.jsx)(f.Button,{kind:"ghost",small:c,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>y(!0),style:c?{minHeight:44}:w});return(0,k.jsxs)(f.Sheet,{visible:!0,onClose:()=>y(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,k.jsx)(s.default,{accessible:!0,accessibilityLabel:x,children:(0,k.jsx)(f.T,{size:18,colour:b.colours.text,children:x})}),(0,k.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(f.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[w,{flexGrow:1}],onPress:async()=>{await I(e,t),y(!1),o?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,k.jsx)(f.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>y(!1),style:w})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=(e=l)&&e.__esModule?e:{default:e},o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]);const w={minHeight:56},y=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),h=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function x(e){const t=(0,c.tablesOf)(e.table),n=(0,u.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 p(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 $(e,n){await o.repo.bookings.setStatus(n.id,'cancelled'),await o.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,c.tablesOf)(n.table).forEach(t=>c.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function I(e,t){await o.repo.bookings.setStatus(t.id,'seated'),(0,c.tablesOf)(t.table).forEach(t=>c.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function j({rid:e,b:t,onClose:n,onDone:l}){const o=x(t);return(0,k.jsxs)(f.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,k.jsx)(s.default,{accessible:!0,accessibilityLabel:o,children:(0,k.jsx)(f.T,{size:18,colour:b.colours.text,children:o})}),(0,k.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(f.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[w,{flexGrow:1}],onPress:async()=>{await $(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,c.tablesOf)(t.table).length?` ${(0,u.tablesWords)((0,c.tablesOf)(t.table))} free.`:''}`)}}),(0,k.jsx)(f.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:w})]})]})}},1132,[1133,34,102,874,1025,1118,821,794,25]); __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})]})]})}},1133,[34,102,874,1025,1115,1134,1118,821,1003,892,872,794,25]); __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))}},1134,[]); -__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:a,inStaffApp:n,shiftManager:l,big:o,testID:d}){const[r,u]=(0,t.useState)(!1),x=(0,p.useSession)(e=>e.meId),j=(0,b.useOwner)(e=>e.staff.find(e=>e.id===x&&e.active));return s.walkIn||!(0,h.canEditBooking)({variant:c.APP_VARIANT,inStaffApp:n,role:a,shiftManager:l})||x&&!(0,m.canChangeBookings)(j)?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.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}}),r?(0,T.jsx)(B,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:a,hidePrivate:n}){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,60);return o?(0,T.jsx)(B,{rid:e,id:o,who:i,hidePrivate:n,onClose:a}):(0,T.jsxs)(f.Sheet,{visible:!0,onClose:a,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,T.jsx)(f.T,{size:16,colour:j.colours.text,children:"Tip: tap the booking you want to change."}),r.length?r.map(e=>(0,T.jsx)(f.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${e.date===s?'Today':e.date} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${e.date===s?'today':e.date}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56,alignItems:'flex-start'}},e.id)):(0,T.jsx)(f.Muted,{children:"No bookings to edit from today on."}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:a,style:{minHeight:44}})]})},_e.EditBookingSheet=B;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),a=_r(_d[3]),n=(e=a)&&e.__esModule?e:{default:e},l=_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]),j=_r(_d[15]),y=_r(_d[16]),D=_r(_d[17]),C=_r(_d[18]),I=_r(_d[19]),f=_r(_d[20]),T=_r(_d[21]);const v=/^([01]\d|2[0-3]):[0-5]\d$/,w=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const k=e=>e?(e/100).toFixed(e%100?2:0):'',S=e=>{const t=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(t)&&t>=0?Math.round(100*t):NaN},P=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',$=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')}`:''},N=e=>e.charAt(0).toUpperCase()+e.slice(1);function E({title:e,children:t,testID:s}){return(0,T.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,T.jsx)(f.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const z=({label:e,value:t,onChange:s,max:i=20,testID:a})=>(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:e}),(0,T.jsx)(f.Stepper,{testID:a,value:t,min:0,max:i,onChange:s,label:e})]});function B({rid:e,id:a,who:p,onClose:b,hidePrivate:m='display'===c.APP_VARIANT}){const B=(0,l.useBookings)(e),A=B.find(e=>e.id===a),O=(0,r.useRestaurant)(e),R=(0,o.usePlan)(e),L=(0,d.useBlocks)(e=>e.blocks),[F,W]=(0,t.useState)(A?(0,h.draftOf)(A):null),[M,_]=(0,t.useState)(null),[H,V]=(0,t.useState)(null),[Y,G]=(0,t.useState)(k(A?(0,h.draftOf)(A).depositDue:0)),[U,X]=(0,t.useState)(k(A?(0,h.draftOf)(A).depositAmount:0)),[q,J]=(0,t.useState)(P(A?(0,h.draftOf)(A).depositDate:''));if(!A||!F||!O)return null;const K=e=>{_(null),V(null),W({...F,...e})},Q=w(F.time),Z=v.test(Q),ee=F.area?R.areas.filter(e=>e.name===F.area).map(e=>e.id):null,te=e=>!ee||e.split('+').every(e=>ee.includes(R.tables.find(t=>t.name===e)?.areaId??'')),se=(0,x.tableOptions)(R,B.filter(e=>e.date===F.date),F.table).filter(e=>te(e)||e===F.table),ie=!(F.depositOn&&(Number.isNaN(S(Y||'0'))||F.depositPaid&&(Number.isNaN(S(U||'0'))||q.trim()&&!$(q)))),ae={...F,time:Q,depositDue:S(Y||'0')||0,depositAmount:S(U||'0')||0,depositDate:$(q)},ne=(0,h.changedFields)(A,ae),le=O.settings.turnMins??90,oe=async()=>{const t=(0,h.editPatch)(A,ae,{by:p||'Team member',app:c.APP_VARIANT});if(Object.keys(t).length&&await l.repo.bookings.update(A.id,t),'seated'===A.status&&'table'in t&&t.table!==A.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(A.table),a=s(t.table),n=o.useFloor.getState(),l=i.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!a.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),a.forEach(t=>n.setLive(e,t,{stage:l,dirty:!1}))}V(`Saved. Changed: ${(0,h.editedWords)(ne)}.`),_(null),b()},de=F.allergies??[],re=e=>K({allergyNone:!1,allergies:de.some(t=>t.allergen===e)?de.filter(t=>t.allergen!==e):[...de,{allergen:e,severity:'allergy'}]}),ce=(0,h.historyLines)(A);return(0,T.jsxs)(f.Sheet,{visible:!0,onClose:b,title:`Edit booking \xb7 ${A.name} \xb7 ${A.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,T.jsx)(n.default,{style:{alignItems:'center'},children:(0,T.jsx)(C.DepositChip,{b:A,money:!0,big:!0,testID:"edit-deposit"})}),(0,h.isWixBooking)(A)?(0,T.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:h.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:h.WIX_EDIT_NOTE})}):null,(0,T.jsx)(f.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,T.jsxs)(E,{title:"Deposit",testID:"edit-section-deposit",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No deposit",selected:!F.depositOn,testID:"edit-deposit-none",onPress:()=>K({depositOn:!1,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit due",selected:!!F.depositOn&&!F.depositPaid,testID:"edit-deposit-due",onPress:()=>K({depositOn:!0,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit paid",selected:!!F.depositOn&&!!F.depositPaid,testID:"edit-deposit-paid",onPress:()=>{U||X(Y),q||J(P((0,y.ymd)(new Date))),K({depositOn:!0,depositPaid:!0})}})]}),F.depositOn?(0,T.jsx)(f.Field,{label:"Deposit due (\xa3)",value:Y,onChangeText:e=>{G(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,F.depositOn&&F.depositPaid?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Amount paid (\xa3)",value:U,onChangeText:e=>{X(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"How was it paid?"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.DEPOSIT_METHODS.map(e=>(0,T.jsx)(f.Chip,{label:N(e),selected:F.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>K({depositMethod:e})},e))}),(0,T.jsx)(f.Field,{label:"Date paid (DD/MM/YYYY)",value:q,onChangeText:e=>{J((0,s.slashDate)(e,q)),K({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),q.trim()&&!$(q)?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,ie?null:(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,T.jsx)(f.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,T.jsxs)(E,{title:"When",testID:"edit-section-when",children:[(0,T.jsx)(D.BookingDatePicker,{r:O,today:new Date,value:F.date,onChange:e=>K({date:e})}),(0,T.jsx)(f.Field,{label:"Time (24-hour, for example 19:15)",value:F.time,onChangeText:e=>K({time:e}),testID:"edit-time"}),Z?null:(0,T.jsx)(f.T,{size:15,colour:j.colours.amber,children:"Write the time like 19:15."}),(0,T.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,T.jsx)(f.T,{size:18,center:!0,children:"Covers"}),(0,T.jsx)(i.PartySizeInput,{value:F.partySize,onChange:e=>K({partySize:e}),label:"Covers",testID:"edit-covers"})]}),(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:"Table time"}),(0,T.jsx)(f.Stepper,{testID:"edit-duration",value:F.duration||0,min:0,max:360,step:15,onChange:e=>K({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,T.jsxs)(E,{title:"Where",testID:"edit-section-where",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"Any area",selected:!F.area,testID:"edit-area-any",onPress:()=>K({area:''})}),R.areas.map(e=>(0,T.jsx)(f.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:F.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>K({area:e.name})},e.id))]}),(0,T.jsx)(f.T,{size:18,weight:"semibold",center:!0,children:(0,x.tableButtonLabel)(F.table)}),(0,T.jsxs)(f.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Button,{kind:F.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(F.table?'':', chosen'),onPress:()=>K({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),se.map(e=>(0,T.jsx)(f.Button,{kind:e===F.table?'primary':'secondary',label:(0,x.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,x.tableButtonLabel)(e)}${e===F.table?', chosen':''}`,onPress:()=>K({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,T.jsxs)(E,{title:"Guest",testID:"edit-section-guest",children:[(0,T.jsx)(f.Field,{label:"Name",value:F.name,onChangeText:e=>K({name:e}),testID:"edit-name"}),m?(0,T.jsx)(f.Muted,{center:!0,children:"Phone and email can be changed in the Managers app. Use Show number on the booking to see the number."}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Phone",value:F.phone,onChangeText:e=>K({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,T.jsx)(f.Field,{label:"Email",value:F.email,onChangeText:e=>K({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Booked by"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.SOURCES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>K({source:e.id})},e.id))}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.TAGS.map(e=>{const t=(F.tags??[]).includes(e);return(0,T.jsx)(f.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>K({tags:t?(F.tags??[]).filter(t=>t!==e):[...F.tags??[],e].sort()})},e)})})]}),(0,T.jsxs)(E,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,T.jsx)(z,{label:"Dogs",value:F.dogs??0,max:6,onChange:e=>K({dogs:e}),testID:"edit-dogs"}),(0,T.jsx)(z,{label:"High chairs",value:F.highChairs??0,max:10,onChange:e=>K({highChairs:e}),testID:"edit-high-chairs"}),(0,T.jsx)(z,{label:"Wheelchair users",value:F.wheelchair??0,max:10,onChange:e=>K({wheelchair:e}),testID:"edit-wheelchair"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Occasion"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.OCCASIONS.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:(F.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>K({occasion:e.id})},e.id||'none'))})]}),(0,T.jsxs)(E,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No allergies",selected:!!F.allergyNone&&!de.length,testID:"edit-allergy-none",onPress:()=>K({allergyNone:!0,allergies:[]})}),u.ALLERGENS.map(e=>(0,T.jsx)(f.Chip,{label:e.short,selected:de.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>re(e.id)},e.id))]}),de.map(e=>(0,T.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,T.jsxs)(f.T,{size:15,center:!0,children:[u.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:u.SEVERITIES.map(t=>(0,T.jsx)(f.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>K({allergies:de.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,T.jsx)(f.Field,{label:"Anything else about allergies",value:F.allergyNote,onChangeText:e=>K({allergyNote:e}),testID:"edit-allergy-note"}),ne.includes('allergies')&&de.length?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,T.jsx)(z,{label:"Vegan",value:F.vegan??0,max:F.partySize,onChange:e=>K({vegan:e}),testID:"edit-vegan"}),(0,T.jsx)(z,{label:"Vegetarian",value:F.vegetarian??0,max:F.partySize,onChange:e=>K({vegetarian:e}),testID:"edit-vegetarian"})]}),'cancelled'!==A.status?(0,T.jsxs)(E,{title:"Status",testID:"edit-section-status",children:[(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.EDIT_STATUSES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>K({status:e.id})},e.id))}),(0,T.jsx)(f.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,T.jsx)(E,{title:"Notes",testID:"edit-section-notes",children:(0,T.jsx)(f.Field,{label:"Notes",value:F.notes,onChangeText:e=>K({notes:e}),placeholder:h.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),M?(0,T.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:[M.map(e=>(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,H?(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:H}):null,(0,T.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,T.jsx)(f.Button,{label:M?'Save anyway':'Save changes',testID:"edit-save",disabled:!Z||!ie||F.name.trim().length<1||!ne.length,onPress:()=>{const t=Z?(0,d.blockAt)(L,e,F.date,Q):void 0,s=(0,h.editWarnings)(A,ae,B,t,le,R);!s.length||M?oe():_(s)},style:{minHeight:56,flex:1}}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:b,style:{minHeight:56}})]}),ce.length?(0,T.jsx)(E,{title:"Changes",testID:"edit-history",children:ce.slice(0,12).map((e,t)=>(0,T.jsx)(f.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,T.jsx)(I.CancelBookingButton,{rid:e,b:A,name:A.name,big:!0,onDone:()=>b()}),(0,T.jsx)(I.ReinstateBookingButton,{b:A,name:A.name,today:(0,y.ymd)(new Date),onDone:()=>b()})]})}},1135,[34,1059,1120,102,874,1025,1022,876,872,1130,861,1003,892,1023,1115,821,858,1124,1112,1133,794,25]); +__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:a,inStaffApp:n,shiftManager:l,big:o,testID:r}){const[d,u]=(0,t.useState)(!1),x=(0,p.useSession)(e=>e.meId),j=(0,b.useOwner)(e=>e.staff.find(e=>e.id===x&&e.active));return s.walkIn||!(0,h.canEditBooking)({variant:c.APP_VARIANT,inStaffApp:n,role:a,shiftManager:l})||x&&!(0,m.canChangeBookings)(j)?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:r??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),d?(0,T.jsx)(B,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:a,hidePrivate:n}){const[o,r]=(0,t.useState)(null),d=(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,T.jsx)(B,{rid:e,id:o,who:i,hidePrivate:n,onClose:a}):(0,T.jsxs)(f.Sheet,{visible:!0,onClose:a,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),d.length?d.map(e=>(0,T.jsx)(f.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${k(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}, ${k(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>r(e.id),style:{minHeight:56}},e.id)):(0,T.jsx)(f.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:a,style:{minHeight:44}})]})},_e.EditBookingSheet=B;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),a=_r(_d[3]),n=(e=a)&&e.__esModule?e:{default:e},l=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),j=_r(_d[15]),y=_r(_d[16]),D=_r(_d[17]),C=_r(_d[18]),I=_r(_d[19]),f=_r(_d[20]),T=_r(_d[21]);const v=/^([01]\d|2[0-3]):[0-5]\d$/,w=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const k=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,y.ymd)(s)?'Tomorrow':$(e)};const S=e=>e?(e/100).toFixed(e%100?2:0):'',P=e=>{const t=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(t)&&t>=0?Math.round(100*t):NaN},$=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',N=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=>e.charAt(0).toUpperCase()+e.slice(1);function z({title:e,children:t,testID:s}){return(0,T.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,T.jsx)(f.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const A=({label:e,value:t,onChange:s,max:i=20,testID:a})=>(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:e}),(0,T.jsx)(f.Stepper,{testID:a,value:t,min:0,max:i,onChange:s,label:e})]});function B({rid:e,id:a,who:p,onClose:b,hidePrivate:m='display'===c.APP_VARIANT}){const k=(0,l.useBookings)(e),B=k.find(e=>e.id===a),O=(0,d.useRestaurant)(e),R=(0,o.usePlan)(e),L=(0,r.useBlocks)(e=>e.blocks),[F,W]=(0,t.useState)(B?(0,h.draftOf)(B):null),[M,_]=(0,t.useState)(null),[H,V]=(0,t.useState)(null),[Y,G]=(0,t.useState)(S(B?(0,h.draftOf)(B).depositDue:0)),[U,X]=(0,t.useState)(S(B?(0,h.draftOf)(B).depositAmount:0)),[q,J]=(0,t.useState)($(B?(0,h.draftOf)(B).depositDate:''));if(!B||!F||!O)return null;const K=e=>{_(null),V(null),W({...F,...e})},Q=w(F.time),Z=v.test(Q),ee=F.area?R.areas.filter(e=>e.name===F.area).map(e=>e.id):null,te=e=>!ee||e.split('+').every(e=>ee.includes(R.tables.find(t=>t.name===e)?.areaId??'')),se=(0,x.tableOptions)(R,k.filter(e=>e.date===F.date),F.table).filter(e=>te(e)||e===F.table),ie=!(F.depositOn&&(Number.isNaN(P(Y||'0'))||F.depositPaid&&(Number.isNaN(P(U||'0'))||q.trim()&&!N(q)))),ae={...F,time:Q,depositDue:P(Y||'0')||0,depositAmount:P(U||'0')||0,depositDate:N(q)},ne=(0,h.changedFields)(B,ae),le=O.settings.turnMins??90,oe=async()=>{const t=(0,h.editPatch)(B,ae,{by:p||'Team member',app:c.APP_VARIANT});if(Object.keys(t).length&&await l.repo.bookings.update(B.id,t),'seated'===B.status&&'table'in t&&t.table!==B.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(B.table),a=s(t.table),n=o.useFloor.getState(),l=i.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!a.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),a.forEach(t=>n.setLive(e,t,{stage:l,dirty:!1}))}V(`Saved. Changed: ${(0,h.editedWords)(ne)}.`),_(null),b()},re=F.allergies??[],de=e=>K({allergyNone:!1,allergies:re.some(t=>t.allergen===e)?re.filter(t=>t.allergen!==e):[...re,{allergen:e,severity:'allergy'}]}),ce=(0,h.historyLines)(B);return(0,T.jsxs)(f.Sheet,{visible:!0,onClose:b,title:`Edit booking \xb7 ${B.name} \xb7 ${B.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,T.jsx)(n.default,{style:{alignItems:'center'},children:(0,T.jsx)(C.DepositChip,{b:B,money:!0,big:!0,testID:"edit-deposit"})}),(0,h.isWixBooking)(B)?(0,T.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:h.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:h.WIX_EDIT_NOTE})}):null,(0,T.jsx)(f.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,T.jsxs)(z,{title:"Deposit",testID:"edit-section-deposit",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No deposit",selected:!F.depositOn,testID:"edit-deposit-none",onPress:()=>K({depositOn:!1,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit due",selected:!!F.depositOn&&!F.depositPaid,testID:"edit-deposit-due",onPress:()=>K({depositOn:!0,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit paid",selected:!!F.depositOn&&!!F.depositPaid,testID:"edit-deposit-paid",onPress:()=>{U||X(Y),q||J($((0,y.ymd)(new Date))),K({depositOn:!0,depositPaid:!0})}})]}),F.depositOn?(0,T.jsx)(f.Field,{label:"Deposit due (\xa3)",value:Y,onChangeText:e=>{G(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,F.depositOn&&F.depositPaid?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Amount paid (\xa3)",value:U,onChangeText:e=>{X(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"How was it paid?"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.DEPOSIT_METHODS.map(e=>(0,T.jsx)(f.Chip,{label:E(e),selected:F.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>K({depositMethod:e})},e))}),(0,T.jsx)(f.Field,{label:"Date paid (DD/MM/YYYY)",value:q,onChangeText:e=>{J((0,s.slashDate)(e,q)),K({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),q.trim()&&!N(q)?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,ie?null:(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,T.jsx)(f.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,T.jsxs)(z,{title:"When",testID:"edit-section-when",children:[(0,T.jsx)(D.BookingDatePicker,{r:O,today:new Date,value:F.date,onChange:e=>K({date:e})}),(0,T.jsx)(f.Field,{label:"Time (24-hour, for example 19:15)",value:F.time,onChangeText:e=>K({time:e}),testID:"edit-time"}),Z?null:(0,T.jsx)(f.T,{size:15,colour:j.colours.amber,children:"Write the time like 19:15."}),(0,T.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,T.jsx)(f.T,{size:18,center:!0,children:"Covers"}),(0,T.jsx)(i.PartySizeInput,{value:F.partySize,onChange:e=>K({partySize:e}),label:"Covers",testID:"edit-covers"})]}),(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:"Table time"}),(0,T.jsx)(f.Stepper,{testID:"edit-duration",value:F.duration||0,min:0,max:360,step:15,onChange:e=>K({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,T.jsxs)(z,{title:"Where",testID:"edit-section-where",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"Any area",selected:!F.area,testID:"edit-area-any",onPress:()=>K({area:''})}),R.areas.map(e=>(0,T.jsx)(f.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:F.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>K({area:e.name})},e.id))]}),(0,T.jsx)(f.T,{size:18,weight:"semibold",center:!0,children:(0,x.tableButtonLabel)(F.table)}),(0,T.jsxs)(f.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Button,{kind:F.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(F.table?'':', chosen'),onPress:()=>K({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),se.map(e=>(0,T.jsx)(f.Button,{kind:e===F.table?'primary':'secondary',label:(0,x.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,x.tableButtonLabel)(e)}${e===F.table?', chosen':''}`,onPress:()=>K({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,T.jsxs)(z,{title:"Guest",testID:"edit-section-guest",children:[(0,T.jsx)(f.Field,{label:"Name",value:F.name,onChangeText:e=>K({name:e}),testID:"edit-name"}),m?(0,T.jsx)(f.Muted,{center:!0,children:"Phone and email can be changed in the Managers app. Use Show number on the booking to see the number."}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Phone",value:F.phone,onChangeText:e=>K({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,T.jsx)(f.Field,{label:"Email",value:F.email,onChangeText:e=>K({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Booked by"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.SOURCES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>K({source:e.id})},e.id))}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.TAGS.map(e=>{const t=(F.tags??[]).includes(e);return(0,T.jsx)(f.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>K({tags:t?(F.tags??[]).filter(t=>t!==e):[...F.tags??[],e].sort()})},e)})})]}),(0,T.jsxs)(z,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,T.jsx)(A,{label:"Dogs",value:F.dogs??0,max:6,onChange:e=>K({dogs:e}),testID:"edit-dogs"}),(0,T.jsx)(A,{label:"High chairs",value:F.highChairs??0,max:10,onChange:e=>K({highChairs:e}),testID:"edit-high-chairs"}),(0,T.jsx)(A,{label:"Wheelchair users",value:F.wheelchair??0,max:10,onChange:e=>K({wheelchair:e}),testID:"edit-wheelchair"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Occasion"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.OCCASIONS.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:(F.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>K({occasion:e.id})},e.id||'none'))})]}),(0,T.jsxs)(z,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No allergies",selected:!!F.allergyNone&&!re.length,testID:"edit-allergy-none",onPress:()=>K({allergyNone:!0,allergies:[]})}),u.ALLERGENS.map(e=>(0,T.jsx)(f.Chip,{label:e.short,selected:re.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>de(e.id)},e.id))]}),re.map(e=>(0,T.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,T.jsxs)(f.T,{size:15,center:!0,children:[u.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:u.SEVERITIES.map(t=>(0,T.jsx)(f.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>K({allergies:re.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,T.jsx)(f.Field,{label:"Anything else about allergies",value:F.allergyNote,onChangeText:e=>K({allergyNote:e}),testID:"edit-allergy-note"}),ne.includes('allergies')&&re.length?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,T.jsx)(A,{label:"Vegan",value:F.vegan??0,max:F.partySize,onChange:e=>K({vegan:e}),testID:"edit-vegan"}),(0,T.jsx)(A,{label:"Vegetarian",value:F.vegetarian??0,max:F.partySize,onChange:e=>K({vegetarian:e}),testID:"edit-vegetarian"})]}),'cancelled'!==B.status?(0,T.jsxs)(z,{title:"Status",testID:"edit-section-status",children:[(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.EDIT_STATUSES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>K({status:e.id})},e.id))}),(0,T.jsx)(f.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,T.jsx)(z,{title:"Notes",testID:"edit-section-notes",children:(0,T.jsx)(f.Field,{label:"Notes",value:F.notes,onChangeText:e=>K({notes:e}),placeholder:h.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),M?(0,T.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:[M.map(e=>(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,H?(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:H}):null,(0,T.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,T.jsx)(f.Button,{label:M?'Save anyway':'Save changes',testID:"edit-save",disabled:!Z||!ie||F.name.trim().length<1||!ne.length,onPress:()=>{const t=Z?(0,r.blockAt)(L,e,F.date,Q):void 0,s=(0,h.editWarnings)(B,ae,k,t,le,R);!s.length||M?oe():_(s)},style:{minHeight:56,flex:1}}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:b,style:{minHeight:56}})]}),ce.length?(0,T.jsx)(z,{title:"Changes",testID:"edit-history",children:ce.slice(0,12).map((e,t)=>(0,T.jsx)(f.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,T.jsx)(I.CancelBookingButton,{rid:e,b:B,name:B.name,big:!0,onDone:()=>b()}),(0,T.jsx)(I.ReinstateBookingButton,{b:B,name:B.name,today:(0,y.ymd)(new Date),onDone:()=>b()})]})}},1135,[34,1059,1120,102,874,1025,1022,876,872,1130,861,1003,892,1023,1115,821,858,1124,1112,1133,794,25]); __d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceSlot",{enumerable:!0,get:function(){return w}}),_e.voiceAppFor=h,_e.useVoiceTarget=p,_e.VoiceSlot=function({size:e=56,layer:t=0}){const u=p(),c=(0,n.useRef)(null),l=(0,n.useRef)(y++).current,{width:f,height:h,fontScale:v}=(0,o.default)(),A=()=>{if(t{if(c.current!==e||!s||tu+.5?w.getState().owner===l&&w.setState({rect:null,owner:0}):w.setState({rect:{x:n,y:o,size:s},owner:l})})},W=(0,n.useRef)(A);return W.current=A,(0,n.useLayoutEffect)(()=>{if(u?.on)return S.set(l,{layer:t,measure:()=>W.current()}),()=>{S.delete(l),w.getState().owner===l&&w.setState({rect:null,owner:0}),requestAnimationFrame(b)}},[u?.on,t]),(0,n.useLayoutEffect)(()=>{A();const e=requestAnimationFrame(A);return()=>cancelAnimationFrame(e)},[f,h,v,u?.on]),(0,n.useEffect)(()=>{const e=c.current;if(!u?.on||'undefined'==typeof ResizeObserver||!e?.parentElement)return;const t=new ResizeObserver(A);return t.observe(e.parentElement),e.parentElement.parentElement&&t.observe(e.parentElement.parentElement),()=>t.disconnect()},[u?.on]),(0,n.useEffect)(()=>()=>{w.getState().owner===l&&w.setState({rect:null,owner:0})},[]),(0,n.useEffect)(()=>{u?.on||w.getState().owner!==l||w.setState({rect:null,owner:0})},[u?.on]),u?.on?(0,m.jsx)(s.default,{ref:c,testID:"voice-slot",onLayout:A,style:{width:e,height:e,flexShrink:0}}):null};var t=r(d[0]),n=r(d[1]),o=e(r(d[2])),s=e(r(d[3])),u=r(d[4]),c=r(d[5]),l=r(d[6]),f=r(d[7]),m=r(d[8]);const w=(0,u.create)(()=>({rect:null,owner:0}));function h(e){return'customer'===c.APP_VARIANT||/^\/(customer|table|demo)/.test(e)?null:e.startsWith('/owner')||e.startsWith('/admin')?'owner':e.startsWith('/team')?'staff':e.startsWith('/kitchen')?'chef':e.startsWith('/display')?'display':null}function p(){const e=(0,t.usePathname)()||'/',n=(0,l.useCtx)(6e4),o=(0,f.useVoiceSettings)(e=>e.enabled),s=h(e);if(!s)return null;const u='owner'===s?'owner'===n.role?'owner':'manager'===n.role?'manager':'staff':s;return{app:s,role:u,actions:'staff'===u?'staff':s,on:(0,f.voiceOn)(o,n.rid,u)}}let y=1;const S=new Map,E=()=>{let e=-1;return S.forEach(t=>{t.layer>e&&(e=t.layer)}),e};function b(){const e=E();S.forEach(t=>{t.layer===e&&t.measure()})}},1136,[30,34,426,102,846,872,1084,1137,25]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_ROLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"VOICE_ROLE_LABEL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useVoiceSettings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"voiceOn",{enumerable:!0,get:function(){return f}}),_e.micExplainedFor=function(e){try{if('1'===b()?.getItem(s(e)))return!0}catch{}return u.getState().micExplained},_e.setMicExplainedFor=function(e){try{b()?.setItem(s(e),'1')}catch{}u.getState().setMicExplained(!0)};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},c=r(d[1]),l=r(d[2]);const o=['owner','manager','staff','chef','display'],p={owner:'Owner (Managers app)',manager:'Managers (Managers app)',staff:'Staff app (full voice assistant, no money or HR)',chef:'Head Chef app',display:'Main Display'},u=(0,c.create)()((0,l.persist)(e=>({enabled:{},micExplained:!1,setEnabled:(n,t,c)=>e(e=>({enabled:{...e.enabled,[n]:{...e.enabled[n]??{},[t]:c}}})),setMicExplained:n=>e({micExplained:n})}),{name:'covercharge-voice-v1',version:4,storage:(0,l.createJSONStorage)(()=>t.default),migrate:(e,n)=>({enabled:n<2?{}:e?.enabled??{},micExplained:!!e?.micExplained}),merge:(e,n)=>({...n,enabled:e?.enabled??n.enabled,micExplained:e?.micExplained??n.micExplained}),partialize:e=>({enabled:e.enabled,micExplained:e.micExplained})})),f=(e,n,t)=>!1!==e[n]?.[t],s=e=>`cc-voice-mic-explained-${e}`,b=()=>{try{return'undefined'!=typeof window?window.localStorage:void 0}catch{return}}},1137,[839,846,849]); __d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VAT",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return n}}),e.dishCost=i,Object.defineProperty(e,"gpPct",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"priceForTarget",{enumerable:!0,get:function(){return c}}),e.costings=function(r,c,s,u){const d=(0,t.dishStats)(r);return c.map(t=>{const c=r.find(r=>r.id===t.dishId);if(!c||null==c.price)return null;const p=i(t,s),l=n(c.price),f=o(p,c.price),b=d.find(t=>t.item.id===c.id)?.sold??0;return{item:c,recipe:t,cost:p,priceInc:c.price,priceEx:l,gp:f,cashGp:l-p,below:ft.prevCost&&t.prevCost!==t.cost).map(s=>{const u=(s.cost-(s.prevCost??s.cost))/(s.prevCost??1)*100,d=r.filter(t=>t.lines.some(t=>t.ing===s.id)).map(r=>{const u=t.find(t=>t.id===r.dishId);if(!u||null==u.price)return null;const d=o(i(r,n,{ing:s.id,cost:s.prevCost}),u.price),p=o(i(r,n),u.price);return{item:u,before:d,after:p,dropped:d>=c&&pt.dropped),below:d.filter(t=>t.below)}})},e.weekGp=function(t,r,n){const i=t.reduce((t,r)=>t+r.priceEx*r.soldWeek,0),o=t.reduce((t,r)=>t+r.cost*r.soldWeek,0),c=o+r+Math.max(0,n);return{sales:i,theoCost:o,actualCost:c,theo:i?(i-o)/i*100:0,actual:i?(i-c)/i*100:0}},Object.defineProperty(e,"fmtQty",{enumerable:!0,get:function(){return s}});var t=_r(_d[0]);const r=.2,n=t=>Math.round(t/1.2);function i(t,r,n){return Math.round(t.lines.reduce((t,i)=>{const o=r.find(t=>t.id===i.ing);return t+(n&&n.ing===i.ing?n.cost:o?.cost??0)*i.qty},0))}const o=(t,r)=>{const i=n(r);return i>0?(i-t)/i*100:0},c=(t,r)=>50*Math.ceil(t/(1-r/100)*1.2/50);const s=(t,r)=>`${Number.isInteger(t)?t:t.toFixed(t<1?3:2).replace(/0+$/,'').replace(/\.$/,'')} ${'each'===r?'':r}`.trim()},1138,[1139]); @@ -1395,7 +1395,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}},1312,[827,860,34,102,794,861,867,1154,1313,874,821,25]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1313,[934,988,1154]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1314,[30,34,872,1315,1379,25]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ge}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:b,headerExtra:K,subHeader:He,noVoice:Pe=!1}={}){const Ue=(0,N.default)(),Je=b??Ue.width,Xe=Ue.height,Ze=Je<700,et=Je>=Xe,tt=!Ze&&et&&Je>=600,lt=tt,st=Math.round(Math.min(520,Math.max(Je>=1e3?448:280,.3*Je))),it=$.default.useRef(null),ot=$.default.useRef(0),[nt,at]=(0,T.useState)({w:0,h:0}),rt=(0,X.useOwner)(e=>e.site),dt=(0,Y.useRestaurant)(rt);(0,Ie.useAlertWatcher)(rt,{enabled:!e});const ct=(0,Y.useOrders)(rt),ut=(0,Y.useBookings)(rt),ht=(0,Y.useEvents)(rt),gt=(0,Y.useStore)(e=>e.skipMinutes),bt=(0,Y.useStore)(e=>e.clock.mode),yt=(0,Y.useNow)(5e3),pt=(0,X.useOwner)(e=>e.staff),ft=(0,X.useOwner)(e=>e.attendance),xt=(0,X.useOwner)(e=>e.shifts);$.default.useEffect(()=>{(0,ee.ensureAttendance)((0,q.ymd)(yt),yt)},[(0,q.ymd)(yt)]);const mt=ft.filter(e=>e.in&&!e.out&&yt.getTime()-new Date(e.in).getTime()<72e6&&yt.getTime()>=new Date(e.in).getTime()),jt=Ve(pt.find(e=>e.id===mt[0]?.staffId)?.name)||'Duty Manager',wt=k.IS_CAR?'Car':'Display';(0,v.useSoldOutLink)(!1,e?void 0:wt,!0);const kt=(0,q.ymd)(yt),It=(0,R.useTravelDay)('display',kt),Dt=(0,Z.useFrontDoor)(kt,et),vt=(0,te.useDisplaySettings)(rt),St=vt.privacy,Ct=(0,ce.useSaverSync)(),Tt=(0,te.usePlan)(rt),$t=(0,te.useFloor)(e=>e.live[rt]),Bt=(0,De.useBlocks)(e=>e.blocks),[Rt,Lt]=(0,T.useState)('plan'),[Wt,zt]=(0,T.useState)(!1),[Mt,Ht]=(0,T.useState)('all'),[Pt,Et]=(0,T.useState)(null),[Ot,At]=(0,T.useState)(null),[Nt,_t]=(0,T.useState)(null),[Gt,Vt]=(0,T.useState)(!1),[Ft,Ut]=(0,T.useState)(!1),[Kt,qt]=(0,T.useState)(null),[Yt,Qt]=(0,T.useState)(!1),[Jt,Xt]=(0,T.useState)(!1),[Zt,el]=(0,T.useState)(null),[tl,ll]=(0,T.useState)(null),[sl,il]=(0,T.useState)(null),ol=$.default.useRef(0),nl=e=>{ol.current=Date.now(),il(e)};$.default.useEffect(()=>{if(!sl)return;const e=setInterval(()=>{Date.now()-ol.current>=Te.DAY_IDLE_MS&&il(null)},5e3);return()=>clearInterval(e)},[sl]);const al=(0,Y.useWaitlist)(rt),rl=(0,Y.useStore)(e=>e.walkIns[rt]??0),[dl,cl]=(0,T.useState)(!1),[ul,hl]=(0,T.useState)(!1),[gl,bl]=(0,T.useState)(!1);(0,F.useReviewAlerts)(rt);const[yl,pl]=(0,T.useState)({view:0,content:0}),[fl,xl]=(0,T.useState)(null);$.default.useEffect(()=>{fl&&((0,S.notify)({id:`floor-note:${Date.now()}`,title:fl,timeoutMs:4500,big:!0,testID:'floor-toast'}),xl(null))},[fl]),$.default.useEffect(()=>{if(!e)return(0,L.setDisplaySilent)(!0),()=>(0,L.setDisplaySilent)(!1)},[e]);const[ml,jl]=(0,T.useState)(null),wl=$.default.useRef(0),[kl,Il]=(0,T.useState)(null);$.default.useEffect(()=>{if(!ml)return;wl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-wl.current;if(e>=Ge)return jl(null),void xl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Il(e>=105e3?Math.ceil((Ge-e)/1e3):null)},1e3);return()=>clearInterval(e)},[ml]);const Dl=e=>e.date!==kt?_t({title:`Guest details \xb7 ${(0,Te.dayWord)(e.date,kt)} ${e.time}`,body:(0,Ae.jsx)(Ae.Fragment,{children:(0,me.bookingDetails)(e)})}):_t({title:`Guest details \xb7 ${e.time}`,body:(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(Qe,{rid:rt,id:e.id,turnBase:dt.settings.turnMins}),e.walkIn?null:(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ae.jsx)(ye.CancelWalkInButton,{rid:rt,b:e,big:!0,onDone:e=>{_t(null),xl(e)}}):null,e.walkIn?(0,Ae.jsx)(ye.ReinstateWalkInButton,{rid:rt,b:e,today:kt,onDone:e=>{_t(null),xl(e)}}):null,(0,me.bookingDetails)(e)]})}),vl=ut.filter(e=>e.date===kt).sort((e,t)=>e.time.localeCompare(t.time)),Sl=vl.filter(e=>!['cancelled','noshow'].includes(e.status)),Cl=ct.filter(Fe).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Tl=(0,T.useMemo)(()=>(0,c.forecastToday)(dt,ut,ct,ht,yt),[dt,ut,ct,ht,yt.getTime()/6e4|0]),$l=(0,De.closedAreasAt)(Bt,rt,kt,(0,q.hm)(yt)),Bl=[...$l].join(','),Rl=(0,T.useMemo)(()=>(0,le.floorView)(Tt,ut,ct,$t??{},yt,dt.settings.turnMins,$l),[Tt,ut,ct,$t,yt.getTime(),Bl]),Ll=(0,xe.hoursFor)(dt,yt),Wl=Ll?.open??new Date(`${kt}T12:00:00`),zl=Ll?.close??new Date(`${kt}T21:00:00`),Ml=(0,q.addMins)(Wl,-Wl.getMinutes()),Hl=(0,q.addMins)(zl,30),Pl=e=>new Date(`${kt}T${e}:00`),El=(0,De.blocksOn)(Bt,rt,kt).map(e=>({from:Pl(e.from),to:Pl(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(dt,yt,kt)),Ol=Object.keys(Rl).filter(e=>'blocked'===Rl[e]?.status),Al=sl&&sl!==kt?sl:kt,Nl=Al!==kt,_l=(0,Te.dayWord)(Al,kt),Gl=/^(Today|Yesterday|Tomorrow)$/.test(_l),Vl=Nl?(0,Te.bookingsForDay)(ut,Al,kt).sort((e,t)=>e.time.localeCompare(t.time)):vl,Fl=(0,q.parseYmd)(Al);Fl.setHours(12);const Ul=Nl?(0,xe.hoursFor)(dt,Fl):Ll,Kl=Ul?.open??new Date(`${Al}T12:00:00`),ql=Ul?.close??new Date(`${Al}T21:00:00`),Yl=e=>new Date(`${Al}T${e}:00`),Ql=[...Nl?(0,De.blocksOn)(Bt,rt,Al).map(e=>({from:Yl(e.from),to:Yl(e.to),label:e.reason??'Paused'})):El,...Nl?(0,o.queuedServicePauses)(dt,Fl,Al):[]],Jl=(0,o.queuedServiceSessions)(dt,Fl),Xl=s.IS_QUEUED_VENUE&&(void 0===Jl||!Jl.length),Zl=(0,Ae.jsxs)(A.default,{testID:"queued-hours-gate",style:[We.look.panel,{padding:14,gap:8}],children:[(0,Ae.jsx)(G.T,{weight:"semibold",children:void 0===Jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ae.jsx)(G.Muted,{children:i.queuedVenues[rt]?.hours.note})]}),es=Nl?Ul||Vl.length?AlNl?(0,le.dayFloorView)(Tt,Vl,Al):Rl,[Nl,Tt,Vl,Al,Rl]),[ls,ss]=(0,T.useState)(null),is=Nl?Vl.filter(e=>!['cancelled','noshow'].includes(e.status)):Sl,os=is.reduce((e,t)=>e+t.partySize,0),ns=(0,u.coversSplit)(is,Al),as=(0,$e.cancelledDayTally)(ut,Al),rs=(0,Be.cancellationsFor)(ut,Al,e=>e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)','')),ds=(0,$e.cancelledTallyWords)(as,Gl?_l.toLowerCase():Nl?`on ${_l}`:'today'),cs=Bt.filter(e=>e.rid===rt&&e.date===Al&&!e.removedAt),us=(0,Ce.chartBands)(cs,60*Kl.getHours()+Kl.getMinutes(),60*ql.getHours()+ql.getMinutes()),hs=new Set((0,Ce.blockedHours)(us)),gs=yt.getHours()+(yt.getMinutes()>=30?1:0),bs=Tl.hours.filter(e=>e.hour>=gs&&!hs.has(e.hour)),ys=bs.reduce((e,t)=>e+t.coversHigh,0),ps=bs.reduce((e,t)=>e+t.coversLow,0),fs=Math.round((ps+ys)/2),xs=!Tl.example&&Tl.open&&Tl.enough&&ys>0?`Usually ${(0,c.coversRange)(fs,fs)} more`:void 0,ms=async(e,t)=>{const l=Rl[e]?.booking;if(!l||e===t)return;const s=Rl[t]?.status;if(s&&!['free','soon'].includes(s))return void xl('dirty'===s?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${le.STATUS[s].label.toLowerCase()}. Pick a free table.`);await Y.repo.bookings.update(l.id,{table:t});const i=$t?.[e]?.stage;te.useFloor.getState().setLive(rt,t,{stage:i??'seated',dirty:!1}),te.useFloor.getState().setLive(rt,e,{stage:void 0,dirty:!0}),xl(`${(0,ue.privName)(l,St)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`)},js=tl?ut.find(e=>e.id===tl.id):void 0,ws=tl&&js?(()=>{const e=js.walkIn?(0,ue.privName)(js,St):Ve(js.name),t=(0,fe.seatsOf)(Tt,tl.tables).total,l=(0,fe.seatLine)(t,js.partySize),s=(0,fe.pickClashes)(js,tl.tables,ut.filter(e=>e.date===js.date),dt.settings.turnMins),i=(0,fe.tableKey)(tl.tables)!==(0,fe.tableKey)((0,te.tablesOf)(js.table));return(0,Ae.jsxs)(A.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:Q.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:Q.colours.gold,padding:10},children:[(0,Ae.jsxs)(A.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Te.dayWord)(js.date,kt)} ${js.time}. Tap tables on the plan to add or take them off. ${(0,fe.tablesWords)(tl.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,Ae.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Te.dayWord)(js.date,kt)," ",js.time]}),(0,Ae.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[(0,fe.tablesWords)(tl.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,Ae.jsxs)(G.Row,{gap:8,wrap:!0,children:[(0,Ae.jsx)(G.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,fe.tablesWords)(tl.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(js){try{await(0,pe.saveBookingTables)(rt,js,tl.tables),xl((0,fe.savedWords)(e,js.partySize,tl.tables,t))}catch(t){xl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}ll(null)}else ll(null)}}),(0,Ae.jsx)(G.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>ll(null)})]})]})})():null,ks=Tt.areas.filter(e=>Tt.tables.some(t=>t.areaId===e.id)),Is=e=>{const t=Tt.tables.filter(t=>t.areaId===e);return Nl?`${t.filter(e=>!ts[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Rl[e.name]?.status??'free')).length}/${t.length} free`},Ds='all'===Mt||ks.some(e=>e.id===Mt)?Mt:'all',vs=e=>(0,Ae.jsx)(se.FloorCanvas,{plan:Tt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:tt,big:!0,view:ts,privacy:St,turnBase:dt.settings.turnMins,highlight:tl?tl.tables:Ot?[Ot]:void 0,onTap:e=>{return t=e.name,void(tl?ll(e=>e?{...e,tables:(0,fe.toggleTable)(e.tables,t)}:e):Nl?ss(t):Ot?(t!==Ot&&ms(Ot,t),At(null)):Et(t));var t},onDrop:(e,t)=>tl||Nl?void 0:ms(e.name,t.name)}),Ss=Ze?1:et||ks.length>2?2:1,Cs=e=>{const t=Tt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},Ts=[];for(let e=0;e{const t=(0,se.areaBounds)(Tt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,se.minReadableScale)(Tt,e.id)}}),nt.w,nt.h):null,Bs=e=>(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between',height:ie.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,children:Is(e.id)})]}),Rs=(0,Ae.jsx)(A.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-nt.w)>1||Math.abs(l-nt.h)>1)&&at({w:t,h:l})},children:$s?(0,Ae.jsx)(O.default,{style:{flex:1},scrollEnabled:$s.scroll,showsVerticalScrollIndicator:$s.scroll,contentContainerStyle:{gap:ie.GRID_GAP},children:$s.rows.map((e,t)=>(0,Ae.jsx)(A.default,{style:{height:$s.rowHeights[t],flexDirection:'row',gap:ie.GRID_GAP},children:e.map(e=>{const t=ks.find(t=>t.id===e);return(0,Ae.jsxs)(A.default,{testID:`area-cell-${e}`,style:{width:$s.cellW,gap:2},children:[Bs(t),(0,Ae.jsx)(A.default,{style:{flex:1},children:vs(e)})]},e)})},t))}):null}),Ls=(0,Ae.jsxs)(A.default,{testID:"venue-plan",style:{flex:Ze?void 0:1,gap:10,minWidth:0},children:[(0,Ae.jsx)(r.TableNumberWarning,{plan:Tt}),Tt.tables.length?null:(0,Ae.jsxs)(A.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ae.jsx)(G.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ae.jsx)(G.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS?(0,Ae.jsx)(G.Muted,{center:!0,testID:"display-venue-hours",children:(s.IS_WILDINGS?a.WILDINGS_GUIDE:s.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ae.jsx)(qe,{chipId:"all",compact:!Ze,label:"Whole venue",selected:'all'===Ds,onPress:()=>Ht('all')},"__all"),...ks.map(e=>(0,Ae.jsx)(qe,{chipId:e.id,compact:!Ze,label:`${e.name}${(0,oe.areaMarks)(e)}`,colour:(0,Q.brandColour)(e.colour),sub:Ze?$l.has(e.id)?'closed':Ds===e.id?Is(e.id):void 0:void 0,selected:Ds===e.id,onPress:()=>Ht(e.id)},e.id))];return Ze?(0,Ae.jsx)(A.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ae.jsx)(O.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;pl(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>pl(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:yl.view>0&&yl.content>0&&yl.content<=yl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:yl.view>0&&yl.content<=yl.view+1?'100%':void 0},children:e})})(),(0,Ae.jsx)(g.FloorLegend,{}),ws,Ot?(0,Ae.jsxs)(G.Row,{gap:8,style:{backgroundColor:Q.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ae.jsxs)(G.T,{weight:"semibold",colour:Q.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Ot),": tap the new table."]}),(0,Ae.jsx)(G.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>At(null)})]}):null,'all'===Ds&&tt?Rs:'all'===Ds?(0,Ae.jsx)(A.default,{style:{flex:Ze?void 0:1,gap:12,minHeight:lt?void 0:360},children:Ts.map((e,t)=>(0,Ae.jsxs)(A.default,{style:{flex:Ze?void 0:Math.max(.3,...e.map(e=>Cs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ae.jsxs)(A.default,{style:{flex:1,gap:2},children:[Ze?(0,Ae.jsxs)(A.default,{style:{alignItems:'center',gap:4},children:[(0,Ae.jsxs)(G.T,{center:!0,size:18,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{center:!0,size:14,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.Muted,{center:!0,children:Is(e.id)})]}):(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.Muted,{children:Is(e.id)})]}),(0,Ae.jsx)(A.default,{style:Ze?{height:Math.max(280,Math.round((Je-40)*Cs(e.id)))}:{flex:1},children:vs(e.id)})]},e.id)),e.length{if(Nl)return void el(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rl[t]?Et(t):Dl(e)}},Al)}),zs='timeline'===Rt,Ms=Wt?(0,Ae.jsx)(H.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>zt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ae.jsxs)(A.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:Q.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ae.jsx)(E.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>zt(!1),style:{minHeight:64,minWidth:Je<600?120:180,paddingHorizontal:Je<600?14:22,borderRadius:16,borderWidth:2,borderColor:Q.colours.goldLight,backgroundColor:Q.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(G.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ae.jsx)(A.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ae.jsx)(G.T,{size:22,weight:"semibold",colour:Q.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${Nl?(0,Te.dayLong)(Al):'Today'}`})}),Je<600?null:(0,Ae.jsx)(A.default,{style:{minWidth:180}})]}),Xl?Zl:(0,Ae.jsx)(A.default,{style:{flex:1,minHeight:0},children:(0,Ae.jsx)(re.Timeline,{hideNow:!0,fit:!0,plan:Tt,bookings:Nl?Vl:vl,now:Nl?Kl:yt,privacy:St,turnBase:dt.settings.turnMins,t0:Nl?(0,q.addMins)(Kl,-Kl.getMinutes()):Ml,t1:Nl?(0,q.addMins)(ql,30):Hl,pauses:Nl?Ql:El,blockedTables:Nl?[]:Ol,onOpen:e=>{if(zt(!1),Nl)return void el(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rl[t]?Et(t):Dl(e)}},`full-${Al}`)})]})}):null,Hs=Nl?(0,Ae.jsxs)(A.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:Q.colours.gold,backgroundColor:Q.colours.goldTint},children:[(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:Gl?`Showing ${_l} \xb7 ${(0,q.niceDate)((0,q.parseYmd)(Al))}`:`Showing ${(0,Te.dayWord)(Al,kt)}`}),(0,Ae.jsx)(A.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${ds}. Showing ${(0,Te.dayLong)(Al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ae.jsx)(G.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ll(null),nl(null)},style:{minHeight:44}})]}):null,Ps=(0,Ae.jsx)(A.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:Ze?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,l])=>{const i='timeline'===e===(zs||Wt);return(0,Ae.jsx)(E.default,{testID:l,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Lt('plan'),zt(!0)):(zt(!1),Lt('plan'))},style:{flex:Ze?1:void 0,minHeight:Ze?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?Q.colours.gold:'transparent',...We.look.web(i?{backgroundImage:s.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:s.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Ae.jsx)(G.T,{size:Ze?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Es='display'!==k.APP_VARIANT||e?Ps:(0,Ae.jsxs)(A.default,{testID:"display-view-row",style:{flexDirection:Ze?'column':'row',flexWrap:Ze?'nowrap':'wrap',gap:6,alignItems:Ze?'stretch':'center'},children:[Ps,(0,Ae.jsx)(w.DisplayRotaKitchenButtons,{phone:Ze,shifts:xt,staff:pt,today:kt})]}),Os=(0,h.useBookingWrite)(),As=e=>(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"Walk-in",onPress:Dt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint}),(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"New booking",onPress:Dt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint}),(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Ut(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint})]});(0,Oe.useDisplayNotices)(rt,!e);const Ns=Ze?180:168,[_s,Gs]=(0,T.useState)(Ns),Vs=$.default.useRef(Ns),Fs=$.default.useRef(null),Us=$.default.useRef(null),Ks=()=>{const e=Fs.current,t=Us.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Xe<820?8:12,o=44+(Xe<820?4:8),n=i>Vs.current?Math.ceil(i-Vs.current):Se.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Ns,Math.floor(t-s-l)-n-o));Math.abs(Vs.current-a)>=2&&(Vs.current=a,Gs(a))})})};$.default.useEffect(()=>{const e=setTimeout(Ks,60);return()=>clearTimeout(e)},[Je,Xe]);const qs=(0,Ae.jsxs)(A.default,{ref:Us,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ks()},style:{flexDirection:'row',flexWrap:Je>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ze?12:6,justifyContent:Ze?'center':void 0,borderTopWidth:1,borderTopColor:Q.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ae.jsx)(Ee.DisplayClockButton,{}),(0,Ae.jsx)(ae.HoldToEdit,{quiet:!0,onUnlock:()=>{Il(null),jl({at:Date.now()})},onHint:()=>xl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ae.jsx)(ve.BlockBookingsButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,display:!0,day:Al}),Tt.areas.some(e=>e.outdoor)?(0,Ae.jsx)(ve.CloseGardenButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,short:!0}):null,(0,Ae.jsx)(E.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>bl(!0),style:({pressed:e})=>({...We.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR?null:(0,Ae.jsx)(f.GiftQrButton,{rid:rt,venue:dt.name})]}),Ys=Cl.length?(0,Ae.jsxs)(A.default,{testID:"takeaway-panel",style:[We.look.panel,{overflow:'hidden'}],children:[(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ae.jsx)(G.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ae.jsxs)(G.T,{size:12,colour:Q.colours.muted,children:[Cl.length," live"]})]}),(0,Ae.jsx)(A.default,{style:{padding:10},children:(0,Ae.jsx)(Ye,{list:Cl,me:jt,compact:!0,bookings:ut})})]}):null,Qs=(Le.DueToday,Nl?Vl:vl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Js=Nl?Gl?`${_l}\u2019s guests`:`Guests ${_l}`:'Today\u2019s guests',Xs=(0,Ae.jsxs)(Ae.Fragment,{children:[0===Qs.length?(0,Ae.jsx)(G.Muted,{children:Nl?Al{const t=(0,J.isSeatedHighlight)(e.status,{otherDay:Nl}),l=(0,he.guestRowText)(e,{name:e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)',''),seated:t}),s=Q.colours.text,i=t?Q.colours.goldLight:Q.colours.muted,o=Q.colours.gold,n=l.depositWarn?Q.colours.amber:Q.colours.goldLight;return(0,Ae.jsxs)(E.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Nl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Xt(!1),el(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,J.seatedHighlightStyle)({backgroundColor:e?_e:Ne,borderColor:Q.colours.gold,borderLeftColor:Q.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:Q.colours.hairline,backgroundColor:e?Q.colours.tilePressed:'transparent'},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ae.jsx)(G.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Ae.jsx)(G.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Ae.jsx)(A.default,{style:{paddingTop:2},children:(0,Ae.jsx)(M.AllergyIcon,{text:l.allergy,size:22,colour:Q.colours.amber,ink:Q.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Ae.jsxs)(G.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ae.jsx)(G.T,{size:16,colour:s,children:l.people}),l.deposit?(0,Ae.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,Ae.jsx)(G.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Ae.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}),(0,Ae.jsx)(G.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,Ae.jsx)(G.T,{size:16,children:" "}):null,l.dog?(0,Ae.jsx)(A.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ae.jsx)(ge.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,Ae.jsx)(Re.CancellationsSection,{items:rs,dayWord:Nl?Gl?_l.toLowerCase():`on ${_l}`:'today'})]}),Zs=(0,Ae.jsx)(O.default,{testID:"display-guest-list",accessibilityLabel:Js,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Xs}),ei=P.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Xt(!1)}}),ti=(0,Ae.jsxs)(E.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Js}, ${Qs.length}`,accessibilityState:{expanded:Jt},'aria-expanded':Jt,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Xt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:Jt?Q.colours.gold:Q.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?Q.colours.tilePressed:Jt?Q.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ae.jsx)(G.T,{size:16,weight:"bold",colour:Q.colours.gold,children:Qs.length}),(0,Ae.jsx)(A.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(A.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ae.jsxs)(G.T,{size:13,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,children:[Js," ",Jt?'\u2039':'\u203a']})})})]}),li=Jt?(0,Ae.jsxs)(A.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ae.jsxs)(A.default,{testID:"guests-drawer",...ei.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Je)),backgroundColor:Q.colours.surface,borderRightWidth:1,borderColor:Q.colours.gold,borderRadius:14,...We.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ae.jsxs)(A.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Ae.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Js.toUpperCase()," (",Qs.length,")"]}),(0,Ae.jsx)(l.GoldClose,{testID:"guests-close",label:`Close ${Js}`,onPress:()=>Xt(!1),style:{marginRight:-6}})]}),as.count?(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,testID:"cancelled-day-tally-guests",children:ds}):null]}),Zs]}),(0,Ae.jsx)(E.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Js}`,accessibilityRole:"button",onPress:()=>Xt(!1),style:{flex:1}})]}):null,si=Xl?Zl:s.IS_KIRKTON&&!Object.values(dt.kitchenHours??{}).some(Boolean)?(0,Ae.jsxs)(A.default,{testID:"kirkton-hours-to-confirm",style:[We.look.panel,{padding:14,gap:8}],children:[(0,Ae.jsx)(G.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ae.jsx)(G.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ae.jsx)(Se.DayGraph,{busyThreshold:(0,t.venueBusy)(dt,ut,yt).busy,todays:Vl,open:Kl,close:ql,now:yt,turnBase:dt.settings.turnMins,blocks:cs,pauses:Ql,compact:Ze,dense:!Ze,fit:tt,tight:tt&&Xe<600,height:Ns,forecastNote:Nl?void 0:xs,emptyText:es,past:Al{Nl?Xt(!0):zt(!0)},ai=(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',padding:Xe<820?8:12,paddingTop:Xe<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[It?null:ti,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[It?null:Hs,It?(0,Ae.jsx)(O.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ae.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"})}):zs?Ws:Ls,Ms,li]}),(0,Ae.jsxs)(A.default,{testID:"display-side",style:{width:st,gap:Xe<820?4:8,minHeight:0},children:[(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:As(!1)}),(0,Ae.jsx)(A.default,{style:{flexShrink:0},children:Es}),It?null:(0,Ae.jsx)(A.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,compact:Xe<820,snug:Xe<820,tight:Xe<700,sound:(0,L.flapSoundOn)(),onPress:ni})}),It?null:(0,Ae.jsx)(A.default,{ref:Fs,testID:"day-graph-slot",onLayout:Ks,style:{flexGrow:0,flexShrink:1,flexBasis:Ns+52,minHeight:Xe<600?90:120,overflow:'visible'},children:ii}),(0,Ae.jsxs)(O.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Ae.jsx)(E.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>hl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ae.jsx)(G.T,{center:!0,weight:"semibold",children:"Reviews"})}),Ys,(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt})]})]})]});return(0,Ae.jsxs)(_.SafeAreaView,{style:{flex:1,backgroundColor:Q.colours.bg},onTouchStart:()=>{ol.current=Date.now()},onMouseDown:()=>{ol.current=Date.now()},children:[Ze?(0,Ae.jsxs)(A.default,{style:{flex:1},children:[(0,Ae.jsxs)(O.default,{ref:it,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ae.jsxs)(A.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ae.jsx)(A.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ae.jsx)(j.ExitButton,{})}),(0,Ae.jsx)(U.RestaurantLogo,{rid:rt,size:64}),(0,Ae.jsx)(G.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:dt.name}),(0,Ae.jsx)(U.PoweredBy,{}),(0,Ae.jsx)(C.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ae.jsx)(A.default,{accessible:!0,accessibilityLabel:`Current time ${(0,q.hm)(yt)}`,children:(0,Ae.jsx)(G.T,{center:!0,size:30,weight:"semibold",colour:Q.colours.goldLight,children:(0,q.hm)(yt)})}),(0,Ae.jsx)(Me.ShellfishChip,{rid:rt,by:jt,app:"display",size:"m"}),(0,Ae.jsx)(Me.SundayRoastChip,{rid:rt,by:jt,app:"display",size:"m"}),K]}),He,oi,(0,Ae.jsx)(A.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ae.jsx)(Ke,{phone:!0,split:ns,items:[{label:`Tables \xb7 ${_l}`,value:is.length,testID:'badge-tables'},{label:`Covers \xb7 ${_l}`,value:os,testID:'badge-covers'},{label:'Takeaway',value:Cl.length,alert:Cl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Vt(!0)}]})}),(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{gap:8},children:As(!0)}),(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),Es,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[zs?Ws:Ls,Ms]}),(0,Ae.jsxs)(A.default,{onLayout:e=>{ot.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[We.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ae.jsxs)(G.T,{center:!0,size:20,weight:"semibold",colour:Q.colours.goldLight,accessibilityRole:"header",children:[Js," (",Qs.length,")"]}),(0,Ae.jsx)(A.default,{testID:"display-guest-list",accessibilityLabel:Js,style:{gap:4},children:Xs})]}),Ys,ii,(0,Ae.jsx)(A.default,{testID:"covers-dock",children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,compact:!0,sound:(0,L.flapSoundOn)(),onPress:()=>it.current?.scrollTo({y:ot.current,animated:!0})})}),(0,Ae.jsxs)(A.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ae.jsx)(G.T,{center:!0,size:14,colour:St?Q.colours.muted:Q.colours.amber,children:St?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ae.jsx)(G.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Ae.jsx)(G.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>hl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),qs]}),e?null:(0,Ae.jsx)(A.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:Q.colours.hairline},children:(0,Ae.jsx)(z.VoiceSlot,{size:56})})]}):(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Je>=1e3?18:14,paddingVertical:Xe<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),...We.look.web({backgroundImage:s.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Ae.jsx)(A.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ae.jsx)(U.RestaurantBrand,{rid:dt.id,size:Je<900?32:40,beside:!0})}),(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ae.jsx)(G.T,{size:Je<900?18:21,weight:"semibold",colour:Q.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,q.hm)(yt)}),Je>=900?(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,children:(0,q.niceDate)(yt)}):null]})]}),It?(0,Ae.jsx)(A.default,{style:{width:220}}):(0,Ae.jsx)(A.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:oi}),(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ae.jsx)(Me.ShellfishChip,{rid:rt,by:jt,app:"display",size:Je<1200?'xs':Je<1280||Xe<700?'s':'m'}),(0,Ae.jsx)(E.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.muted,children:"?"})}),'simulated'===bt?(0,Ae.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>gt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(G.T,{size:11,colour:Q.colours.muted,children:"+15"})}):null,e?null:(0,Ae.jsx)(j.ExitButton,{}),K,Pe?null:(0,Ae.jsx)(z.VoiceSlot,{size:44})]})]}),He,It?null:(0,Ae.jsxs)(A.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,Ae.jsx)(Ke,{splitOnly:!0,split:ns,items:[]}),(0,Ae.jsx)(A.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Je>=1e3?18:14)+(e?0:52)+('simulated'===bt?52:0),zIndex:4},children:(0,Ae.jsx)(Me.SundayRoastChip,{rid:rt,by:jt,app:"display",size:Je<1100||Xe<700?'s':'m'})})]}),tt?ai:(ri=(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:As(!1)}),Es]}),(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),It?(0,Ae.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"}):(0,Ae.jsx)(Ae.Fragment,{children:(0,Ae.jsxs)(A.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[ti,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Hs,zs?Ws:Ls,Ms,li]})]})}),Ys,It?null:(0,Ae.jsx)(A.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,sound:(0,L.flapSoundOn)(),onPress:ni})}),It?null:(0,Ae.jsx)(A.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Ns+Se.DAY_GRAPH_CHROME},children:ii})]}),(0,Ae.jsx)(O.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:ri})),qs]}),(0,Ae.jsx)(I.SoldOutStrip,{rid:rt,by:wt,onOpen:()=>bl(!0)}),(0,Ae.jsx)(D.SoldOutSheet,{visible:gl,onClose:()=>bl(!1),rid:rt,by:wt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ae.jsx)(p.TableOrderCue,{rid:rt}),Dt.elements,Ft?(0,Ae.jsx)(y.EditBookingPicker,{rid:rt,today:kt,who:jt,hidePrivate:!0,onClose:()=>Ut(!1)}):null,Kt?(0,Ae.jsx)(y.EditBookingSheet,{rid:rt,id:Kt,who:jt,hidePrivate:!0,onClose:()=>qt(null)}):null,Pt?(0,Ae.jsx)(me.TableSheet,{rid:rt,name:Pt,view:Rl,plan:Tt,todays:vl,now:yt,privacy:St,turnBase:dt.settings.turnMins,onClose:()=>Et(null),onWalkIn:e=>Dt.openWalkInAt(e),onMove:e=>At(e),onDetails:Dl}):null,ls?(()=>{const e=ts[ls],t=e?.dayBookings??[];return(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>ss(null),title:`${(0,d.tableNumbers)(ls)} \xb7 ${Gl?_l:(0,Te.dayLong)(Al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ae.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${Gl?_l.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${Gl?_l.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ue.privName)(e,St):Ve(e.name);return(0,Ae.jsx)(G.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,fe.tablesWords)((0,te.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ss(null),el(e.id)},style:{minHeight:56}},e.id)}),(0,Ae.jsx)(G.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ss(null),style:{minHeight:56}})]})})():null,Zt?(()=>{const e=ut.find(e=>e.id===Zt);return e?(0,Ae.jsx)(be.GuestActionsSheet,{rid:rt,b:e,name:e.walkIn?(0,ue.privName)(e,St):Ve(e.name),view:Rl,now:yt,otherDay:e.date!==kt,turnBase:dt.settings.turnMins,onClose:()=>el(null),onDetails:Dl,onDone:xl,onPickOnPlan:(e,t)=>{Xt(!1),Lt('plan'),Ht('all'),ll({id:e.id,tables:t})}}):null})():null,Nt?(0,Ae.jsx)(me.DetailsPanel,{title:Nt.title,onClose:()=>_t(null),children:Nt.body}):null,Yt?(0,Ae.jsx)(me.ServiceSummary,{r:dt,todays:vl,orders:ct,waitlistAll:al,walkInCount:rl,onClose:()=>Qt(!1)}):null,dl?(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>cl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ae.jsx)(g.FloorLegend,{}),(0,Ae.jsx)(G.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>cl(!1)})]}):null,ul?(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>hl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ae.jsx)(V.ReviewsSection,{rid:rt,mode:"read",venueName:dt.name}),(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>hl(!1)})]}):null,Gt?(0,Ae.jsxs)(me.DetailsPanel,{title:"Takeaway",onClose:()=>Vt(!1),children:[(0,Ae.jsx)(G.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ae.jsx)(Ye,{list:Cl,me:jt,bookings:ut})]}):null,ml?(0,Ae.jsx)(A.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:Q.colours.bg},children:(0,Ae.jsx)(ne.PlanDesigner,{initial:Tt,venue:dt.name,mode:"display",startStep:"arrange",onActivity:()=>{wl.current=Date.now(),null!==kl&&Il(null)},notice:null!==kl?`Locking again in ${kl} s \xb7 touch to keep editing`:null,onSave:e=>{te.useFloor.getState().setPlan(rt,e),jl(null),xl('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{te.useFloor.getState().setPlan(rt,e),xl('Live seating plan updated on every screen.')},onCancel:()=>{jl(null),xl('No changes kept. Editing is locked again.')}},ml.at)}):null,e?null:(0,Ae.jsx)(de.Screensaver,{rid:rt,idleMins:vt.idleMins,pinOn:vt.pinOn,wake:vt,tonightCards:vt.tonightCards,cfg:Ct}),e?null:(0,Ae.jsx)(we.PrintHost,{rid:rt}),e?null:(0,Ae.jsx)(je.AlertHost,{variant:"display",rid:rt,skipTakeaway:!0}),e?null:(0,Ae.jsx)(W.SeatAllergenReminder,{rid:rt}),e?null:(0,Ae.jsx)(ke.TakeawayTakeover,{rid:rt,me:jt})]});var ri};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=e(T),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=_r(_d[30]),z=_r(_d[31]),M=_r(_d[32]),H=e(_r(_d[33])),P=e(_r(_d[34])),E=e(_r(_d[35])),O=e(_r(_d[36])),A=e(_r(_d[37])),N=e(_r(_d[38])),_=_r(_d[39]),G=_r(_d[40]),V=_r(_d[41]),F=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]),Pe=_r(_d[88]),Ee=_r(_d[89]),Oe=_r(_d[90]),Ae=_r(_d[91]);const Ne='#221C12',_e='#2E2618',Ge=12e4,Ve=e=>(e??'').replace(' (example)',''),Fe=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Ue=e=>e.slotTime?(0,q.hm)(new Date(e.slotTime)):'ASAP';function Ke({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,Ae.jsxs)(A.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Ae.jsx)(A.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,Ae.jsxs)(A.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,Ae.jsx)(G.T,{size:l?24:19,weight:"semibold",colour:e.alert?Q.colours.amber:Q.colours.text,children:e.value}),(0,Ae.jsx)(G.T,{size:l?14:12,colour:Q.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ae.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ae.jsx)($.default.Fragment,{children:i},e.testID)})}),s?(0,Ae.jsx)(A.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,Ae.jsx)(G.T,{size:14,colour:Q.colours.muted,children:"No Covers yet"}):(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ae.jsx)(G.T,{size:i?13:14,weight:"semibold",colour:Q.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,Ae.jsx)(G.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,Ae.jsxs)(A.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:Q.colours.gold},children:[(0,Ae.jsx)(A.default,{style:{width:`${s.walkInPct}%`,backgroundColor:Q.colours.gold}}),(0,Ae.jsx)(A.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function qe({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,Ae.jsxs)(E.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Ae.jsx)(A.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Ae.jsx)(G.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?Q.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,Ae.jsx)(G.T,{size:12,colour:Q.colours.muted,children:l}):null]})}function Ye({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,Pe.statusBlock)(e,t,(0,Pe.linkedBooking)(e,s));return e.length?(0,Ae.jsx)(A.default,{style:{gap:8},children:e.map(e=>(0,Ae.jsxs)(A.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:Q.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?Q.colours.ok:e.allergies.length?Q.colours.red:Q.colours.gold},children:[(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Ae.jsxs)(G.T,{size:l?16:18,weight:"bold",children:[Ue(e)," \xb7 ",Ve(e.customerName)]}),(0,Ae.jsx)(G.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,Ae.jsxs)(G.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,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:Q.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,K.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ae.jsx)(He.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ae.jsxs)(G.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ae.jsx)(G.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>Y.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Ae.jsx)(G.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Ae.jsx)(G.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Ae.jsx)(we.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ae.jsx)(G.Muted,{children:"No takeaway orders right now."})}function Qe({rid:e,id:t,turnBase:l}){const s=(0,Y.useBookings)(e).find(e=>e.id===t);return s?(0,Ae.jsx)(b.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1315,[1141,796,5,6,1316,828,853,1117,860,1140,1317,1318,1319,1114,1135,1320,1321,1326,1327,1328,872,1329,1153,980,1122,1330,34,1094,1178,1044,1110,1136,1331,395,380,402,295,102,426,36,794,1220,1224,873,861,858,874,821,1113,892,1119,1084,1025,1100,1127,1332,1126,1333,1340,1342,1345,1348,1344,1349,1351,1352,1132,1116,1118,878,1356,1209,1357,1219,1211,1022,1362,1370,1371,1097,1134,1373,1374,1375,1166,1376,1165,1159,869,1377,1378,25]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ge}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:b,headerExtra:K,subHeader:Me,noVoice:Pe=!1}={}){const Ue=(0,N.default)(),Je=b??Ue.width,Xe=Ue.height,Ze=Je<700,et=Je>=Xe,tt=!Ze&&et&&Je>=600,st=tt,lt=Math.round(Math.min(520,Math.max(Je>=1e3?448:280,.3*Je))),it=$.default.useRef(null),ot=$.default.useRef(0),[nt,at]=(0,T.useState)({w:0,h:0}),rt=(0,X.useOwner)(e=>e.site),dt=(0,Y.useRestaurant)(rt);(0,Ie.useAlertWatcher)(rt,{enabled:!e});const ct=(0,Y.useOrders)(rt),ut=(0,Y.useBookings)(rt),ht=(0,Y.useEvents)(rt),gt=(0,Y.useStore)(e=>e.skipMinutes),bt=(0,Y.useStore)(e=>e.clock.mode),yt=(0,Y.useNow)(5e3),pt=(0,X.useOwner)(e=>e.staff),ft=(0,X.useOwner)(e=>e.attendance),mt=(0,X.useOwner)(e=>e.shifts);$.default.useEffect(()=>{(0,ee.ensureAttendance)((0,q.ymd)(yt),yt)},[(0,q.ymd)(yt)]);const xt=ft.filter(e=>e.in&&!e.out&&yt.getTime()-new Date(e.in).getTime()<72e6&&yt.getTime()>=new Date(e.in).getTime()),jt=Fe(pt.find(e=>e.id===xt[0]?.staffId)?.name)||'Duty Manager',wt=k.IS_CAR?'Car':'Display';(0,D.useSoldOutLink)(!1,e?void 0:wt,!0);const kt=(0,q.ymd)(yt),It=(0,R.useTravelDay)('display',kt),vt=(0,Z.useFrontDoor)(kt,et),Dt=(0,te.useDisplaySettings)(rt),St=Dt.privacy,Ct=(0,ce.useSaverSync)(),Tt=(0,te.usePlan)(rt),$t=(0,te.useFloor)(e=>e.live[rt]),Bt=(0,ve.useBlocks)(e=>e.blocks),[Rt,Lt]=(0,T.useState)('plan'),[zt,Wt]=(0,T.useState)(!1),[Ht,Mt]=(0,T.useState)('all'),[Pt,Et]=(0,T.useState)(null),[At,Ot]=(0,T.useState)(null),[Nt,_t]=(0,T.useState)(null),[Gt,Ft]=(0,T.useState)(!1),[Vt,Ut]=(0,T.useState)(!1),[Kt,qt]=(0,T.useState)(null),[Yt,Qt]=(0,T.useState)(!1),[Jt,Xt]=(0,T.useState)(!1),[Zt,es]=(0,T.useState)(null),[ts,ss]=(0,T.useState)(null),[ls,is]=(0,T.useState)(null),os=$.default.useRef(0),ns=e=>{os.current=Date.now(),is(e)};$.default.useEffect(()=>{if(!ls)return;const e=setInterval(()=>{Date.now()-os.current>=Te.DAY_IDLE_MS&&is(null)},5e3);return()=>clearInterval(e)},[ls]);const as=(0,Y.useWaitlist)(rt),rs=(0,Y.useStore)(e=>e.walkIns[rt]??0),[ds,cs]=(0,T.useState)(!1),[us,hs]=(0,T.useState)(!1),[gs,bs]=(0,T.useState)(!1);(0,V.useReviewAlerts)(rt);const[ys,ps]=(0,T.useState)({view:0,content:0}),[fs,ms]=(0,T.useState)(null);$.default.useEffect(()=>{fs&&((0,S.notify)({id:`floor-note:${Date.now()}`,title:fs,timeoutMs:4500,big:!0,testID:'floor-toast'}),ms(null))},[fs]),$.default.useEffect(()=>{if(!e)return(0,L.setDisplaySilent)(!0),()=>(0,L.setDisplaySilent)(!1)},[e]);const[xs,js]=(0,T.useState)(null),ws=$.default.useRef(0),[ks,Is]=(0,T.useState)(null);$.default.useEffect(()=>{if(!xs)return;ws.current=Date.now();const e=setInterval(()=>{const e=Date.now()-ws.current;if(e>=Ge)return js(null),void ms('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Is(e>=105e3?Math.ceil((Ge-e)/1e3):null)},1e3);return()=>clearInterval(e)},[xs]);const vs=e=>e.date!==kt?_t({title:`Guest details \xb7 ${(0,Te.dayWord)(e.date,kt)} ${e.time}`,body:(0,Oe.jsxs)(Oe.Fragment,{children:[!e.walkIn&&e.date>kt?(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Te.dayWord)(e.date,kt)}, ${e.time}`,disabled:!Fl.ok,accessibilityHint:Fl.hint,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}):null,(0,xe.bookingDetails)(e)]})}):_t({title:`Guest details \xb7 ${e.time}`,body:(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsx)(Qe,{rid:rt,id:e.id,turnBase:dt.settings.turnMins}),e.walkIn?null:(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}),e.walkIn?(0,Oe.jsx)(ye.CancelWalkInButton,{rid:rt,b:e,big:!0,onDone:e=>{_t(null),ms(e)}}):null,e.walkIn?(0,Oe.jsx)(ye.ReinstateWalkInButton,{rid:rt,b:e,today:kt,onDone:e=>{_t(null),ms(e)}}):null,(0,xe.bookingDetails)(e)]})}),Ds=ut.filter(e=>e.date===kt).sort((e,t)=>e.time.localeCompare(t.time)),Ss=Ds.filter(e=>!['cancelled','noshow'].includes(e.status)),Cs=ct.filter(Ve).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ts=(0,T.useMemo)(()=>(0,c.forecastToday)(dt,ut,ct,ht,yt),[dt,ut,ct,ht,yt.getTime()/6e4|0]),$s=(0,ve.closedAreasAt)(Bt,rt,kt,(0,q.hm)(yt)),Bs=[...$s].join(','),Rs=(0,T.useMemo)(()=>(0,se.floorView)(Tt,ut,ct,$t??{},yt,dt.settings.turnMins,$s),[Tt,ut,ct,$t,yt.getTime(),Bs]),Ls=(0,me.hoursFor)(dt,yt),zs=Ls?.open??new Date(`${kt}T12:00:00`),Ws=Ls?.close??new Date(`${kt}T21:00:00`),Hs=(0,q.addMins)(zs,-zs.getMinutes()),Ms=(0,q.addMins)(Ws,30),Ps=e=>new Date(`${kt}T${e}:00`),Es=(0,ve.blocksOn)(Bt,rt,kt).map(e=>({from:Ps(e.from),to:Ps(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(dt,yt,kt)),As=Object.keys(Rs).filter(e=>'blocked'===Rs[e]?.status),Os=ls&&ls!==kt?ls:kt,Ns=Os!==kt,_s=(0,Te.dayWord)(Os,kt),Gs=/^(Today|Yesterday|Tomorrow)$/.test(_s),Fs=Ns?(0,Te.bookingsForDay)(ut,Os,kt).sort((e,t)=>e.time.localeCompare(t.time)):Ds,Vs=(0,q.parseYmd)(Os);Vs.setHours(12);const Us=Ns?(0,me.hoursFor)(dt,Vs):Ls,Ks=Us?.open??new Date(`${Os}T12:00:00`),qs=Us?.close??new Date(`${Os}T21:00:00`),Ys=e=>new Date(`${Os}T${e}:00`),Qs=[...Ns?(0,ve.blocksOn)(Bt,rt,Os).map(e=>({from:Ys(e.from),to:Ys(e.to),label:e.reason??'Paused'})):Es,...Ns?(0,o.queuedServicePauses)(dt,Vs,Os):[]],Js=(0,o.queuedServiceSessions)(dt,Vs),Xs=l.IS_QUEUED_VENUE&&(void 0===Js||!Js.length),Zs=(0,Oe.jsxs)(O.default,{testID:"queued-hours-gate",style:[ze.look.panel,{padding:14,gap:8}],children:[(0,Oe.jsx)(G.T,{weight:"semibold",children:void 0===Js?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Oe.jsx)(G.Muted,{children:i.queuedVenues[rt]?.hours.note})]}),el=Ns?Us||Fs.length?OsNs?(0,se.dayFloorView)(Tt,Fs,Os):Rs,[Ns,Tt,Fs,Os,Rs]),[sl,ll]=(0,T.useState)(null),[il,ol]=(0,T.useState)(null),[nl,al]=(0,T.useState)(null),rl=Ns?Fs.filter(e=>!['cancelled','noshow'].includes(e.status)):Ss,dl=rl.reduce((e,t)=>e+t.partySize,0),cl=(0,u.coversSplit)(rl,Os),ul=(0,$e.cancelledDayTally)(ut,Os),hl=(0,Be.cancellationsFor)(ut,Os,e=>e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)','')),gl=(0,$e.cancelledTallyWords)(ul,Gs?_s.toLowerCase():Ns?`on ${_s}`:'today'),bl=Bt.filter(e=>e.rid===rt&&e.date===Os&&!e.removedAt),yl=(0,Ce.chartBands)(bl,60*Ks.getHours()+Ks.getMinutes(),60*qs.getHours()+qs.getMinutes()),pl=new Set((0,Ce.blockedHours)(yl)),fl=yt.getHours()+(yt.getMinutes()>=30?1:0),ml=Ts.hours.filter(e=>e.hour>=fl&&!pl.has(e.hour)),xl=ml.reduce((e,t)=>e+t.coversHigh,0),jl=ml.reduce((e,t)=>e+t.coversLow,0),wl=Math.round((jl+xl)/2),kl=!Ts.example&&Ts.open&&Ts.enough&&xl>0?`Usually ${(0,c.coversRange)(wl,wl)} more`:void 0,Il=async(e,t)=>{const s=Rs[e]?.booking;if(!s||e===t)return;const l=Rs[t]?.status;if(l&&!['free','soon'].includes(l))return void ms('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${se.STATUS[l].label.toLowerCase()}. Pick a free table.`);await Y.repo.bookings.update(s.id,{table:t});const i=$t?.[e]?.stage;te.useFloor.getState().setLive(rt,t,{stage:i??'seated',dirty:!1}),te.useFloor.getState().setLive(rt,e,{stage:void 0,dirty:!0}),ms(`${(0,ue.privName)(s,St)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`)},vl=e=>{if(ts)return ol(null),void ss(t=>t?{...t,tables:(0,fe.toggleTable)(t.tables,e)}:t);Ns?ll(e):At?(e!==At&&Il(At,e),Ot(null)):Et(e)},Dl=ts?ut.find(e=>e.id===ts.id):void 0,Sl=ts&&Dl?(()=>{const e=Dl.walkIn?(0,ue.privName)(Dl,St):Fe(Dl.name),t=(0,fe.seatsOf)(Tt,ts.tables).total,s=(0,fe.seatLine)(t,Dl.partySize),l=(0,fe.pickClashes)(Dl,ts.tables,ut.filter(e=>e.date===Dl.date),dt.settings.turnMins),i=(0,fe.tableKey)(ts.tables)!==(0,fe.tableKey)((0,te.tablesOf)(Dl.table));return(0,Oe.jsxs)(O.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:Q.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:Q.colours.gold,padding:10},children:[(0,Oe.jsxs)(O.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Te.dayWord)(Dl.date,kt)} ${Dl.time}. Tap tables on the plan to add or take them off. ${(0,fe.tablesWords)(ts.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Te.dayWord)(Dl.date,kt)," ",Dl.time]}),(0,Oe.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[(0,fe.tablesWords)(ts.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),il?(0,Oe.jsx)(O.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:il,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:Q.colours.amber,backgroundColor:Q.colours.amberBg},children:(0,Oe.jsx)(G.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:il})}):null,(0,Oe.jsxs)(G.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Oe.jsx)(G.Button,{testID:il?'plan-pick-overcap-yes':'plan-pick-save',label:il?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${il?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,fe.tablesWords)(ts.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Dl)return void ss(null);const s=(0,fe.overCapacityAsk)(ts.tables,t,Dl.partySize);if(!s||il){ol(null);try{await(0,pe.saveBookingTables)(rt,Dl,ts.tables),ms((0,fe.savedWords)(e,Dl.partySize,ts.tables,t))}catch(t){ms(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}ss(null)}else ol(s)}}),(0,Oe.jsx)(G.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{ol(null),ss(null)}})]})]})})():null,Cl=Tt.areas.filter(e=>Tt.tables.some(t=>t.areaId===e.id)),Tl=e=>{const t=Tt.tables.filter(t=>t.areaId===e);return Ns?`${t.filter(e=>!tl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Rs[e.name]?.status??'free')).length}/${t.length} free`},$l='all'===Ht||Cl.some(e=>e.id===Ht)?Ht:'all',Bl=e=>(0,Oe.jsx)(le.FloorCanvas,{plan:Tt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:tt,big:!0,view:tl,privacy:St,turnBase:dt.settings.turnMins,highlight:ts?ts.tables:At?[At]:void 0,onTap:e=>vl(e.name),onDrop:(e,t)=>ts||Ns?void 0:Il(e.name,t.name)}),Rl=Ze?1:et||Cl.length>2?2:1,Ll=e=>{const t=Tt.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},zl=[];for(let e=0;e{const t=(0,le.areaBounds)(Tt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,le.minReadableScale)(Tt,e.id)}}),nt.w,nt.h):null,Hl=e=>(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between',height:ie.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,children:Tl(e.id)})]}),Ml=(0,Oe.jsx)(O.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-nt.w)>1||Math.abs(s-nt.h)>1)&&at({w:t,h:s})},children:Wl?(0,Oe.jsx)(A.default,{style:{flex:1},scrollEnabled:Wl.scroll,showsVerticalScrollIndicator:Wl.scroll,contentContainerStyle:{gap:ie.GRID_GAP},children:Wl.rows.map((e,t)=>(0,Oe.jsx)(O.default,{style:{height:Wl.rowHeights[t],flexDirection:'row',gap:ie.GRID_GAP},children:e.map(e=>{const t=Cl.find(t=>t.id===e);return(0,Oe.jsxs)(O.default,{testID:`area-cell-${e}`,style:{width:Wl.cellW,gap:2},children:[Hl(t),(0,Oe.jsx)(O.default,{style:{flex:1},children:Bl(e)})]},e)})},t))}):null}),Pl=(0,Oe.jsxs)(O.default,{testID:"venue-plan",style:{flex:Ze?void 0:1,gap:10,minWidth:0},children:[(0,Oe.jsx)(r.TableNumberWarning,{plan:Tt}),Tt.tables.length?null:(0,Oe.jsxs)(O.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Oe.jsx)(G.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Oe.jsx)(G.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,Oe.jsx)(G.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,Oe.jsx)(qe,{chipId:"all",compact:!Ze,label:"Whole venue",selected:'all'===$l,onPress:()=>Mt('all')},"__all"),...Cl.map(e=>(0,Oe.jsx)(qe,{chipId:e.id,compact:!Ze,label:`${e.name}${(0,oe.areaMarks)(e)}`,colour:(0,Q.brandColour)(e.colour),sub:Ze?$s.has(e.id)?'closed':$l===e.id?Tl(e.id):void 0:void 0,selected:$l===e.id,onPress:()=>Mt(e.id)},e.id))];return Ze?(0,Oe.jsx)(O.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Oe.jsx)(A.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;ps(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>ps(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:ys.view>0&&ys.content>0&&ys.content<=ys.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:ys.view>0&&ys.content<=ys.view+1?'100%':void 0},children:e})})(),(0,Oe.jsx)(g.FloorLegend,{}),Sl,At?(0,Oe.jsxs)(G.Row,{gap:8,style:{backgroundColor:Q.colours.goldTint,borderRadius:10,padding:8},children:[(0,Oe.jsxs)(G.T,{weight:"semibold",colour:Q.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(At),": tap the new table."]}),(0,Oe.jsx)(G.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ot(null)})]}):null,'all'===$l&&tt?Ml:'all'===$l?(0,Oe.jsx)(O.default,{style:{flex:Ze?void 0:1,gap:12,minHeight:st?void 0:360},children:zl.map((e,t)=>(0,Oe.jsxs)(O.default,{style:{flex:Ze?void 0:Math.max(.3,...e.map(e=>Ll(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Oe.jsxs)(O.default,{style:{flex:1,gap:2},children:[Ze?(0,Oe.jsxs)(O.default,{style:{alignItems:'center',gap:4},children:[(0,Oe.jsxs)(G.T,{center:!0,size:18,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{center:!0,size:14,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.Muted,{center:!0,children:Tl(e.id)})]}):(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.Muted,{children:Tl(e.id)})]}),(0,Oe.jsx)(O.default,{style:Ze?{height:Math.max(280,Math.round((Je-40)*Ll(e.id)))}:{flex:1},children:Bl(e.id)})]},e.id)),e.length{if(Ns)return void es(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rs[t]?Et(t):vs(e)}},Os)}),Al='timeline'===Rt,Ol=zt?(0,Oe.jsx)(M.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Wt(!1),supportedOrientations:['landscape','portrait'],children:(0,Oe.jsxs)(O.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:Q.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Oe.jsx)(E.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Wt(!1),style:{minHeight:64,minWidth:Je<600?120:180,paddingHorizontal:Je<600?14:22,borderRadius:16,borderWidth:2,borderColor:Q.colours.goldLight,backgroundColor:Q.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(G.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Oe.jsx)(O.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Oe.jsx)(G.T,{size:22,weight:"semibold",colour:Q.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${Ns?(0,Te.dayLong)(Os):'Today'}`})}),Je<600?null:(0,Oe.jsx)(O.default,{style:{minWidth:180}})]}),Xs?Zs:(0,Oe.jsx)(O.default,{style:{flex:1,minHeight:0},children:(0,Oe.jsx)(re.Timeline,{hideNow:!0,fit:!0,plan:Tt,bookings:Ns?Fs:Ds,now:Ns?Ks:yt,privacy:St,turnBase:dt.settings.turnMins,t0:Ns?(0,q.addMins)(Ks,-Ks.getMinutes()):Hs,t1:Ns?(0,q.addMins)(qs,30):Ms,pauses:Ns?Qs:Es,blockedTables:Ns?[]:As,onOpen:e=>{if(Wt(!1),Ns)return void es(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rs[t]?Et(t):vs(e)}},`full-${Os}`)})]})}):null,Nl=Ns?(0,Oe.jsxs)(O.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:Q.colours.gold,backgroundColor:Q.colours.goldTint},children:[(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:Gs?`Showing ${_s} \xb7 ${(0,q.niceDate)((0,q.parseYmd)(Os))}`:`Showing ${(0,Te.dayWord)(Os,kt)}`}),(0,Oe.jsx)(O.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${gl}. Showing ${(0,Te.dayLong)(Os)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Oe.jsx)(G.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ss(null),ns(null)},style:{minHeight:44}})]}):null,_l=(0,Oe.jsx)(O.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:Ze?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(Al||zt);return(0,Oe.jsx)(E.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?(Lt('plan'),Wt(!0)):(Wt(!1),Lt('plan'))},style:{flex:Ze?1:void 0,minHeight:Ze?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?Q.colours.gold:'transparent',...ze.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,Oe.jsx)(G.T,{size:Ze?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Gl='display'!==k.APP_VARIANT||e?_l:(0,Oe.jsxs)(O.default,{testID:"display-view-row",style:{flexDirection:Ze?'column':'row',flexWrap:Ze?'nowrap':'wrap',gap:6,alignItems:Ze?'stretch':'center'},children:[_l,(0,Oe.jsx)(w.DisplayRotaKitchenButtons,{phone:Ze,shifts:mt,staff:pt,today:kt})]}),Fl=(0,h.useBookingWrite)(),Vl=e=>(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsx)(We.BigAction,{premium:!0,label:"Walk-in",onPress:vt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint}),(0,Oe.jsx)(We.BigAction,{premium:!0,label:"New booking",onPress:vt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint}),(0,Oe.jsx)(We.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Ut(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint})]});(0,Ae.useDisplayNotices)(rt,!e);const Ul=Ze?180:168,[Kl,ql]=(0,T.useState)(Ul),Yl=$.default.useRef(Ul),Ql=$.default.useRef(null),Jl=$.default.useRef(null),Xl=()=>{const e=Ql.current,t=Jl.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,s,l,i)=>{t.measureInWindow((e,t)=>{const l=Xe<820?8:12,o=44+(Xe<820?4:8),n=i>Yl.current?Math.ceil(i-Yl.current):Se.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Ul,Math.floor(t-l-s)-n-o));Math.abs(Yl.current-a)>=2&&(Yl.current=a,ql(a))})})};$.default.useEffect(()=>{const e=setTimeout(Xl,60);return()=>clearTimeout(e)},[Je,Xe]);const Zl=(0,Oe.jsxs)(O.default,{ref:Jl,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xl()},style:{flexDirection:'row',flexWrap:Je>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ze?12:6,justifyContent:Ze?'center':void 0,borderTopWidth:1,borderTopColor:Q.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Oe.jsx)(Ee.DisplayClockButton,{}),(0,Oe.jsx)(ae.HoldToEdit,{quiet:!0,onUnlock:()=>{Is(null),js({at:Date.now()})},onHint:()=>ms('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Oe.jsx)(De.BlockBookingsButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,display:!0,day:Os}),Tt.areas.some(e=>e.outdoor)?(0,Oe.jsx)(De.CloseGardenButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,short:!0}):null,(0,Oe.jsx)(E.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>bs(!0),style:({pressed:e})=>({...ze.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR?null:(0,Oe.jsx)(f.GiftQrButton,{rid:rt,venue:dt.name})]}),ei=Cs.length?(0,Oe.jsxs)(O.default,{testID:"takeaway-panel",style:[ze.look.panel,{overflow:'hidden'}],children:[(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Oe.jsx)(G.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Oe.jsxs)(G.T,{size:12,colour:Q.colours.muted,children:[Cs.length," live"]})]}),(0,Oe.jsx)(O.default,{style:{padding:10},children:(0,Oe.jsx)(Ye,{list:Cs,me:jt,compact:!0,bookings:ut})})]}):null,ti=(Le.DueToday,Ns?Fs:Ds.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),si=Ns?Gs?`${_s}\u2019s guests`:`Guests ${_s}`:'Today\u2019s guests',li=(0,Oe.jsxs)(Oe.Fragment,{children:[0===ti.length?(0,Oe.jsx)(G.Muted,{children:Ns?Os{const t=(0,J.isSeatedHighlight)(e.status,{otherDay:Ns}),s=(0,he.guestRowText)(e,{name:e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)',''),seated:t}),l=Q.colours.text,i=t?Q.colours.goldLight:Q.colours.muted,o=Q.colours.gold,n=s.depositWarn?Q.colours.amber:Q.colours.goldLight;return(0,Oe.jsxs)(E.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:s.a11y,accessibilityHint:Ns?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Xt(!1),es(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,J.seatedHighlightStyle)({backgroundColor:e?_e:Ne,borderColor:Q.colours.gold,borderLeftColor:Q.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:Q.colours.hairline,backgroundColor:e?Q.colours.tilePressed:'transparent'},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Oe.jsx)(G.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:s.time}),(0,Oe.jsx)(G.T,{size:18,weight:"semibold",colour:l,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:s.name}),s.allergy?(0,Oe.jsx)(O.default,{style:{paddingTop:2},children:(0,Oe.jsx)(H.AllergyIcon,{text:s.allergy,size:22,colour:Q.colours.amber,ink:Q.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Oe.jsxs)(G.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Oe.jsx)(G.T,{size:16,colour:l,children:s.people}),s.deposit?(0,Oe.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}):null,s.deposit?(0,Oe.jsx)(G.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:s.deposit}):null,(0,Oe.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}),(0,Oe.jsx)(G.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===s.table?i:l,children:s.table}),s.dog?(0,Oe.jsx)(G.T,{size:16,children:" "}):null,s.dog?(0,Oe.jsx)(O.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Oe.jsx)(ge.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,Oe.jsx)(Re.CancellationsSection,{items:hl,dayWord:Ns?Gs?_s.toLowerCase():`on ${_s}`:'today'})]}),ii=(0,Oe.jsx)(A.default,{testID:"display-guest-list",accessibilityLabel:si,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:li}),oi=P.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Xt(!1)}}),ni=(0,Oe.jsxs)(E.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${si}, ${ti.length}`,accessibilityState:{expanded:Jt},'aria-expanded':Jt,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Xt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:Jt?Q.colours.gold:Q.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?Q.colours.tilePressed:Jt?Q.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Oe.jsx)(G.T,{size:16,weight:"bold",colour:Q.colours.gold,children:ti.length}),(0,Oe.jsx)(O.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(O.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Oe.jsxs)(G.T,{size:13,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,children:[si," ",Jt?'\u2039':'\u203a']})})})]}),ai=Jt?(0,Oe.jsxs)(O.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Oe.jsxs)(O.default,{testID:"guests-drawer",...oi.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Je)),backgroundColor:Q.colours.surface,borderRightWidth:1,borderColor:Q.colours.gold,borderRadius:14,...ze.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Oe.jsxs)(O.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[si.toUpperCase()," (",ti.length,")"]}),(0,Oe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${si}`,onPress:()=>Xt(!1),style:{marginRight:-6}})]}),ul.count?(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,testID:"cancelled-day-tally-guests",children:gl}):null]}),ii]}),(0,Oe.jsx)(E.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${si}`,accessibilityRole:"button",onPress:()=>Xt(!1),style:{flex:1}})]}):null,ri=Xs?Zs:l.IS_KIRKTON&&!Object.values(dt.kitchenHours??{}).some(Boolean)?(0,Oe.jsxs)(O.default,{testID:"kirkton-hours-to-confirm",style:[ze.look.panel,{padding:14,gap:8}],children:[(0,Oe.jsx)(G.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Oe.jsx)(G.Muted,{children:"No service hours have been set for this venue."})]}):(0,Oe.jsx)(Se.DayGraph,{busyThreshold:(0,t.venueBusy)(dt,ut,yt).busy,todays:Fs,open:Ks,close:qs,now:yt,turnBase:dt.settings.turnMins,blocks:bl,pauses:Qs,compact:Ze,dense:!Ze,fit:tt,tight:tt&&Xe<600,height:Ul,forecastNote:Ns?void 0:kl,emptyText:el,past:Os{Ns?Xt(!0):Wt(!0)},hi=(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',padding:Xe<820?8:12,paddingTop:Xe<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[It?null:ni,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[It?null:Nl,It?(0,Oe.jsx)(A.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Oe.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"})}):Al?El:Pl,Ol,ai]}),(0,Oe.jsxs)(O.default,{testID:"display-side",style:{width:lt,gap:Xe<820?4:8,minHeight:0},children:[(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Vl(!1)}),(0,Oe.jsx)(O.default,{style:{flexShrink:0},children:Gl}),It?null:(0,Oe.jsx)(O.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,compact:Xe<820,snug:Xe<820,tight:Xe<700,sound:(0,L.flapSoundOn)(),onPress:ui})}),It?null:(0,Oe.jsx)(O.default,{ref:Ql,testID:"day-graph-slot",onLayout:Xl,style:{flexGrow:0,flexShrink:1,flexBasis:Ul+52,minHeight:Xe<600?90:120,overflow:'visible'},children:di}),(0,Oe.jsxs)(A.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Oe.jsx)(E.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>hs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Oe.jsx)(G.T,{center:!0,weight:"semibold",children:"Reviews"})}),ei,(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt})]})]})]});return(0,Oe.jsxs)(_.SafeAreaView,{style:{flex:1,backgroundColor:Q.colours.bg},onTouchStart:()=>{os.current=Date.now()},onMouseDown:()=>{os.current=Date.now()},children:[Ze?(0,Oe.jsxs)(O.default,{style:{flex:1},children:[(0,Oe.jsxs)(A.default,{ref:it,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Oe.jsxs)(O.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Oe.jsx)(O.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Oe.jsx)(j.ExitButton,{})}),(0,Oe.jsx)(U.RestaurantLogo,{rid:rt,size:64}),(0,Oe.jsx)(G.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:dt.name}),(0,Oe.jsx)(U.PoweredBy,{}),(0,Oe.jsx)(C.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Oe.jsx)(O.default,{accessible:!0,accessibilityLabel:`Current time ${(0,q.hm)(yt)}`,children:(0,Oe.jsx)(G.T,{center:!0,size:30,weight:"semibold",colour:Q.colours.goldLight,children:(0,q.hm)(yt)})}),(0,Oe.jsx)(He.ShellfishChip,{rid:rt,by:jt,app:"display",size:"m"}),(0,Oe.jsx)(He.SundayRoastChip,{rid:rt,by:jt,app:"display",size:"m"}),K]}),Me,ci,(0,Oe.jsx)(O.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Oe.jsx)(Ke,{phone:!0,split:cl,items:[{label:`Tables \xb7 ${_s}`,value:rl.length,testID:'badge-tables'},{label:`Covers \xb7 ${_s}`,value:dl,testID:'badge-covers'},{label:'Takeaway',value:Cs.length,alert:Cs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Ft(!0)}]})}),(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{gap:8},children:Vl(!0)}),(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),Gl,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[Al?El:Pl,Ol]}),(0,Oe.jsxs)(O.default,{onLayout:e=>{ot.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[ze.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Oe.jsxs)(G.T,{center:!0,size:20,weight:"semibold",colour:Q.colours.goldLight,accessibilityRole:"header",children:[si," (",ti.length,")"]}),(0,Oe.jsx)(O.default,{testID:"display-guest-list",accessibilityLabel:si,style:{gap:4},children:li})]}),ei,di,(0,Oe.jsx)(O.default,{testID:"covers-dock",children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,compact:!0,sound:(0,L.flapSoundOn)(),onPress:()=>it.current?.scrollTo({y:ot.current,animated:!0})})}),(0,Oe.jsxs)(O.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Oe.jsx)(G.T,{center:!0,size:14,colour:St?Q.colours.muted:Q.colours.amber,children:St?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Oe.jsx)(G.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cs(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Oe.jsx)(G.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>hs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zl]}),e?null:(0,Oe.jsx)(O.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:Q.colours.hairline},children:(0,Oe.jsx)(W.VoiceSlot,{size:56})})]}):(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Je>=1e3?18:14,paddingVertical:Xe<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),...ze.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Oe.jsx)(O.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Oe.jsx)(U.RestaurantBrand,{rid:dt.id,size:Je<900?32:40,beside:!0})}),(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Oe.jsx)(G.T,{size:Je<900?18:21,weight:"semibold",colour:Q.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,q.hm)(yt)}),Je>=900?(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,children:(0,q.niceDate)(yt)}):null]})]}),It?(0,Oe.jsx)(O.default,{style:{width:220}}):(0,Oe.jsx)(O.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:ci}),(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Oe.jsx)(He.ShellfishChip,{rid:rt,by:jt,app:"display",size:Je<1200?'xs':Je<1280||Xe<700?'s':'m'}),(0,Oe.jsx)(E.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cs(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.muted,children:"?"})}),'simulated'===bt?(0,Oe.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>gt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(G.T,{size:11,colour:Q.colours.muted,children:"+15"})}):null,e?null:(0,Oe.jsx)(j.ExitButton,{}),K,Pe?null:(0,Oe.jsx)(W.VoiceSlot,{size:44})]})]}),Me,It?null:(0,Oe.jsxs)(O.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,Oe.jsx)(Ke,{splitOnly:!0,split:cl,items:[]}),(0,Oe.jsx)(O.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Je>=1e3?18:14)+(e?0:52)+('simulated'===bt?52:0),zIndex:4},children:(0,Oe.jsx)(He.SundayRoastChip,{rid:rt,by:jt,app:"display",size:Je<1100||Xe<700?'s':'m'})})]}),tt?hi:(gi=(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Vl(!1)}),Gl]}),(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),It?(0,Oe.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"}):(0,Oe.jsx)(Oe.Fragment,{children:(0,Oe.jsxs)(O.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[ni,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Nl,Al?El:Pl,Ol,ai]})]})}),ei,It?null:(0,Oe.jsx)(O.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,sound:(0,L.flapSoundOn)(),onPress:ui})}),It?null:(0,Oe.jsx)(O.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Ul+Se.DAY_GRAPH_CHROME},children:di})]}),(0,Oe.jsx)(A.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:gi})),Zl]}),(0,Oe.jsx)(I.SoldOutStrip,{rid:rt,by:wt,onOpen:()=>bs(!0)}),(0,Oe.jsx)(v.SoldOutSheet,{visible:gs,onClose:()=>bs(!1),rid:rt,by:wt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Oe.jsx)(p.TableOrderCue,{rid:rt}),vt.elements,Vt?(0,Oe.jsx)(y.EditBookingPicker,{rid:rt,today:kt,who:jt,hidePrivate:!0,onClose:()=>Ut(!1)}):null,Kt?(0,Oe.jsx)(y.EditBookingSheet,{rid:rt,id:Kt,who:jt,hidePrivate:!0,onClose:()=>qt(null)}):null,Pt?(0,Oe.jsx)(xe.TableSheet,{rid:rt,name:Pt,view:Rs,plan:Tt,todays:Ds,now:yt,privacy:St,turnBase:dt.settings.turnMins,onClose:()=>Et(null),onWalkIn:e=>vt.openWalkInAt(e),onMove:e=>Ot(e),onDetails:vs}):null,sl?(()=>{const e=tl[sl],t=e?.dayBookings??[];return(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>{al(null),ll(null)},title:`${(0,d.tableNumbersA11y)(sl)} \xb7 ${Gs?_s:(0,Te.dayLong)(Os)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Oe.jsxs)(G.T,{size:16,center:!0,colour:Q.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${Gs?_s.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${Gs?_s.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ue.privName)(e,St):Fe(e.name);return(0,Oe.jsx)(G.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,fe.tablesWords)((0,te.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ll(null),es(e.id)},style:{minHeight:56}},e.id)}),Os>=kt?(()=>{const t=e?.table.maxSeats??0,s=ut.filter(e=>e.date===Os&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,te.tablesOf)(e.table).includes(sl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Oe.jsxs)(O.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",center:!0,colour:Q.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(sl)]}),nl?(0,Oe.jsxs)(O.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:nl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:Q.colours.amber,backgroundColor:Q.colours.amberBg},children:[(0,Oe.jsx)(G.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:nl.ask}),(0,Oe.jsxs)(G.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Oe.jsx)(G.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!Fl.ok,accessibilityHint:Fl.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=ut.find(e=>e.id===nl.id);if(al(null),!e)return;const s=Fe(e.name);try{await(0,pe.saveBookingTables)(rt,e,[sl]),ms((0,fe.savedWords)(s,e.partySize,[sl],t))}catch(e){ms(`Couldn\u2019t save tables for ${s}: ${String(e?.message??e).slice(0,120)}`)}ll(null)}}),(0,Oe.jsx)(G.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>al(null)})]})]}):null,nl?null:s.slice(0,12).map(e=>{const s=Fe(e.name),l=e.partySize>t;return(0,Oe.jsx)(G.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:!Fl.ok,accessibilityHint:Fl.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(sl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{const l=(0,fe.overCapacityAsk)([sl],t,e.partySize);if(l)al({id:e.id,ask:l});else{try{await(0,pe.saveBookingTables)(rt,e,[sl]),ms((0,fe.savedWords)(s,e.partySize,[sl],t))}catch(e){ms(`Couldn\u2019t save tables for ${s}: ${String(e?.message??e).slice(0,120)}`)}ll(null)}},style:{minHeight:56}},e.id)})]}):null})():null,(0,Oe.jsx)(G.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{al(null),ll(null)},style:{minHeight:56}})]})})():null,Zt?(()=>{const e=ut.find(e=>e.id===Zt);return e?(0,Oe.jsx)(be.GuestActionsSheet,{rid:rt,b:e,name:e.walkIn?(0,ue.privName)(e,St):Fe(e.name),view:Rs,now:yt,otherDay:e.date!==kt,turnBase:dt.settings.turnMins,onClose:()=>es(null),onDetails:vs,onDone:ms,onEdit:e=>{es(null),qt(e.id)},onPickOnPlan:(e,t)=>{Xt(!1),Lt('plan'),Mt('all'),ss({id:e.id,tables:t})}}):null})():null,Nt?(0,Oe.jsx)(xe.DetailsPanel,{title:Nt.title,onClose:()=>_t(null),children:Nt.body}):null,Yt?(0,Oe.jsx)(xe.ServiceSummary,{r:dt,todays:Ds,orders:ct,waitlistAll:as,walkInCount:rs,onClose:()=>Qt(!1)}):null,ds?(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>cs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Oe.jsx)(g.FloorLegend,{}),(0,Oe.jsx)(G.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>cs(!1)})]}):null,us?(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>hs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Oe.jsx)(F.ReviewsSection,{rid:rt,mode:"read",venueName:dt.name}),(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>hs(!1)})]}):null,Gt?(0,Oe.jsxs)(xe.DetailsPanel,{title:"Takeaway",onClose:()=>Ft(!1),children:[(0,Oe.jsx)(G.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Oe.jsx)(Ye,{list:Cs,me:jt,bookings:ut})]}):null,xs?(0,Oe.jsx)(O.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:Q.colours.bg},children:(0,Oe.jsx)(ne.PlanDesigner,{initial:Tt,venue:dt.name,mode:"display",startStep:"arrange",onActivity:()=>{ws.current=Date.now(),null!==ks&&Is(null)},notice:null!==ks?`Locking again in ${ks} s \xb7 touch to keep editing`:null,onSave:e=>{te.useFloor.getState().setPlan(rt,e),js(null),ms('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{te.useFloor.getState().setPlan(rt,e),ms('Live seating plan updated on every screen.')},onCancel:()=>{js(null),ms('No changes kept. Editing is locked again.')}},xs.at)}):null,e?null:(0,Oe.jsx)(de.Screensaver,{rid:rt,idleMins:Dt.idleMins,pinOn:Dt.pinOn,wake:Dt,tonightCards:Dt.tonightCards,cfg:Ct}),e?null:(0,Oe.jsx)(we.PrintHost,{rid:rt}),e?null:(0,Oe.jsx)(je.AlertHost,{variant:"display",rid:rt,skipTakeaway:!0}),e?null:(0,Oe.jsx)(z.SeatAllergenReminder,{rid:rt}),e?null:(0,Oe.jsx)(ke.TakeawayTakeover,{rid:rt,me:jt})]});var gi};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),D=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=e(T),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),z=_r(_d[30]),W=_r(_d[31]),H=_r(_d[32]),M=e(_r(_d[33])),P=e(_r(_d[34])),E=e(_r(_d[35])),A=e(_r(_d[36])),O=e(_r(_d[37])),N=e(_r(_d[38])),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),me=_r(_d[69]),xe=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),ve=_r(_d[75]),De=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),ze=_r(_d[84]),We=_r(_d[85]),He=_r(_d[86]),Me=_r(_d[87]),Pe=_r(_d[88]),Ee=_r(_d[89]),Ae=_r(_d[90]),Oe=_r(_d[91]);const Ne='#221C12',_e='#2E2618',Ge=12e4,Fe=e=>(e??'').replace(' (example)',''),Ve=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Ue=e=>e.slotTime?(0,q.hm)(new Date(e.slotTime)):'ASAP';function Ke({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:o}){return(0,Oe.jsxs)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Oe.jsx)(O.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,Oe.jsxs)(O.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,Oe.jsx)(G.T,{size:s?24:19,weight:"semibold",colour:e.alert?Q.colours.amber:Q.colours.text,children:e.value}),(0,Oe.jsx)(G.T,{size:s?14:12,colour:Q.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Oe.jsx)(E.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,Oe.jsx)($.default.Fragment,{children:i},e.testID)})}),l?(0,Oe.jsx)(O.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Oe.jsx)(G.T,{size:14,colour:Q.colours.muted,children:"No Covers yet"}):(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Oe.jsx)(G.T,{size:i?13:14,weight:"semibold",colour:Q.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Oe.jsx)(G.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Oe.jsxs)(O.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:Q.colours.gold},children:[(0,Oe.jsx)(O.default,{style:{width:`${l.walkInPct}%`,backgroundColor:Q.colours.gold}}),(0,Oe.jsx)(O.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function qe({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:o,compact:n}){return(0,Oe.jsxs)(E.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Oe.jsx)(O.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Oe.jsx)(G.T,{size:n?12:14,weight:l?'semibold':'medium',colour:l?Q.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Oe.jsx)(G.T,{size:12,colour:Q.colours.muted,children:s}):null]})}function Ye({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Pe.statusBlock)(e,t,(0,Pe.linkedBooking)(e,l));return e.length?(0,Oe.jsx)(O.default,{style:{gap:8},children:e.map(e=>(0,Oe.jsxs)(O.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:Q.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?Q.colours.ok:e.allergies.length?Q.colours.red:Q.colours.gold},children:[(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Oe.jsxs)(G.T,{size:s?16:18,weight:"bold",children:[Ue(e)," \xb7 ",Fe(e.customerName)]}),(0,Oe.jsx)(G.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,Oe.jsxs)(G.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,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:Q.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,K.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Oe.jsx)(Me.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Oe.jsxs)(G.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Oe.jsx)(G.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>Y.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Oe.jsx)(G.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Oe.jsx)(G.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Oe.jsx)(we.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Oe.jsx)(G.Muted,{children:"No takeaway orders right now."})}function Qe({rid:e,id:t,turnBase:s}){const l=(0,Y.useBookings)(e).find(e=>e.id===t);return l?(0,Oe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1315,[1141,796,5,6,1316,828,853,1117,860,1140,1317,1318,1319,1114,1135,1320,1321,1326,1327,1328,872,1329,1153,980,1122,1330,34,1094,1178,1044,1110,1136,1331,395,380,402,295,102,426,36,794,1220,1224,873,861,858,874,821,1113,892,1119,1084,1025,1100,1127,1332,1126,1333,1340,1342,1345,1348,1344,1349,1351,1352,1132,1116,1118,878,1356,1209,1357,1219,1211,1022,1362,1370,1371,1097,1134,1373,1374,1375,1166,1376,1165,1159,869,1377,1378,25]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1317,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1318,[1023,1084]); @@ -1422,7 +1422,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.listSavedPlans=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))},_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const{data:c,error:u}=await(0,n.getSupabase)().from('table_plans').insert({venue_id:a,name:o.name,is_active:!1,areas:t.areas??[],tables:t.tables??[],joins:t.joins??[],sections:t.sections??[],fixtures:t.fixtures??[],updated_by:s()}).select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').single();if(u)throw u;return l(c)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return c(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:c(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}function c(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1339,[1338,1021,872,934,988]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1340,[34,236,402,102,821,794,1166,1341,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},1341,[]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return w}}),_e.Timeline=function({plan:e,bookings:T,now:C,privacy:S,onOpen:v,turnBase:I,t0:D,t1:E,height:z,pauses:L,blockedTables:R,hideNow:$,compact:_=!1,fit:O=!1}){const B=(0,o.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),W=T.filter(e=>!['cancelled','noshow'].includes(e.status)),[N,F]=(0,o.useState)(0),A=O&&!W.some(e=>!e.table)?B.filter(e=>'__none'!==e.key):B,P=O&&N>0?Math.max(w,Math.min(k,Math.floor(N/Math.max(1,A.length)))):k,H=P<44,Y=(0,o.useMemo)(()=>(0,c.clashes)(W,I),[W,I]),V=Math.max(1,Math.ceil((E.getTime()-D.getTime())/9e5)),[U,X]=(0,o.useState)(0),G=Math.max(30,U-M-2),q=Math.min(V,Math.max(1,Math.floor(G/j))),J=U>0?Math.max(j,Math.floor(G/q*100)/100):j,[K,Q]=(0,o.useState)(0),Z=Math.max(0,V-q),ee=Math.max(0,Math.min(Z,K)),te=(0,u.addMins)(D,15*ee),le=(0,u.addMins)(te,15*q),oe=e=>(e.getTime()-te.getTime())/9e5*J,[ie,ne]=(0,o.useState)(null),re=(0,o.useRef)(null);(0,o.useEffect)(()=>{const e=$?0:Math.floor((C.getTime()-D.getTime())/9e5)-Math.floor(q/3);Q(Math.max(0,Math.min(Z,e)))},[D.getTime(),q,Z,$]);const[se,ae]=(0,o.useState)(''),[de,ce]=(0,o.useState)(null),he=(0,o.useRef)(null);he.current=de,(0,o.useEffect)(()=>{if(!de)return;const e=setTimeout(()=>ce(null),s.ARM_MS);return()=>clearTimeout(e)},[de]);const ue=de?W.find(e=>e.id===de.id):void 0,be=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(he.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(he.current,e.id,Date.now()),onResponderGrant:e=>{re.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:l=>{if(!re.current||!(0,s.isArmed)(he.current,e.id,Date.now()))return;const o=l.nativeEvent.pageX-re.current.x,i=l.nativeEvent.pageY-re.current.y;(Math.abs(i)>=6||Math.abs(o)>=6)&&ne({id:e.id,row:t,dy:i})},onResponderRelease:l=>{const o=re.current;re.current=null,ne(null);const n=l.nativeEvent.pageX-(o?.x??0),r=l.nativeEvent.pageY-(o?.y??0),d=(0,s.releaseOn)(he.current,e.id,!(Math.abs(n)<6&&Math.abs(r)<6),Date.now());if(ce(d.arm),'select'===d.action){ae('');try{i.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void ae('');if('none'===d.action)return;ae('');const h=A.findIndex(e=>e.key===t),f=Math.max(0,Math.min(A.length-1,h+Math.round(r/P))),g=(0,b.dragTables)(e.table,t,A[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),ae(`${(0,p.privName)(e,S)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,u.hm)((0,c.startOf)(e))}`)):Math.abs(n)>=6&&Math.abs(r)

=600||se?(0,y.jsx)(r.default,{style:{flex:U>=600?1:void 0,flexBasis:U>=600?void 0:'100%',minWidth:0},children:(0,y.jsx)(x.T,{size:13,center:U<600,colour:g.colours.muted,numberOfLines:U>=600?1:2,testID:"timeline-hint",children:se||s.SELECT_HINT})}):null,L?.length?(0,y.jsxs)(x.Row,{gap:4,children:[(0,y.jsx)(r.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:13,children:"Blocked"})]}):null,(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.goldLight,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(r.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))})}),(0,y.jsx)(r.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})})]}):null]}):(0,y.jsxs)(y.Fragment,{children:[_?(0,y.jsxs)(r.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,y.jsx)(r.default,{style:{alignSelf:'center'},children:(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'})}),(0,y.jsx)(x.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),se?(0,y.jsx)(r.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:se})}):null]}):(0,y.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(x.Row,{gap:8,children:[(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'}),(0,y.jsx)(r.default,{style:{flex:1,minWidth:0},children:(0,y.jsx)(x.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,y.jsx)(r.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{size:13,colour:g.colours.goldLight,children:se})})]}),(0,y.jsxs)(x.T,{center:!0,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})]}):null,L?.length?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(r.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:14,children:"Blocked"})]}):null]}),(0,y.jsxs)(r.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-U)>1&&X(t)},style:{flex:z?void 0:1,height:z,flexShrink:_?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,y.jsxs)(r.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:g.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,y.jsx)(r.default,{testID:"timeline-table-head",style:{width:M,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:(0,y.jsx)(x.T,{size:13,weight:"semibold",colour:g.colours.goldLight,children:"Table"})}),(0,y.jsxs)(r.default,{style:{width:q*J,flexShrink:0},children:[Array.from({length:Math.ceil(q/4)},(e,t)=>(0,y.jsx)(r.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*J,top:26,bottom:0,width:1,backgroundColor:g.colours.border}},t)),Array.from({length:Math.ceil(q/4)},(e,t)=>{const l=4*t*J,o=Math.max(0,Math.min(q*J-56,l-28));return(0,y.jsx)(r.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:o,width:56,top:4,height:22,justifyContent:'center'},children:(0,y.jsx)(x.T,{size:15,weight:"semibold",colour:g.colours.goldLight,center:!0,numberOfLines:1,children:(0,u.hm)((0,u.addMins)(te,60*t))})},`l${t}`)})]})]}),(0,y.jsxs)(n.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-N)>1&&F(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,y.jsx)(r.default,{style:{width:M,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:A.map((e,t,l)=>(0,y.jsx)(r.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:P,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:H?(0,y.jsxs)(r.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,y.jsx)(r.default,{style:{width:q*J,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!he.current,onResponderRelease:()=>{ce(null),ae('')},children:(0,y.jsxs)(r.default,{style:{width:q*J},children:[(L??[]).map((e,t)=>{const l=Math.max(0,oe(e.from)),o=Math.min(q*J,oe(e.to));return o<=l?null:(0,y.jsx)(r.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,u.hm)(e.from)} to ${(0,u.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:o-l,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),A.map((e,o,i)=>{return(0,y.jsxs)(r.default,{testID:`tl-row-${e.key}`,style:{height:P,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:o>0&&i[o-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(q/4)},(e,l)=>(0,y.jsx)(r.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*J,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),R?.includes(e.key)?(0,y.jsx)(r.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,y.jsx)(x.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,W.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)te)).map(t=>{const o=ie?.id===t.id&&ie.row===e.key?ie:null,i=oe((0,c.startOf)(t)),n=Math.max(0,Math.min(q*J-44,i)),a=Math.min(q*J,oe((0,u.addMins)((0,c.startOf)(t),(0,c.durOf)(t,I)))),d=Math.min(q*J-n,Math.max(44,a-Math.max(0,i))),b=Y.has(t.id),j=de?.id===t.id;return(0,y.jsx)(r.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,p.privName)(t,S)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,u.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,I)} min${b?', clash':''}${(0,h.depositView)(t,!0)?`, ${(0,h.depositView)(t,!0).a11y}`:''}${j?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:j},accessibilityHint:j?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:j?'1':'0'},...be(t,e.key),style:[{position:'absolute',left:n,top:(H?2:4)+(o?o.dy:0),width:d,height:P-(H?4:8),borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:j?3:b?2.5:1,borderColor:j?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...j?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:o?40:j?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:j?'ns-resize':'pointer',touchAction:j?'none':'pan-y'},o?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,y.jsx)(x.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:H?1:2,style:{lineHeight:16},children:d<100?H&&d>=70?`${t.partySize} \xb7 ${(0,u.hm)((0,c.startOf)(t))}`:String(t.partySize):(0,y.jsxs)(y.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key||H?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,p.privName)(t,S)," \xb7 ",t.partySize,H?' \xb7 ':'\n',(0,u.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,h.depositView)(t,!0)?d>=150?` \xb7 ${(0,h.depositView)(t,!0).label}`:'Deposit paid'===(0,h.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&me>=0&&me<=q*J?(0,y.jsx)(r.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:me,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,y.jsx)(r.default,{style:{position:'absolute',top:0,left:Math.max(-me,Math.min(-18,q*J-me-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,y.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,u.hm)(C)})})}):null]})})]}),ue?(0,y.jsx)(r.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,y.jsxs)(x.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,y.jsx)(r.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,p.privName)(ue,S)} ${s.SELECTED_A11Y}`,children:(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,p.privName)(ue,S)," \xb7 ",ue.partySize]})}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{ce(null),v(ue)}}),(0,y.jsx)(x.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{ce(null),ae('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=_r(_d[2]),i=e(_r(_d[3]));_r(_d[4]);var n=e(_r(_d[5])),r=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),u=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),x=_r(_d[16]),p=_r(_d[17]),y=_r(_d[18]);const j=30,k=52,w=28,M=120},1342,[828,860,34,281,236,295,102,1128,874,1025,1100,14,858,1118,1343,821,794,1344,25]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return w}}),_e.Timeline=function({plan:e,bookings:T,now:C,privacy:S,onOpen:v,turnBase:I,t0:D,t1:z,height:E,pauses:$,blockedTables:L,hideNow:R,compact:_=!1,fit:O=!1}){const B=(0,o.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),W=T.filter(e=>!['cancelled','noshow'].includes(e.status)),[N,A]=(0,o.useState)(0),F=O&&!W.some(e=>!e.table)?B.filter(e=>'__none'!==e.key):B,P=O&&N>0?Math.max(w,Math.min(k,Math.floor(N/Math.max(1,F.length)))):k,H=P<44,Y=(0,o.useMemo)(()=>(0,c.clashes)(W,I),[W,I]),V=Math.max(1,Math.ceil((z.getTime()-D.getTime())/9e5)),[U,X]=(0,o.useState)(0),G=Math.max(30,U-M-2),q=Math.min(V,Math.max(1,Math.floor(G/j))),J=U>0?Math.max(j,Math.floor(G/q*100)/100):j,[K,Q]=(0,o.useState)(0),Z=Math.max(0,V-q),ee=Math.max(0,Math.min(Z,K)),te=(0,u.addMins)(D,15*ee),le=(0,u.addMins)(te,15*q),oe=e=>(e.getTime()-te.getTime())/9e5*J,[ie,re]=(0,o.useState)(null),ne=(0,o.useRef)(null);(0,o.useEffect)(()=>{const e=R?0:Math.floor((C.getTime()-D.getTime())/9e5)-Math.floor(q/3);Q(Math.max(0,Math.min(Z,e)))},[D.getTime(),q,Z,R]);const[se,ae]=(0,o.useState)(''),[de,ce]=(0,o.useState)(null),he=(0,o.useRef)(null);he.current=de,(0,o.useEffect)(()=>{if(!de)return;const e=setTimeout(()=>ce(null),s.ARM_MS);return()=>clearTimeout(e)},[de]);const ue=de?W.find(e=>e.id===de.id):void 0,be=(t,l)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(he.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(he.current,t.id,Date.now()),onResponderGrant:e=>{ne.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!ne.current||!(0,s.isArmed)(he.current,t.id,Date.now()))return;const o=e.nativeEvent.pageX-ne.current.x,i=e.nativeEvent.pageY-ne.current.y;(Math.abs(i)>=6||Math.abs(o)>=6)&&re({id:t.id,row:l,dy:i})},onResponderRelease:o=>{const r=ne.current;ne.current=null,re(null);const n=o.nativeEvent.pageX-(r?.x??0),d=o.nativeEvent.pageY-(r?.y??0),h=(0,s.releaseOn)(he.current,t.id,!(Math.abs(n)<6&&Math.abs(d)<6),Date.now());if(ce(h.arm),'select'===h.action){ae('');try{i.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void ae('');if('none'===h.action)return;ae('');const f=F.findIndex(e=>e.key===l),g=Math.max(0,Math.min(F.length-1,f+Math.round(d/P))),x=(0,b.dragTables)(t.table,l,F[g].key);if(x){a.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,b.overCapacityAsk)(x.split('+'),(0,b.seatsOf)(e,x.split('+')).total,t.partySize);ae(`${(0,p.privName)(t,S)} \u2192 ${(0,b.tablesWords)(x.split('+'))}, still ${(0,u.hm)((0,c.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`)}else Math.abs(n)>=6&&Math.abs(d)

=600||se?(0,y.jsx)(n.default,{style:{flex:U>=600?1:void 0,flexBasis:U>=600?void 0:'100%',minWidth:0},children:(0,y.jsx)(x.T,{size:13,center:U<600,colour:g.colours.muted,numberOfLines:U>=600?1:2,testID:"timeline-hint",children:se||s.SELECT_HINT})}):null,$?.length?(0,y.jsxs)(x.Row,{gap:4,children:[(0,y.jsx)(n.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:13,children:"Blocked"})]}):null,(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.goldLight,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(n.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))})}),(0,y.jsx)(n.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})})]}):null]}):(0,y.jsxs)(y.Fragment,{children:[_?(0,y.jsxs)(n.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,y.jsx)(n.default,{style:{alignSelf:'center'},children:(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'})}),(0,y.jsx)(x.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),se?(0,y.jsx)(n.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:se})}):null]}):(0,y.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(x.Row,{gap:8,children:[(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'}),(0,y.jsx)(n.default,{style:{flex:1,minWidth:0},children:(0,y.jsx)(x.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,y.jsx)(n.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{size:13,colour:g.colours.goldLight,children:se})})]}),(0,y.jsxs)(x.T,{center:!0,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})]}):null,$?.length?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(n.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:14,children:"Blocked"})]}):null]}),(0,y.jsxs)(n.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-U)>1&&X(t)},style:{flex:E?void 0:1,height:E,flexShrink:_?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,y.jsxs)(n.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:g.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,y.jsx)(n.default,{testID:"timeline-table-head",style:{width:M,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:(0,y.jsx)(x.T,{size:13,weight:"semibold",colour:g.colours.goldLight,children:"Table"})}),(0,y.jsxs)(n.default,{style:{width:q*J,flexShrink:0},children:[Array.from({length:Math.ceil(q/4)},(e,t)=>(0,y.jsx)(n.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*J,top:26,bottom:0,width:1,backgroundColor:g.colours.border}},t)),Array.from({length:Math.ceil(q/4)},(e,t)=>{const l=4*t*J,o=Math.max(0,Math.min(q*J-56,l-28));return(0,y.jsx)(n.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:o,width:56,top:4,height:22,justifyContent:'center'},children:(0,y.jsx)(x.T,{size:15,weight:"semibold",colour:g.colours.goldLight,center:!0,numberOfLines:1,children:(0,u.hm)((0,u.addMins)(te,60*t))})},`l${t}`)})]})]}),(0,y.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-N)>1&&A(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,y.jsx)(n.default,{style:{width:M,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:F.map((e,t,l)=>(0,y.jsx)(n.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:P,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:H?(0,y.jsxs)(n.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,y.jsx)(n.default,{style:{width:q*J,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!he.current,onResponderRelease:()=>{ce(null),ae('')},children:(0,y.jsxs)(n.default,{style:{width:q*J},children:[($??[]).map((e,t)=>{const l=Math.max(0,oe(e.from)),o=Math.min(q*J,oe(e.to));return o<=l?null:(0,y.jsx)(n.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,u.hm)(e.from)} to ${(0,u.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:o-l,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),F.map((e,o,i)=>{return(0,y.jsxs)(n.default,{testID:`tl-row-${e.key}`,style:{height:P,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:o>0&&i[o-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(q/4)},(e,l)=>(0,y.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*J,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),L?.includes(e.key)?(0,y.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,y.jsx)(x.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(r=e.key,W.filter(e=>('__none'===r?!e.table:(0,d.tablesOf)(e.table).includes(r))&&(0,c.startOf)(e)te)).map(t=>{const o=ie?.id===t.id&&ie.row===e.key?ie:null,i=oe((0,c.startOf)(t)),r=Math.max(0,Math.min(q*J-44,i)),a=Math.min(q*J,oe((0,u.addMins)((0,c.startOf)(t),(0,c.durOf)(t,I)))),d=Math.min(q*J-r,Math.max(44,a-Math.max(0,i))),b=Y.has(t.id),j=de?.id===t.id;return(0,y.jsx)(n.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,p.privName)(t,S)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,u.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,I)} min${b?', clash':''}${(0,h.depositView)(t,!0)?`, ${(0,h.depositView)(t,!0).a11y}`:''}${j?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:j},accessibilityHint:j?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:j?'1':'0'},...be(t,e.key),style:[{position:'absolute',left:r,top:(H?2:4)+(o?o.dy:0),width:d,height:P-(H?4:8),borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:j?3:b?2.5:1,borderColor:j?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...j?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:o?40:j?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:j?'ns-resize':'pointer',touchAction:j?'none':'pan-y'},o?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,y.jsx)(x.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:H?1:2,style:{lineHeight:16},children:d<100?H&&d>=70?`${t.partySize} \xb7 ${(0,u.hm)((0,c.startOf)(t))}`:String(t.partySize):(0,y.jsxs)(y.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key||H?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,p.privName)(t,S)," \xb7 ",t.partySize,H?' \xb7 ':'\n',(0,u.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,h.depositView)(t,!0)?d>=150?` \xb7 ${(0,h.depositView)(t,!0).label}`:'Deposit paid'===(0,h.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var r}),!R&&me>=0&&me<=q*J?(0,y.jsx)(n.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:me,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,y.jsx)(n.default,{style:{position:'absolute',top:0,left:Math.max(-me,Math.min(-18,q*J-me-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,y.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,u.hm)(C)})})}):null]})})]}),ue?(0,y.jsx)(n.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,y.jsxs)(x.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,y.jsx)(n.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,p.privName)(ue,S)} ${s.SELECTED_A11Y}`,children:(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,p.privName)(ue,S)," \xb7 ",ue.partySize]})}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{ce(null),v(ue)}}),(0,y.jsx)(x.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{ce(null),ae('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=_r(_d[2]),i=e(_r(_d[3]));_r(_d[4]);var r=e(_r(_d[5])),n=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),u=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),x=_r(_d[16]),p=_r(_d[17]),y=_r(_d[18]);const j=30,k=52,w=28,M=120},1342,[828,860,34,281,236,295,102,1128,874,1025,1100,14,858,1118,1343,821,794,1344,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1343,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1344,[]); __d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1345,[5,828,34,283,336,236,402,102,426,821,873,794,1026,1000,1326,1346,2,1347,1348,874,858,25]); @@ -1432,10 +1432,10 @@ __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.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1349,[860,14,1025,1350]); __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])},1350,[861]); __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])},1351,[34,102,797,821,25]); -__d(function(_g,r,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:S,name:D,view:P,now:I,onClose:L,onDetails:v,onDone:N,otherDay:T,turnBase:W=90,onPickOnPlan:H}){const[_,z]=(0,l.useState)(!1),M=(0,j.useBookingWrite)(),[A,G]=(0,l.useState)(!1),[O,F]=(0,l.useState)(!1),[R,q]=(0,l.useState)(!1),E=(0,k.guestRowText)(S,{name:D,seated:'seated'===S.status&&!T}),J='seated'===S.status&&!T,K=S.table?J?`Seated \xb7 ${(0,a.tableCardLabel)(S.table)}`:(0,a.tableCardLabel)(S.table):J?'Seated':'No table yet',Q=T?[]:(0,y.guestActions)(S,D,P,I).filter(e=>'details'!==e.id),U=(0,g.tableActions)(S,D),V={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},X=async t=>{const s={...S,table:t};t!==S.table&&await u.repo.bookings.update(S.id,{table:t}),await(0,b.seatBookingNow)(e,s),N(`${D} seated at ${(0,y.tableWords)(t)}.`),L()},Y=async t=>'seat'===t.id&&t.table?X(t.table):'pick'===t.id?z(e=>!e):'details'===t.id?(L(),v(S)):'finished'===t.id?('seated'===S.status?await(0,b.finishBookingNow)(e,S):await u.repo.bookings.setStatus(S.id,'finished'),N('seated'===S.status&&S.table?`${D} finished. ${(0,y.tableWords)(S.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),L()):'noshow'===t.id?(await u.repo.bookings.setStatus(S.id,'noshow'),N(`${D} marked as a no-show.`),L()):void 0,Z=_?(0,y.freeTablesNow)(P,S.partySize).slice(0,8):[];if(A)return(0,w.jsx)(h.TablePicker,{rid:e,booking:S,name:D,turnBase:W,onClose:L,onSaved:N,onPickOnPlan:H?e=>{L(),H(S,e)}:void 0});if(O)return(0,w.jsx)(f.CancelWalkInConfirm,{rid:e,b:S,onClose:L,onDone:N});if(R)return(0,w.jsx)(p.CancelBookingConfirm,{rid:e,b:S,name:D,onClose:L,onDone:N});const ee=[...Q];return(0,w.jsxs)(c.Sheet,{visible:!0,onClose:L,title:`${S.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,w.jsx)(o.default,{accessible:!0,accessibilityLabel:E.a11y,testID:"guest-actions-summary",children:(0,w.jsxs)(c.T,{size:18,children:[E.people,E.deposit?(0,w.jsxs)(c.T,{size:18,weight:"semibold",colour:E.depositWarn?x.colours.amber:x.colours.goldLight,children:[" \xb7 ",E.deposit]}):null," \xb7 ",K]})}),(0,w.jsx)(t.ShowNumberButton,{b:S}),(0,w.jsxs)(o.default,{style:{gap:10},children:[ee.map(e=>(0,w.jsxs)(n.default.Fragment,{children:[(0,w.jsx)(c.Button,{kind:B(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:M.hint,disabled:'details'!==e.id&&!M.ok,testID:`guest-act-${e.id}`,onPress:()=>Y(e),style:C}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,w.jsxs)(c.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&_?(0,w.jsxs)(o.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Z.length?(0,w.jsx)(c.Muted,{children:"No free tables right now."}):null,Z.map(e=>(0,w.jsx)(c.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:M.hint,disabled:!M.ok,testID:`guest-pick-${e.table}`,onPress:()=>X(e.table),style:C},e.table))]}):null]},e.id)),U.map(t=>(0,w.jsx)(c.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:M.hint,disabled:!M.ok,testID:`guest-act-${t.id}`,style:C,onPress:async()=>{if(M.ok){if('assign'===t.id)return G(!0);await(0,h.saveBookingTables)(e,S,[]),N(`${D}: table taken off.`),L()}}},t.id)),!T&&(0,f.canCancelWalkIn)(S)?(0,w.jsx)(c.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${S.ref}, ${S.partySize} Covers`,accessibilityHint:M.hint,disabled:!M.ok,testID:"guest-act-cancelwalkin",onPress:()=>F(!0),style:C}):null,(0,$.canCancelBooking)(S)?(0,w.jsx)(c.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${S.time}, ${S.partySize} Covers`,accessibilityHint:M.hint,disabled:!M.ok,testID:"guest-act-cancelbooking",onPress:()=>q(!0),style:C}):null,(0,w.jsx)(c.Button,{kind:"ghost",label:V.label,accessibilityLabel:V.a11y,testID:"guest-act-details",onPress:()=>Y(V),style:C})]}),(0,w.jsx)(c.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:L,style:C})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=e(l),o=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),j=r(d[16]),w=r(d[17]);const C={minHeight:64},B=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1352,[1353,860,1025,34,102,794,1119,874,1355,1349,1118,1116,1132,1133,1134,821,1318,25]); +__d(function(_g,r,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:D,name:v,view:I,now:P,onClose:L,onDetails:z,onDone:H,otherDay:N,turnBase:T=90,onPickOnPlan:W,onEdit:_}){const[A,E]=(0,l.useState)(null),[F,M]=(0,l.useState)(!1),R=(0,w.useBookingWrite)(),[G,O]=(0,l.useState)(!1),[U,q]=(0,l.useState)(!1),[J,K]=(0,l.useState)(!1),Q=(0,k.guestRowText)(D,{name:v,seated:'seated'===D.status&&!N}),V='seated'===D.status&&!N,X=D.table?V?`Seated \xb7 ${(0,a.tableCardLabel)(D.table)}`:(0,a.tableCardLabel)(D.table):V?'Seated':'No table yet',Y=N?[]:(0,y.guestActions)(D,v,I,P).filter(e=>'details'!==e.id),Z=(0,g.tableActions)(D,v),ee={id:'details',label:'Guest details',a11y:`Guest details, ${v}`},te=async t=>{const s={...D,table:t};t!==D.table&&await u.repo.bookings.update(D.id,{table:t}),await(0,b.seatBookingNow)(e,s),H(`${v} seated at ${(0,y.tableWords)(t)}.`),L()},se=async t=>'seat'===t.id&&t.table?te(t.table):'pick'===t.id?M(e=>!e):'details'===t.id?(L(),z(D)):'finished'===t.id?('seated'===D.status?await(0,b.finishBookingNow)(e,D):await u.repo.bookings.setStatus(D.id,'finished'),H('seated'===D.status&&D.table?`${v} finished. ${(0,y.tableWords)(D.table).replace(/^t/,'T')} needs clearing.`:`${v} finished.`),L()):'noshow'===t.id?(await u.repo.bookings.setStatus(D.id,'noshow'),H(`${v} marked as a no-show.`),L()):void 0,ae=F?(0,y.freeTablesNow)(I,D.partySize,!0).slice(0,12):[];if(G)return(0,C.jsx)(p.TablePicker,{rid:e,booking:D,name:v,turnBase:T,onClose:L,onSaved:H,onPickOnPlan:W?e=>{L(),W(D,e)}:void 0});if(U)return(0,C.jsx)(f.CancelWalkInConfirm,{rid:e,b:D,onClose:L,onDone:H});if(J)return(0,C.jsx)($.CancelBookingConfirm,{rid:e,b:D,name:v,onClose:L,onDone:H});const ie=[...Y];return(0,C.jsxs)(c.Sheet,{visible:!0,onClose:L,title:`${D.time} \xb7 ${v}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(o.default,{accessible:!0,accessibilityLabel:Q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(c.T,{size:18,children:[Q.people,Q.deposit?(0,C.jsxs)(c.T,{size:18,weight:"semibold",colour:Q.depositWarn?j.colours.amber:j.colours.goldLight,children:[" \xb7 ",Q.deposit]}):null," \xb7 ",X]})}),(0,C.jsx)(t.ShowNumberButton,{b:D}),(0,C.jsxs)(o.default,{style:{gap:10},children:[ie.map(e=>(0,C.jsxs)(n.default.Fragment,{children:[(0,C.jsx)(c.Button,{kind:B(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:R.hint,disabled:'details'!==e.id&&!R.ok,testID:`guest-act-${e.id}`,onPress:()=>se(e),style:S}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(c.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&F?(0,C.jsxs)(o.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ae.length?(0,C.jsx)(c.Muted,{children:"No free tables right now."}):null,A?(0,C.jsxs)(o.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:A.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[(0,C.jsx)(c.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:A.ask}),(0,C.jsx)(c.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!R.ok,accessibilityHint:R.hint,onPress:()=>{const e=A.table;E(null),te(e)},style:S}),(0,C.jsx)(c.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>E(null),style:S})]}):ae.map(e=>(0,C.jsx)(c.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,g.overCapacityAsk)([e.table],e.seats,D.partySize);t?E({table:e.table,ask:t}):te(e.table)},style:S},e.table))]}):null]},e.id)),Z.map(t=>(0,C.jsx)(c.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:R.hint,disabled:!R.ok,testID:`guest-act-${t.id}`,style:S,onPress:async()=>{if(R.ok){if('assign'===t.id)return O(!0);await(0,p.saveBookingTables)(e,D,[]),H(`${v}: table taken off.`),L()}}},t.id)),!N&&(0,f.canCancelWalkIn)(D)?(0,C.jsx)(c.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${D.ref}, ${D.partySize} Covers`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-cancelwalkin",onPress:()=>q(!0),style:S}):null,(0,x.canCancelBooking)(D)?(0,C.jsx)(c.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${v}, ${D.time}, ${D.partySize} Covers`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-cancelbooking",onPress:()=>K(!0),style:S}):null,!_||D.walkIn||['cancelled','noshow'].includes(D.status)||N&&!(D.date>=(0,h.ymd)(P))?null:(0,C.jsx)(c.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${v}, ${D.time}. Date, time, covers, table, anything.`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-edit",onPress:()=>{L(),_(D)},style:S}),(0,C.jsx)(c.Button,{kind:"ghost",label:ee.label,accessibilityLabel:ee.a11y,testID:"guest-act-details",onPress:()=>se(ee),style:S})]}),(0,C.jsx)(c.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:L,style:S})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=e(l),o=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),$=r(d[14]),x=r(d[15]),j=r(d[16]),w=r(d[17]),C=r(d[18]);const S={minHeight:64},B=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1352,[1353,860,1025,34,102,794,1119,874,1355,1349,1118,858,1116,1132,1133,1134,821,1318,25]); __d(function(g,r,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)(h.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(h.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=h.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,h.canShowNumber)(e,!y||(0,b.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 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,h.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,h.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]),b=r(d[7]),h=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1353,[34,379,402,102,874,1003,892,1023,1354,872,821,794,25]); __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')}`}},1354,[]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1355,[1025,1100]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a,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.maxSeatsc[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1355,[1025,1100]); __d(function(g,_r,_i,_a,_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 I}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const l=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,n.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,C.jsxs)(m.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,C.jsx)(x.T,{size:13,weight:"semibold",colour:T.colours.gold,children:"NEXT HOUR"}),(0,C.jsxs)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,C.jsx)(x.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,C.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?T.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?T.colours.amber:'#3C78B5'},children:[(0,C.jsx)(x.T,{size:13,weight:"semibold",children:e.time}),(0,C.jsxs)(x.T,{size:13,children:[(0,p.privName)(e,s)," \xb7 ",e.partySize]}),(0,C.jsx)(x.T,{size:12,colour:T.colours.muted,accessibilityLabel:e.table?(0,a.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,a.tableNumbers)(e.table)}`:'no table'}),(0,C.jsx)(x.T,{size:12,colour:t<0?T.colours.amber:T.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,C.jsx)(x.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,C.jsx)(x.T,{size:12,children:v.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,C.jsxs)(x.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,C.jsxs)(x.Row,{gap:4,children:[(0,C.jsx)(m.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:v.STATUS[e].colour}}),(0,C.jsx)(x.T,{size:12,colour:T.colours.muted,children:v.STATUS[e].label})]},e)),(0,C.jsx)(x.T,{size:12,colour:T.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,u.useState)(20);return(0,u.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,u.useEffect)(()=>{l<=0&&s()},[l]),(0,C.jsxs)(x.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,C.jsx)(x.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,C.jsx)(x.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return B}}),_e.TableSheet=function({rid:e,name:t,view:s,plan:i,todays:c,now:h,privacy:w,turnBase:S,onClose:I,onWalkIn:B,onMove:D,onDetails:z}){const M=s[t],N=j.useFloor.getState(),[P,R]=(0,u.useState)(!1),[L,A]=(0,u.useState)(M?.note??''),[W,O]=(0,u.useState)(!1),H=(0,$.useBookingWrite)();if(!M)return null;const F=M.booking,E=['seated','mains','dessert','bill'].includes(M.status),_=c.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,n.minsBetween)(h,(0,v.startOf)(e)))-Math.abs((0,n.minsBetween)(h,(0,v.startOf)(t)))),G=e=>e.partySize<=M.table.maxSeats,U=M.next??M.due,V=(0,v.turnFor)(M.covers||M.table.maxSeats,S);return(0,C.jsxs)(x.Sheet,{visible:!0,onClose:I,title:`${(0,a.tableNumbers)(t)} \xb7 ${v.STATUS[M.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===M.status?(0,C.jsx)(x.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{j.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,C.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(x.Badge,{kind:"neutral",label:`${M.table.minSeats}\u2013${M.table.maxSeats} seats`}),F?(0,C.jsx)(x.Badge,{kind:"gold",label:`${(0,p.privName)(F,w)} \xb7 ${F.partySize} \xb7 ${M.seatedMins}m`}):null,F?(0,C.jsx)(x.Badge,{kind:M.seatedMins>(0,v.durOf)(F,S)?'red':'neutral',label:`Turn about ${(0,v.durOf)(F,S)} min \xb7 free about ${(0,n.hm)((0,v.endOf)(F,S))} (est.)`}):(0,C.jsx)(x.Badge,{kind:"neutral",label:`Turn estimate for ${M.table.maxSeats}: about ${V} min`}),M.next?(0,C.jsx)(x.Badge,{kind:"blue",label:`Next: ${M.next.time} ${(0,p.privName)(M.next,w)} (${M.next.partySize})`}):null,M.allergy?(0,C.jsx)(x.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,C.jsx)(k.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,C.jsx)(o.BookingTableButton,{rid:e,booking:F??U,turnBase:S,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,C.jsx)(r.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,C.jsx)(r.ReinstateWalkInButton,{rid:e,b:F,today:(0,n.ymd)(new Date)}):null,!E&&'blocked'!==M.status&&U?(0,C.jsx)(x.Button,{label:`Seat ${(0,p.privName)(U,w)}`,accessibilityLabel:`Seat ${(0,p.privName)(U,w)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await y.repo.bookings.update(s.id,{table:s.table&&(0,j.tablesOf)(s.table).includes(t)?s.table:t}),await y.repo.bookings.setStatus(s.id,'seated'),(0,f.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==M.status&&U&&(0,v.startOf)(U)<=h?(0,C.jsxs)(x.Row,{gap:8,children:[(0,C.jsx)(x.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,p.privName)(U,w)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await y.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,C.jsx)(x.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,p.privName)(U,w)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await y.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===M.status?null:(0,C.jsxs)(x.Row,{gap:8,children:[(0,C.jsx)(x.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===M.status&&j.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,C.jsx)(x.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,C.jsxs)(m.default,{style:{gap:6},children:[0===_.length?(0,C.jsx)(x.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,C.jsxs)(b.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,p.privName)(s,w)} ${s.time}`,onPress:async()=>{await y.repo.bookings.update(s.id,{table:t}),await y.repo.bookings.setStatus(s.id,'seated'),(0,f.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?T.colours.border:T.colours.amber,backgroundColor:T.colours.surface2},children:[(0,C.jsxs)(x.T,{weight:"semibold",children:[s.time," \xb7 ",(0,p.privName)(s,w)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,a.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,C.jsxs)(x.T,{size:12,colour:T.colours.amber,children:["Bigger than this table (",M.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(x.T,{size:14,colour:T.colours.muted,children:"Course / status"}),(0,C.jsx)(x.Row,{wrap:!0,gap:6,children:v.STAGES.map(s=>(0,C.jsx)(x.Chip,{label:v.STAGE_LABEL[s],selected:M.status===s,onPress:()=>N.setLive(e,t,{stage:s})},s))}),(0,C.jsxs)(x.Row,{wrap:!0,gap:8,children:[F?(0,C.jsx)(x.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,C.jsx)(x.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await y.repo.bookings.setStatus(F.id,'finished'),N.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,C.jsxs)(x.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(x.Button,{kind:"secondary",label:'blocked'===M.status?'Unblock table':'Block table',onPress:()=>{N.setLive(e,t,{blocked:'blocked'!==M.status}),I()},testID:"block-table"}),(0,C.jsx)(x.Button,{kind:"ghost",label:M.note?'Edit note':'Note',onPress:()=>R(!P)}),F||U?(0,C.jsx)(x.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),z(F??U)},testID:"guest-details"}):null]}),P?(0,C.jsxs)(x.Row,{gap:6,children:[(0,C.jsx)(l.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[x.styles.input,{flex:1}]}),(0,C.jsx)(x.Button,{small:!0,label:"Save",onPress:()=>{N.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,w?(0,C.jsx)(x.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,i.joins.some(e=>e.tables.includes(t))?(0,C.jsxs)(x.Muted,{children:["Joins with ",i.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",i.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:a,todays:i,waiting:o,now:r,privacy:c,busy:h,onToast:w}){const[k,$]=(0,u.useState)(''),[B,D]=(0,u.useState)(2),z=(0,j.useFloor)(e=>e.smsLog);return(0,C.jsxs)(I,{title:`Waitlist (${o.length})`,right:(0,C.jsxs)(x.Muted,{children:["new party about ",(0,S.estimateWait)(o.length+1,t.settings.turnMins,h)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,C.jsx)(x.Muted,{children:"Nobody waiting."}):null,o.map((l,o)=>{const u=(0,v.suggestTable)(s,i,a,l.partySize,r,(0,v.turnFor)(l.partySize,t.settings.turnMins)),b=(0,S.estimateWait)(o+1,t.settings.turnMins,h),k=Math.max(0,(0,n.minsBetween)(new Date(l.joinedAt),r)),$=z.find(t=>t.rid===e&&t.text.includes(`#${l.number} `));return(0,C.jsxs)(m.default,{style:{backgroundColor:T.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(x.T,{weight:"semibold",children:["#",l.number," ",(0,p.pv)(l.name,c)," \xb7 ",l.partySize]}),(0,C.jsxs)(x.T,{size:12,colour:k>b?T.colours.amber:T.colours.muted,children:["waited ",k,"m \xb7 quoted about ",b,"m"]})]}),u?(0,C.jsxs)(x.T,{size:12,colour:u.clashes?T.colours.amber:T.colours.ok,children:["Best table: ",u.table," (",u.why,")"]}):(0,C.jsx)(x.T,{size:12,colour:T.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,C.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(x.Button,{small:!0,label:$||'notified'===l.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${l.number}`,onPress:()=>{j.useFloor.getState().logSms(e,r.toISOString(),`#${l.number} ${l.partySize}: Your table at ${t.name} is ready.`),y.repo.waitlist.setStatus(l.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),u?(0,C.jsx)(x.Button,{small:!0,kind:"success",label:`Seat at ${u.table}`,onPress:async()=>{await y.repo.waitlist.setStatus(l.id,'seated'),await y.repo.bookings.seatWalkIn(e,l.partySize,u.table,`From waitlist #${l.number}`),(0,f.resetTableLive)(e,u.table),w(`Waitlist #${l.number} seated at ${u.table}`)}}):null,(0,C.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>y.repo.waitlist.setStatus(l.id,'removed')})]}),'notified'===l.status?(0,C.jsx)(x.Badge,{kind:"ok",label:`Told table ready${$?` ${(0,n.hm)(new Date($.at))}`:''} `}):null]},l.id)}),(0,C.jsxs)(x.Row,{gap:6,children:[(0,C.jsx)(l.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:k,onChangeText:$,style:[x.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,C.jsx)(b.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:T.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(x.T,{weight:"bold",colour:T.colours.gold,children:B})}),(0,C.jsx)(x.Button,{small:!0,label:"Add",disabled:k.trim().length<2,onPress:()=>{y.repo.waitlist.join(e,k.trim(),B),$('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:l,now:a,walkInCount:o,staffOn:r,onSummary:u}){const c=o+l.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)),f=h?c/h:1,p=f>=1.1?T.colours.amber:f>=.85?T.colours.ok:T.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,n.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,n.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,v.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),k=y.filter(e=>e.future&&e.covers>j),S=t.nextHour?.covers??0,$=Math.ceil(S/16);return(0,C.jsxs)(I,{title:"Pace & kitchen",right:(0,C.jsx)(x.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,C.jsxs)(m.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${h}`,style:{gap:4},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{size:14,children:"Covers so far"}),(0,C.jsxs)(x.T,{weight:"bold",colour:p,children:[c," ",(0,C.jsxs)(x.T,{size:13,colour:T.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,C.jsx)(m.default,{style:{height:10,borderRadius:5,backgroundColor:(0,s.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,C.jsx)(m.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,C.jsxs)(x.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,i.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,C.jsx)(x.T,{size:13,colour:T.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,C.jsx)(m.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,C.jsxs)(m.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,C.jsx)(x.T,{size:10,colour:T.colours.muted,children:e.covers||''}),(0,C.jsx)(m.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?T.colours.red:e.future?'#6B5A3A':T.colours.gold}}),(0,C.jsx)(x.T,{size:9,colour:4===t?T.colours.gold:T.colours.muted,children:(0,n.hm)(e.from)})]},t))}),k.map(e=>(0,C.jsxs)(x.T,{size:13,colour:T.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,n.hm)(e.from),"\u2013",(0,n.hm)((0,n.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),$>r?(0,C.jsxs)(x.T,{size:13,colour:T.colours.amber,children:["\u26a0 Next hour about ",S," Covers with ",r," on: about ",$-r," more on the floor suggested."]}):(0,C.jsxs)(x.T,{size:13,colour:T.colours.ok,children:["Staffing looks OK for the next hour (",r," on)."]}),(0,C.jsx)(x.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),r=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,n.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,j.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{children:e}),(0,C.jsx)(x.T,{weight:"semibold",children:t})]},e);return(0,C.jsxs)(x.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(r)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,C.jsx)(x.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return j.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]),c=_r(d[9]);_r(d[10]);var b=e(_r(d[11])),h=e(_r(d[12])),m=e(_r(d[13])),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]),C=_r(d[25]);const I=({title:e,right:t,children:s,testID:l})=>(0,C.jsxs)(m.default,{testID:l,style:{backgroundColor:T.colours.surface,borderRadius:14,borderWidth:1,borderColor:T.colours.border,padding:10,gap:6},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{weight:"semibold",colour:T.colours.gold,children:e}),t]}),s]});const B=e=>(0,C.jsxs)(m.default,{style:{gap:6},children:[(0,C.jsxs)(x.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,C.jsxs)(x.Muted,{children:[e.time," \xb7 ",e.table?(0,j.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,C.jsx)(k.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,C.jsx)(c.BookingNeeds,{b:e,big:!0}),e.notes?(0,C.jsxs)(x.T,{children:["Notes: ",e.notes]}):(0,C.jsx)(x.Muted,{children:"No notes."}),e.allergies.length?(0,C.jsx)(m.default,{style:{backgroundColor:T.colours.redBg,borderRadius:8,padding:8},children:(0,C.jsxs)(x.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,w.allergenLabel)(e.allergen)} \u2014 ${(0,w.severityLabel)(e.severity)}`).join('; ')]})}):(0,C.jsx)(x.Muted,{children:"No allergies declared."}),(0,C.jsx)(t.ShowNumberButton,{b:e},`num-${e.id}`)]});const D=!0},1356,[1353,828,827,860,1140,1114,1132,858,34,1102,236,402,295,102,794,1119,1344,874,1025,861,1112,1100,1303,821,1318,25]); __d(function(g,_r,_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.']}]},1357,[827,34,236,402,102,794,874,1025,1358,821,1359,1361,25]); __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1358,[]); @@ -1475,7 +1475,7 @@ __d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModul __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1392,[34,402,1166,794,821,25]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.undoKind=f,_e.BookingUndo=function({b:e,rid:t,today:h,who:k}){const[$,w]=(0,s.useState)(!1),y=f(e,h);if(!y)return null;const p=(0,l.tableCardLabel)(e.table),j=l.useFloor.getState().setLive;if('unseat'===y)return $?(0,b.jsxs)(o.default,{testID:`unseat-confirm-${e.id}`,accessibilityLiveRegion:"polite",style:{gap:6,width:'100%',borderWidth:1.5,borderColor:c.colours.gold,borderRadius:12,padding:10},children:[(0,b.jsxs)(u.T,{size:16,weight:"semibold",colour:c.colours.text,children:["Unseat ",k,"? ",e.walkIn?'The walk-in is removed':'They go back to Booked',p?` and ${p} ${(0,l.tablesOf)(e.table).length>1?'are':'is'} free again`:'',"."]}),(0,b.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(u.Button,{small:!0,label:"Yes, unseat",testID:`unseat-yes-${e.id}`,accessibilityLabel:`Yes, unseat ${k}`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,e.walkIn?'cancelled':'confirmed'),(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:void 0,dirty:!1})),w(!1)}}),(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Keep seated",accessibilityLabel:`Keep ${k} seated`,onPress:()=>w(!1)})]})]}):(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Unseat",testID:`unseat-${e.id}`,accessibilityLabel:`Unseat ${k}: ${e.walkIn?'removes the walk-in':'back to booked'}${p?`, frees ${p}`:''}`,onPress:()=>w(!0)});const x='undo-finished'===y?'seated':'confirmed';return(0,b.jsx)(u.Button,{small:!0,kind:"ghost",label:"Undo",testID:`undo-status-${e.id}`,accessibilityLabel:'undo-finished'===y?`Undo finished: ${k} back to seated${p?` at ${p}`:''}`:`Undo no-show: ${k} back to booked`,onPress:async()=>{await n.repo.bookings.setStatus(e.id,x),'seated'===x&&(0,l.tablesOf)(e.table).forEach(e=>j(t,e,{stage:'seated',dirty:!1}))}})};var e,s=r(d[0]),t=r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),l=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]);function f(e,s){if('seated'===e.status)return'unseat';const t=e.date===s||!!e.finishedAt&&e.finishedAt.slice(0,10)===s;return'finished'===e.status&&t?'undo-finished':'noshow'===e.status&&t?'undo-noshow':null}},1393,[34,102,874,1025,794,821,25]); __d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1394,[34,102,879,874,864,821,794,25]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=E,_e.signInWithText=H,_e.SignInWithLink=V,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return!h.IS_CAR&&(v.includes(h.APP_VARIANT)&&!b.PITCH&&!e&&!M())},_e.InviteGate=function(){const[e,H]=(0,u.useState)(p.useSession.persist.hasHydrated()),[D,F]=(0,u.useState)(p.START_INVITE||p.START_HANDOVER?'checking':'done'),[W,L]=(0,u.useState)(null),[K,U]=(0,u.useState)(0),[G,Y]=(0,u.useState)(!1),[$,B]=(0,u.useState)(null),X=(0,p.useSession)(e=>e.meId),Q=(0,p.useSession)(e=>!X||!!e.welcomed[X]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>H(!0));return p.useSession.persist.hasHydrated()&&H(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_HANDOVER&&!p.START_INVITE&&!z){z=!0;const n=await(0,I.claimChromeHandover)(p.START_HANDOVER);if(!t)return;if('ok'===n.status&&n.id.staffRef){R(N(n.id.staffRef)??E({id:n.id.staffRef,name:n.id.displayName||n.id.staffRef,role:'owner'===n.id.role?'owner':'manager'===n.id.role?'manager':'staff',level:'head_chef'===n.id.role?'Head Chef':void 0,job:'',active:!0}))}else if('refused'===n.status&&!e)return L(n.message),void F('done')}if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&L(e)});if(!t)return;if('refused'===e.kind)return L(e.message),void F('done');if('offline'===e.kind)return Y(!0),void(n=setTimeout(()=>{t&&U(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void F('bad')}const o=N(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),B(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}F('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,K]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!X){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t,{app:s,message:l})})}if(G)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===D)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!X&&!b.PITCH)return W&&/already been used/i.test(W)?j(x,'invite-app-used'):W&&(0,S.isPhoneLinked)(W)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):W?j(W,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===D)return(0,w.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,w.jsx)(T.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,w.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F('done')}),(0,w.jsx)(T.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(W&&!X&&(0,S.isPhoneLinked)(W))return(0,w.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:24,weight:"bold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,w.jsx)(T.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,w.jsx)(T.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(W&&!X)return(0,w.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,w.jsx)(T.Muted,{center:!0,children:W}),(0,w.jsx)(T.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,w.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>L(null)})]});if($&&!X)return(0,w.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,w.jsx)(T.Muted,{center:!0,children:$}),(0,w.jsx)(V,{})]});if(!X&&!b.PITCH&&!M())return(0,w.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:W?'This link can\u2019t be used here':'Sign in to CoverCharge'}),W?(0,w.jsx)(T.Muted,{center:!0,children:W}):null,(0,w.jsx)(T.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,w.jsx)(V,{})]});const q=(0,p.rosterPerson)(X);return q&&!Q&&_(q)?(0,w.jsx)(k.LaunchWelcome,{p:q,onDone:()=>p.useSession.getState().markWelcomed(q.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),m=_r(d[12]),k=_r(d[13]),T=_r(d[14]),I=_r(d[15]),b=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),w=_r(d[20]);const x='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,w.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const N=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return R(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=N(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=N(o.id.staffRef)??E({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return R(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function V(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,w.jsxs)(f.default,{style:{gap:6},children:[(0,w.jsx)(T.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsx)(T.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,w.jsx)(T.T,{size:13,colour:m.colours.red,children:t}):null]})}let z=!1;const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1395,[5,1396,1397,1398,1399,1400,34,236,41,102,872,1003,821,1401,794,988,2,1093,1002,892,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=E,_e.signInWithText=H,_e.SignInWithLink=V,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId),n=(0,T.useSync)(e=>'device'===e.kind&&!!e.venueId);return h.IS_CAR?!b.PITCH&&!n:j.includes(h.APP_VARIANT)&&!b.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,H]=(0,u.useState)(p.useSession.persist.hasHydrated()),[D,F]=(0,u.useState)(p.START_INVITE||p.START_HANDOVER?'checking':'done'),[W,L]=(0,u.useState)(null),[K,U]=(0,u.useState)(0),[G,Y]=(0,u.useState)(!1),[$,B]=(0,u.useState)(null),X=(0,p.useSession)(e=>e.meId),Q=(0,p.useSession)(e=>!X||!!e.welcomed[X]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>H(!0));return p.useSession.persist.hasHydrated()&&H(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!j.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_HANDOVER&&!p.START_INVITE&&!z){z=!0;const n=await(0,T.claimChromeHandover)(p.START_HANDOVER);if(!t)return;if('ok'===n.status&&n.id.staffRef){R(N(n.id.staffRef)??E({id:n.id.staffRef,name:n.id.displayName||n.id.staffRef,role:'owner'===n.id.role?'owner':'manager'===n.id.role?'manager':'staff',level:'head_chef'===n.id.role?'Head Chef':void 0,job:'',active:!0}))}else if('refused'===n.status&&!e)return L(n.message),void F('done')}if(p.START_INVITE&&!(e&&await(0,T.signedInHereAs)(e)&&await(0,T.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&L(e)});if(!t)return;if('refused'===e.kind)return L(e.message),void F('done');if('offline'===e.kind)return Y(!0),void(n=setTimeout(()=>{t&&U(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void F('bad')}const o=N(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,T.signedInHereAs)(o.id)){if(await(0,T.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),B(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}F('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,K]),!j.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!X){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t,{app:s,message:l})})}if(G)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===D)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!X&&!b.PITCH)return W&&/already been used/i.test(W)?v(x,'invite-app-used'):W&&(0,S.isPhoneLinked)(W)?v(S.PHONE_LINKED_TEXT,'invite-phone-linked'):W?v(W,'invite-app-refused'):v(P,'invite-app-notsetup');if('bad'===D)return(0,w.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,w.jsx)(I.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,w.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F('done')}),(0,w.jsx)(I.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(W&&!X&&(0,S.isPhoneLinked)(W))return(0,w.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:24,weight:"bold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,w.jsx)(I.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,w.jsx)(I.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(W&&!X)return(0,w.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,w.jsx)(I.Muted,{center:!0,children:W}),(0,w.jsx)(I.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,w.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>L(null)})]});if($&&!X)return(0,w.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,w.jsx)(I.Muted,{center:!0,children:$}),(0,w.jsx)(V,{})]});if(!X&&!b.PITCH&&!M())return(0,w.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:W?'This link can\u2019t be used here':'Sign in to CoverCharge'}),W?(0,w.jsx)(I.Muted,{center:!0,children:W}):null,(0,w.jsx)(I.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,w.jsx)(V,{})]});const q=(0,p.rosterPerson)(X);return q&&!Q&&_(q)?(0,w.jsx)(k.LaunchWelcome,{p:q,onDone:()=>p.useSession.getState().markWelcomed(q.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),m=_r(d[12]),k=_r(d[13]),I=_r(d[14]),T=_r(d[15]),b=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),w=_r(d[20]);const x='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,n)=>(0,w.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:e})}),j=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const N=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return R(t),_(t)?((0,T.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=N(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,T.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=N(o.id.staffRef)??E({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return R(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function V(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,w.jsxs)(f.default,{style:{gap:6},children:[(0,w.jsx)(I.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsx)(I.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,w.jsx)(I.T,{size:13,colour:m.colours.red,children:t}):null]})}let z=!1;const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1395,[5,1396,1397,1398,1399,1400,34,236,41,102,872,1003,821,1401,794,988,2,1093,1002,892,25]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1396,[34,102,873,794,5,6,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1397,[]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1398,[34,102,873,794,25]); diff --git a/owner-app/admin.html b/owner-app/admin.html index 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 ebaae63bf85fbeac35be0c70eaecfb81dcd69d37..f55bd197852f44c1aefd027a5415b86ee44b38c7 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 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 2b14bc131b37a85fc6a6ba4d6b318b7a3647109d..9aed8ce92914747d9d54d3cf587fa3d90a4d63d0 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-fd16f4d72f"; +const V = "cc-owner-187a79d6ea"; const BASE = "/owner-app/"; -const PRECACHE = ["/owner-app/apple-touch-icon.png", "/owner-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/owner-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/owner-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/owner-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/owner-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/owner-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/owner-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/owner-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/owner-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/owner-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/owner-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/owner-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/owner-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/owner-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/owner-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/owner-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/owner-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/owner-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/owner-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/owner-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/owner-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/owner-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/owner-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/owner-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/owner-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/owner-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/owner-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/owner-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/owner-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/owner-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/owner-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/owner-app/brand-logo.png", "/owner-app/favicon.ico", "/owner-app/icon-192.png", "/owner-app/icon-512.png", "/owner-app/icon-maskable-192.png", "/owner-app/icon-maskable-512.png", "/owner-app/manifest.webmanifest", "/owner-app/index.html", "/owner-app/_expo/static/js/web/bundle.js?v=fd16f4d72f747ee8ac1af6bdd7f27cd6bf752bab32b31ce1e8b08c6d5c04a83d"]; +const PRECACHE = ["/owner-app/apple-touch-icon.png", "/owner-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/owner-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/owner-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/owner-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/owner-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/owner-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/owner-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/owner-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/owner-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/owner-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/owner-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/owner-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/owner-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/owner-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/owner-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/owner-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/owner-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/owner-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/owner-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/owner-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/owner-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/owner-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/owner-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/owner-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/owner-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/owner-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/owner-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/owner-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/owner-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/owner-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/owner-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/owner-app/brand-logo.png", "/owner-app/favicon.ico", "/owner-app/icon-192.png", "/owner-app/icon-512.png", "/owner-app/icon-maskable-192.png", "/owner-app/icon-maskable-512.png", "/owner-app/manifest.webmanifest", "/owner-app/index.html", "/owner-app/_expo/static/js/web/bundle.js?v=187a79d6ead6d7b9c48fe44ddb3cc88a53c1f1dd3ac44510ca1801d16db60f77"]; // 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 7db1bf74de3bae18227e003f4ddcc25ca2583ecc..6dabb505092f35f78d4f548b0e369c708742ef0c 100644 --- a/owner-app/team.html +++ b/owner-app/team.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/staff-app/_expo/static/js/web/bundle.js b/staff-app/_expo/static/js/web/bundle.js index 7619051edb3f3a4b73480b4033fc5ffed234f252..ac7d124923346b5ca0b74d335e3e16f1c855e419 100644 --- a/staff-app/_expo/static/js/web/bundle.js +++ b/staff-app/_expo/static/js/web/bundle.js @@ -1095,7 +1095,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()})},1012,[34,1013]); __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},1013,[1010,978,1014]); __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'}},1014,[1010]); -__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.155'},1015,[]); +__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.156'},1015,[]); __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});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:h}=await r.select();c&&s(c,h);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},h='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,h.map(t=>[this.keyOf(t),t]),t=>o.mutationQueue.hasPending(this.table,n,t)),h}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),h={...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:h})}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}}},1016,[1017,1018,934,978,1013]); __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())}}}},1018,[978]); @@ -1196,9 +1196,9 @@ __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,"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'},1113,[821]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},1114,[34,102,1115,821,1116,794,25]); __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 b={...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)(b)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(b,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}});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})},1115,[860,1100]); -__d(function(_g,r,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=$,_e.TablePicker=function({rid:e,booking:u,name:p,turnBase:k=90,onClose:v,onSaved:w,onPickOnPlan:T}){const C=(0,b.usePlan)(e),L=(0,c.useBookings)(e),[S,W]=(0,t.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),P=(0,t.useMemo)(()=>(0,h.pickGroups)(C),[C]),z=L.filter(e=>e.date===u.date),O=(0,h.seatsOf)(C,S),D=(0,h.seatLine)(O.total,u.partySize),I=(0,h.pickClashes)(u,S,z,k),B=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,M=(0,h.tableKey)(S)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),N=(0,f.useBlocks)(e=>e.blocks),R=(0,f.blockAt)(N,e,u.date,u.time),_=e=>W(s=>(0,h.toggleTable)(s,e)),Y=async s=>{try{await $(e,u,s),w?.((0,h.savedWords)(p,u.partySize,s,(0,h.seatsOf)(C,s).total)),v()}catch(e){w?.(`Couldn\u2019t save tables for ${p}: ${String(e?.message??e).slice(0,120)}`)}},G=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(S)} picked. ${D.text}.`,children:[(0,x.jsx)(y.T,{size:18,weight:"semibold",colour:g.colours.goldLight,children:(0,h.tablesWords)(S)}),(0,x.jsx)(y.T,{size:17,colour:g.colours.text,children:D.text})]}),R?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${R.from} to ${R.to}${R.reason?` (${R.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.goldMuted},children:(0,x.jsxs)(y.T,{size:16,colour:g.colours.goldLight,children:["New bookings paused ",R.from,"\u2013",R.to,R.reason?` \xb7 ${R.reason}`:'',". You can still save tables for this booking."]})}):null,I.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(I)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.gold},children:(0,x.jsxs)(y.T,{size:16,weight:"semibold",colour:g.colours.goldLight,children:[(0,h.clashWords)(I)," You can still save."]})}):null,(0,x.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(y.Button,{testID:"table-pick-save",label:I.length?'Save anyway':'Save tables',disabled:!M||!S.length,accessibilityLabel:`${I.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(S)} for ${p}. ${D.text}.${I.length?` ${(0,h.clashWords)(I)}`:''}`,onPress:()=>Y(S),style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(y.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${p}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(y.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:v,style:j})]})]});return(0,x.jsxs)(y.Sheet,{visible:!0,onClose:v,title:`Tables \xb7 ${u.time} ${p} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:G,children:[(0,x.jsx)(s.TableNumberWarning,{plan:C}),(0,x.jsx)(y.T,{size:16,colour:g.colours.text,children:"Tap one table, or several to join them. Tap again to take one off."}),T?(0,x.jsx)(y.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${p}`,onPress:()=>T(S),style:j}):null,P.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(y.T,{size:15,weight:"semibold",colour:g.colours.gold,children:e.area}),(0,x.jsx)(y.Row,{gap:8,wrap:!0,children:e.tables.map(e=>{const s=S.includes(e.name),t=B(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:s},'aria-checked':s,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,s,t),onPress:()=>_(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:s?2:1,borderColor:s?g.colours.gold:t?g.colours.goldMuted:g.colours.hairline,borderStyle:t&&!s?'dashed':'solid',backgroundColor:s?g.colours.gold:e?g.colours.tilePressed:g.colours.tile}),children:[(0,x.jsx)(y.T,{size:18,weight:"semibold",colour:s?g.colours.onGold:g.colours.text,children:(0,l.tableNumbers)(e.name)}),(0,x.jsxs)(y.T,{size:14,colour:s?g.colours.onGold:g.colours.muted,children:[e.seats," seats",t?' \xb7 booked':'']})]},e.name)})})]},e.area)),P.length?null:(0,x.jsx)(y.Muted,{children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var s=r(d[0]),l=r(d[1]),t=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),g=r(d[9]),p=r(d[10]),y=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function $(e,s,l){const t=(0,h.tableKey)(l),o=(0,b.tablesOf)(s.table);await c.repo.bookings.update(s.id,(0,u.tablePatch)(t||null)),'seated'===s.status&&s.date===(0,p.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(t).includes(e)).forEach(s=>b.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0})),t&&(0,k.resetTableLive)(e,t))}},1116,[1117,860,34,402,102,874,1025,1115,1118,821,858,794,1119,1022,25]); +__d(function(_g,r,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=v,_e.TablePicker=function({rid:e,booking:u,name:g,turnBase:k=90,onClose:$,onSaved:w,onPickOnPlan:C}){const L=(0,b.usePlan)(e),S=(0,c.useBookings)(e),[T,P]=(0,l.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),W=(0,l.useMemo)(()=>(0,h.pickGroups)(L),[L]),z=S.filter(e=>e.date===u.date),I=(0,h.seatsOf)(L,T),D=(0,h.seatLine)(I.total,u.partySize),B=(0,h.pickClashes)(u,T,z,k),O=e=>(0,h.pickClashes)(u,[e],z,k)[0]?.with,R=(0,h.tableKey)(T)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),M=(0,f.useBlocks)(e=>e.blocks),N=(0,f.blockAt)(M,e,u.date,u.time),[_,A]=(0,l.useState)(null),G=e=>{A(null),P(t=>(0,h.toggleTable)(t,e))},Y=async t=>{try{await v(e,u,t),w?.((0,h.savedWords)(g,u.partySize,t,(0,h.seatsOf)(L,t).total)),$()}catch(e){w?.(`Couldn\u2019t save tables for ${g}: ${String(e?.message??e).slice(0,120)}`)}},K=(0,x.jsxs)(n.default,{style:{gap:8},children:[(0,x.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(T)} picked. ${D.text}.`,children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",center:!0,colour:y.colours.goldLight,children:(0,h.tablesWords)(T)}),(0,x.jsx)(p.T,{size:17,center:!0,colour:y.colours.text,children:D.text})]}),N?(0,x.jsx)(n.default,{testID:"table-pick-pause",accessible:!0,accessibilityLabel:`Note. New bookings are paused ${N.from} to ${N.to}${N.reason?` (${N.reason})`:''}. You can still assign tables to this booking.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.goldMuted},children:(0,x.jsxs)(p.T,{size:16,center:!0,colour:y.colours.goldLight,children:["New bookings paused ",N.from,"\u2013",N.to,N.reason?` \xb7 ${N.reason}`:'',". You can still save tables for this booking."]})}):null,B.length?(0,x.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(B)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:y.colours.gold},children:(0,x.jsxs)(p.T,{size:16,weight:"semibold",center:!0,colour:y.colours.goldLight,children:[(0,h.clashWords)(B)," You can still save."]})}):null,_?(0,x.jsxs)(n.default,{testID:"table-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:_,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:y.colours.amber,backgroundColor:y.colours.amberBg,alignItems:'stretch'},children:[(0,x.jsx)(p.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:_}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,x.jsx)(p.Button,{testID:"table-pick-overcap-yes",label:"Use it anyway",accessibilityLabel:`Use it anyway, ${(0,h.tablesWords)(T)} for ${g}, ${u.partySize} people`,onPress:()=>{Y(T)},style:[j,{flexGrow:1}]}),(0,x.jsx)(p.Button,{testID:"table-pick-overcap-no",kind:"secondary",label:"Pick another table",onPress:()=>A(null),style:j})]})]}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[_?null:(0,x.jsx)(p.Button,{testID:"table-pick-save",label:B.length?'Save anyway':'Save tables',disabled:!R||!T.length,accessibilityLabel:`${B.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(T)} for ${g}. ${D.text}.${B.length?` ${(0,h.clashWords)(B)}`:''}`,onPress:()=>{const e=(0,h.overCapacityAsk)(T,I.total,u.partySize);!e||_?Y(T):A(e)},style:[j,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,x.jsx)(p.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${g}`,onPress:()=>Y([]),style:j}):null,(0,x.jsx)(p.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:$,style:j})]})]});return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:$,title:`Tables \xb7 ${u.time} ${g} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:K,children:[(0,x.jsx)(t.TableNumberWarning,{plan:L}),(0,x.jsx)(p.T,{size:16,center:!0,colour:y.colours.text,children:"Tap one table, or several to join them. Tap again to take one off. Smaller tables can still be used."}),C?(0,x.jsx)(p.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${g}`,onPress:()=>C(T),style:j}):null,W.map(e=>(0,x.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,x.jsx)(p.T,{size:15,weight:"semibold",center:!0,colour:y.colours.gold,children:e.area}),(0,x.jsx)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:e.tables.map(e=>{const t=T.includes(e.name),l=O(e.name);return(0,x.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:t},'aria-checked':t,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,t,l),onPress:()=>G(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?y.colours.gold:l?y.colours.goldMuted:y.colours.hairline,borderStyle:l&&!t?'dashed':'solid',backgroundColor:t?y.colours.gold:e?y.colours.tilePressed:y.colours.tile}),children:[(0,x.jsx)(p.T,{size:18,weight:"semibold",colour:t?y.colours.onGold:y.colours.text,children:(0,s.tableNumbers)(e.name)}),(0,x.jsxs)(p.T,{size:14,colour:t?y.colours.onGold:y.colours.muted,children:[e.seats," seats",l?' \xb7 booked':'']})]},e.name)})})]},e.area)),W.length?null:(0,x.jsx)(p.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=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),y=r(d[9]),g=r(d[10]),p=r(d[11]),k=r(d[12]),f=r(d[13]),x=r(d[14]);const j={minHeight:56};async function v(e,t,s){const l=(0,h.tableKey)(s),o=(0,b.tablesOf)(t.table);await c.repo.bookings.update(t.id,(0,u.tablePatch)(l||null)),'seated'===t.status&&t.date===(0,g.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(l).includes(e)).forEach(t=>b.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0})),l&&(0,k.resetTableLive)(e,l))}},1116,[1117,860,34,402,102,874,1025,1115,1118,821,858,794,1119,1022,25]); __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])},1117,[34,859,821,794,25]); -__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1118,[860,1100]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.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=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1118,[860,1100]); __d(function(g,_r,_i,_a,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 O}}),_e.useTableNames=N,_e.resetTableLive=M,_e.seatBookingNow=L,_e.finishBookingNow=async function(e,t){await f.repo.bookings.setStatus(t.id,'finished'),(0,S.tablesOf)(t.table).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=F,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return R}}),_e.TablePicker=W,_e.WalkInSheet=E,_e.WalkInMatchPrompt=H,_e.AssignTableSheet=_,_e.undoNotice=Y,_e.NewBookingSheet=U,_e.useFrontDoor=function(e,t){const[s,o]=(0,r.useState)(!1),[l,a]=(0,r.useState)(!1),[i,d]=(0,r.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>a(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,B.jsxs)(B.Fragment,{children:[s?(0,B.jsx)(E,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:Y}):null,l?(0,B.jsx)(U,{wide:t,date:e,onClose:()=>a(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${e.time}`})}):null,i?(0,B.jsx)(_,{booking:i.b,combine:i.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),a=_r(_d[4]),i=_r(_d[5]),n=_r(_d[6]),r=_r(_d[7]),d=e(r),u=_r(_d[8]),c=e(_r(_d[9])),b=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),k=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),D=_r(_d[23]),I=_r(_d[24]),$=_r(_d[25]),P=_r(_d[26]),z=_r(_d[27]),B=_r(_d[28]);const O=Array.from({length:12},(e,t)=>String(t+1));function N(e){const t=(0,S.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function M(e,t){(0,S.tablesOf)(t).forEach(t=>S.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}async function L(e,t){await f.repo.bookings.setStatus(t.id,'seated'),M(e,t.table)}function F(e,t){const s=(0,f.useBookings)(e),o=(0,f.useOrders)(e),l=N(e),a=(0,S.useFloor)(t=>t.live[e])??{},i=(0,S.usePlan)(e),n=(0,v.useBlocks)(e=>e.blocks),r=(0,x.ymd)(t),d=(0,v.closedAreasAt)(n,e,r,(0,x.hm)(t)),u={};for(const e of l)u[e]=a[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(i.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:a[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,S.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,x.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const R=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function W({use:e,value:t,onPick:s,big:o,best:a,dense:i,bestSet:n,picked:d}){const u=Object.keys(e),[h,p]=(0,r.useState)(0),f=i?6:8,y=i?64:o?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,x=k?Math.floor((h-f*(k-1))/k):y,w=new Set(n??[]),v=a?(0,S.tablesOf)(a)[0]:null;return(0,B.jsx)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:u.map(o=>{const a=e[o],n=t===o||!!d?.includes(o),r=w.has(o),u=v===o&&!n,h=a.busy?['Blocked','Needs clearing','Closed'].includes(a.label)?a.label:'In use':a.soon??'Free';return(0,B.jsxs)(c.default,{accessibilityRole:"button",testID:`pick-table-${o}`,accessibilityLabel:`Table ${(0,l.tableNumbers)(o)}${d?n?', picked':', not picked':''}, ${a.busy?`in use (${a.label})`:a.soon?`free, ${a.soon}`:'free'}${r?', best table':''}${u?', suggested for this party':''}`,accessibilityState:{selected:n,disabled:'Closed'===a.label},disabled:'Closed'===a.label,onPress:()=>s(o),style:{width:x,minHeight:i?58:64,borderRadius:12,borderWidth:n||u?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:n||u?j.colours.gold:a.busy?j.colours.red:j.colours.ok,backgroundColor:n?j.colours.goldTint:a.busy?j.colours.redBg:j.colours.surface2,opacity:'Closed'!==a.label||n?1:.55},children:[(0,B.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,B.jsx)(T.T,{weight:"bold",size:22,colour:n?j.colours.goldLight:j.colours.text,children:(0,l.tableNumbers)(o)}),r?(0,B.jsx)(b.default,{testID:"best-table",style:{backgroundColor:j.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,B.jsx)(T.T,{size:11,weight:"bold",colour:j.colours.onGold,children:"BEST"})}):null]}),(0,B.jsx)(T.T,{size:i?13:14,colour:a.busy?'#FFD9D4':a.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},o)})})}const A=[1,2,3,4,5,6,7,8];function E({onClose:e,onSeated:a,wide:i,initialTable:y}){const{rid:w,r:C,now:D}=(0,p.useCtx)(15e3),I=F(w,D),[$,P]=(0,r.useState)(2),[O,N]=(0,r.useState)(!1),[R,E]=(0,r.useState)(y??null),_=(0,S.usePlan)(w),Y=(0,f.useBookings)(w),U=(0,v.useBlocks)(e=>e.blocks),q=(0,v.closedAreasAt)(U,w,(0,x.ymd)(D),(0,x.hm)(D)),Q=d.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(I).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(_,Y.filter(e=>e.date===(0,x.ymd)(D)),e,$,D,(0,k.turnFor)($,C.settings.turnMins),90,void 0,{closed:q})?.table??null},[_,Y,I,$,q.size,D.getTime()]);(0,r.useEffect)(()=>{R&&(0,S.tablesOf)(R).some(e=>'Closed'===I[e]?.label)&&E(null)},[R,q.size]);const[V,G]=(0,r.useState)(!1),[K,X]=(0,r.useState)(''),J=(e,t=String(e),s=()=>{N(!1),P(e)})=>{const o='9+'===t?O:!O&&$===e;return(0,B.jsx)(c.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:i?58:60,height:i?58:56,borderRadius:14,borderWidth:2,borderColor:j.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?j.colours.gold:'transparent'},children:(0,B.jsx)(T.T,{weight:"bold",size:22,colour:o?j.colours.onGold:j.colours.gold,children:t})},t)},Z=(0,B.jsx)(s.PartySizeInput,{value:$,onChange:P,min:9,max:o.MAX_PARTY,label:"Walk-in party size",testID:"walkin-party-size"}),ee=(0,B.jsxs)(b.default,{style:{gap:8,width:i?256:void 0},children:[(0,B.jsx)(T.T,{weight:"semibold",children:"How many people?"}),(0,B.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[A.map(e=>J(e)),J(9,'9+',()=>{N(!0),P(e=>e>=9?e:9)})]}),O?Z:null]}),[te,se]=(0,r.useState)(!1),[oe,le]=(0,r.useState)(null),ae=async(t=R,s=!1)=>{if(!te){if(!s){const e=(0,z.bookingsNearWalkIn)(Y,D,$);if(e.length)return void le({at:t,list:e})}se(!0);try{const s=await f.repo.bookings.seatWalkIn(w,$,t??void 0,K);M(w,t??void 0),a(s),e()}finally{se(!1)}}},ie=async(t,s)=>{if(!te){se(!0);try{const o=s??t.table??null;o&&o!==t.table&&await f.repo.bookings.assignTable(t.id,o),await L(w,{...t,table:o??void 0}),(0,n.notify)({id:`seated:${t.id}`,testID:'walkin-match-toast',timeoutMs:5e3,icon:'\u2713',title:`${t.name} seated \xb7 ${t.partySize} \xb7 ${o?(0,l.tableNumbers)(o):'table to assign'} (booking ${t.ref})`}),le(null),e()}finally{se(!1)}}},ne=(0,B.jsxs)(b.default,{style:{gap:8,flex:i?1:void 0,minWidth:0},children:[(0,B.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(T.T,{weight:"semibold",children:["Table ",(0,B.jsx)(T.T,{colour:j.colours.muted,size:14,children:"(optional)"})]}),R?(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>E(null)}):null]}),(0,B.jsx)(W,{use:I,value:R,onPick:e=>{I[e]&&!I[e].busy?ae(e):E(R===e?null:e)},big:i,dense:i,best:Q,bestSet:(0,u.bestTables)(_)}),(0,B.jsxs)(T.Muted,{children:["Tap a free table to seat them there",Q&&!R?` (suggested for ${$}: ${(0,l.tableNumbers)(Q)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,x.hm)(D)}`,maxWidth:i?1100:void 0,testID:"walkin-sheet",children:[(0,B.jsx)(T.Button,{label:`Seat walk-in \xb7 ${$} ${1===$?'person':'people'}${R?` \xb7 ${(0,l.tableNumbers)(R)}`:''}`,disabled:te,onPress:()=>{ae()},testID:"seat-walkin",style:{minHeight:52}}),i?(0,B.jsxs)(T.Row,{gap:16,style:{alignItems:'flex-start'},children:[ee,ne]}):(0,B.jsxs)(B.Fragment,{children:[ee,ne]}),(0,B.jsxs)(T.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[V?(0,B.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:K,onChangeText:X,style:[T.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,B.jsx)(T.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>G(!0)}),(0,B.jsx)(b.default,{style:{flex:1,minWidth:220},children:(0,B.jsxs)(T.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==h.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]}),oe?(0,B.jsx)(H,{list:oe.list,busy:te,onYes:e=>{ie(e,oe.at)},onNo:()=>{const e=oe.at;le(null),ae(e,!0)},onClose:()=>le(null)}):null]})}function H({list:e,busy:t,onYes:s,onNo:o,onClose:a}){return(0,B.jsx)(T.Sheet,{visible:!0,onClose:a,title:"Booked party?",maxWidth:720,testID:"walkin-match",children:(0,B.jsxs)(b.default,{style:{gap:14},children:[e.map((e,o)=>(0,B.jsxs)(b.default,{testID:`walkin-match-${o}`,style:{gap:12,padding:16,borderRadius:16,borderWidth:2,borderColor:j.colours.gold,backgroundColor:'#15130F'},children:[(0,B.jsx)(b.default,{accessibilityRole:"header",accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:26,weight:"bold",colour:j.colours.goldLight,testID:"walkin-match-question",children:(0,z.walkInMatchQuestion)(e)})}),e.table?(0,B.jsxs)(T.T,{size:17,colour:j.colours.text,children:["Booked table ",(0,l.tableNumbers)(e.table)," \xb7 ",e.ref]}):(0,B.jsx)(T.T,{size:17,colour:j.colours.text,children:e.ref}),(0,B.jsx)(T.Button,{label:"Yes, seat booking",testID:"walkin-match-yes",disabled:t,accessibilityLabel:`Yes, seat ${e.name}'s booking, ${e.partySize} people`,onPress:()=>s(e),style:{minHeight:64}})]},e.id)),(0,B.jsx)(T.Button,{kind:"secondary",label:"No, new walk-in",testID:"walkin-match-no",disabled:t,onPress:o,style:{minHeight:64}})]})})}function _({booking:e,onClose:t,combine:s}){const{rid:o,r:a,now:i}=(0,p.useCtx)(15e3),n=F(o,i),c=(0,S.usePlan)(o),h=(0,f.useBookings)(o),y=(0,S.tablesOf)(e.table),w=d.default.useMemo(()=>Object.fromEntries(Object.entries(n).map(([e,t])=>[e,y.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[n,e.table]),v=d.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(w).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,k.suggestTable)(c,h.filter(e=>e.date===(0,x.ymd)(i)),t,e.partySize,i,(0,k.turnFor)(e.partySize,a.settings.turnMins),90,e.id)?.table??null},[c,h,w,e.partySize,i.getTime()]),[C,D]=(0,r.useState)(!!s||y.length>1),[I,$]=(0,r.useState)(y),P=e=>c.tables.find(t=>t.name===e)?.maxSeats??0,z=I.reduce((e,t)=>e+P(t),0),O=I.length>0&&z{const l=(0,S.joinTables)(s);await f.repo.bookings.assignTable(e.id,l);y.filter(e=>!s.includes(e)).forEach(t=>S.useFloor.getState().setLive(o,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&M(o,l),t()},L=C?(0,B.jsxs)(b.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,B.jsx)(b.default,{accessibilityLiveRegion:"polite",children:(0,B.jsx)(T.T,{size:17,weight:"semibold",colour:j.colours.text,children:I.length?`${(0,S.tablesLabel)((0,S.joinTables)(I))} \xb7 ${z} seats for ${e.partySize} Covers`:'No tables picked yet'})}),O?(0,B.jsx)(b.default,{testID:"combine-short",children:(0,B.jsxs)(T.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-z," more needed. Add another table."]})}):null,(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,B.jsxs)(T.Row,{gap:8,wrap:!0,children:[(0,B.jsx)(T.Button,{label:"Done",testID:"combine-done",disabled:!I.length,accessibilityLabel:I.length?`Done, save ${(0,S.tableCardLabel)((0,S.joinTables)(I))}`:'Done',onPress:()=>N(I)}),(0,B.jsx)(T.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,B.jsx)(b.default,{style:{gap:8},testID:"assign-table-tip",children:(0,B.jsx)(T.T,{size:15,colour:j.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`${C?'Combine tables':'Assign table'} \xb7 ${R(e)}`,testID:"assign-table-sheet",footer:L,children:[v&&!C?(0,B.jsx)(b.default,{testID:"assign-suggested",children:(0,B.jsxs)(T.T,{size:16,weight:"semibold",colour:j.colours.goldLight,accessibilityLabel:`Suggested for ${e.partySize}: ${(0,S.tableCardLabel)(v)}`,children:["Suggested for ",e.partySize,": ",(0,l.tableNumbers)(v)]})}):null,C?null:(0,B.jsx)(T.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,B.jsx)(W,{use:w,best:C?null:v,bestSet:(0,u.bestTables)(c),picked:C?I:void 0,onPick:C?e=>$(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await N([e])}})]})}function Y(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${R(e)} seated \xb7 ${e.table?`${(0,l.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>f.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function U({date:e,onClose:t,wide:n,onSaved:d}){const{rid:u,r:c,now:h,role:z,meId:O}=(0,p.useCtx)(6e4),N=(0,x.ymd)(h),[M,L]=(0,r.useState)(ee.blocks),[W,A]=(0,r.useState)(!1),[E,H]=(0,r.useState)(''),[_,Y]=(0,r.useState)(2),[U,q]=(0,r.useState)(null),[Q,V]=(0,r.useState)(''),[G,K]=(0,r.useState)(''),[X,J]=(0,r.useState)(''),[Z,ee]=(0,r.useState)('phone'),[te,se]=(0,r.useState)((0,D.emptyNeeds)()),oe=(0,D.needsMissing)(te),[le,ae]=(0,r.useState)(null),ie=(0,S.usePlan)(u),ne=(0,P.dogSetUp)(ie),re=!0===te.dog&&ne,de=te.dog?te.dogs:0,ue=(0,x.parseYmd)(M),ce=(0,k.turnFor)(_,c.settings.turnMins),be=F.filter(e=>e.date===M),he=e=>(0,k.freeTablesAt)(ie,be,_,new Date(`${M}${(0,l.tableNumbers)(e)}:00`),ce,c.settings.turnMins,{dog:!0,closed:(0,v.closedAreasAt)(R,u,M,e)}),ge=re&&U?he(U):[];(0,r.useEffect)(()=>{ae(null)},[re,U,_]);const pe=(0,y.bookingSlots)(c,ue,e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),_,M===(0,x.ymd)(h)?h:(0,x.addMins)(ue,0),e=>F.filter(t=>t.date===M&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).length),me=(0,w.ukPhone)(G),[fe,ye]=(0,r.useState)(!1),ke=U?pe.find(e=>e.time===U):void 0,xe=ke&&ke.left<_?{left:Math.max(0,ke.left),time:ke.time}:null,je=ke&&null!=ke.partiesLeft&&ke.partiesLeft<1?{time:ke.time,cap:ke.partiesCap??0}:null,we=xe||je,Te=U?(0,v.blockAt)(R,u,M,U):void 0,Se='staff'!==z,ve=!!U&&!(0,D.dogTimeOk)(c,F,M,U,de),Ce=!oe.length&&E.trim().length>=2&&!!U&&(!we||fe)&&(0,o.validParty)(_)&&me.ok&&(0,w.emailOk)(X)&&(!Te||Se&&W)&&(!re||ge.length>0)&&!ve,De=te.wheelchair>0||te.stepFree;return(0,B.jsxs)(T.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,x.niceDate)(ue)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,B.jsx)(D.FirstQuestions,{rid:u,value:te,onChange:se,party:_,audience:"staff"}),te.dog&&!ne?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,B.jsx)(C.BookingDatePicker,{r:c,today:h,value:M,onChange:e=>{e!==M&&(L(e),q(null),A(!1))}}),(0,B.jsxs)(T.Row,{gap:6,children:[(0,B.jsx)(T.Chip,{label:"Phone",selected:'phone'===Z,onPress:()=>ee('phone')}),(0,B.jsx)(T.Chip,{label:"In person",selected:'in-person'===Z,onPress:()=>ee('in-person')})]}),(0,B.jsx)(T.Field,{label:"Name",value:E,onChangeText:H,placeholder:"e.g. Reid",testID:"nb-name"}),(0,B.jsx)(T.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!me.ok&&G?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:me.error}):null,(0,B.jsx)(T.Field,{label:"Email (optional)",value:X,onChangeText:J,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,w.emailOk)(X)?null:(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,B.jsxs)(b.default,{style:{gap:6,alignItems:'center'},children:[(0,B.jsx)(T.T,{center:!0,children:"Covers"}),(0,B.jsx)(s.PartySizeInput,{value:_,onChange:e=>{Y(e),ye(!1)},label:"Covers",testID:"nb-party"})]}),(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:pe.map(e=>{const t=re&&e.available&&!he(e.time).length||!(0,D.dogTimeOk)(c,F,M,e.time,de);return(0,B.jsx)(T.Chip,{testID:`nb-slot-${e.time}`,label:e.time,sub:(0,v.blockAt)(R,u,M,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:U===e.time,onPress:()=>{q(e.time),A(!1),ye(!1)}},e.time)})}),we?(0,B.jsxs)(b.default,{testID:"nb-over-capacity",accessible:!0,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[xe?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overCapacityNote)(_,xe.left,xe.time)}):null,je?(0,B.jsx)(T.T,{weight:"semibold",colour:j.colours.amber,children:(0,o.overPartiesNote)(je.time,je.cap)}):null,(0,B.jsx)(T.Chip,{label:fe?'Booking over the limit: on':'Book anyway (over the limit)',selected:fe,onPress:()=>ye(e=>!e),testID:"nb-over-ok"})]}):null,re&&U?(0,B.jsxs)(b.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,B.jsxs)(T.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,B.jsxs)(T.T,{size:13,colour:j.colours.muted,children:["(",ie.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),ge.length?(0,B.jsx)(T.Row,{wrap:!0,gap:6,children:ge.slice(0,10).map((e,t)=>(0,B.jsx)(T.Chip,{label:`${(0,l.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${De&&(0,P.accessibleSetUp)(ie)&&!(0,P.isAccessible)(ie,e.table)?' \xb7 not step-free':''}`,selected:(le??ge[0].table)===e.table,onPress:()=>ae(e.table)},e.table))}):(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["No dog-friendly table free for ",_," at ",U,". Try another time."]})]}):null,Te?(0,B.jsxs)(b.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,B.jsxs)(T.T,{weight:"semibold",colour:j.colours.amber,children:["Bookings are paused ",Te.from,"\u2013",Te.to,Te.reason?` (${Te.reason})`:'']}),Se?(0,B.jsx)(T.Chip,{label:W?'Manager override on':'Override and book anyway',selected:W,onPress:()=>A(e=>!e)}):(0,B.jsx)(T.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,pe.length?null:(0,B.jsx)(b.default,{testID:"nb-closed",children:(0,B.jsxs)(T.T,{size:14,weight:"semibold",colour:j.colours.amber,children:["Closed on ",(0,x.niceDate)(ue)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,B.jsx)(D.MoreQuestions,{rid:u,r:c,value:te,onChange:se,party:_,date:M,time:U,today:(0,x.ymd)(h),bookings:F,audience:"staff",showTables:!1!==c.settings.tableRequests}),De&&!(0,P.accessibleSetUp)(ie)?(0,B.jsx)(T.T,{size:13,colour:j.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,B.jsx)(T.Field,{label:"Notes (optional)",value:Q,onChangeText:V,placeholder:I.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,i.depositDue)((0,i.depositOf)(c.settings),_)?(0,B.jsxs)(T.Muted,{children:["Deposit due: ",(0,a.gbp)((0,i.depositDue)((0,i.depositOf)(c.settings),_))," (",(0,a.gbp)((0,i.depositOf)(c.settings).perPersonPence)," per person for ",(0,i.depositOf)(c.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,B.jsxs)(T.Muted,{children:["The guest gets a confirmation text",X.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),ve?(0,B.jsxs)(T.T,{size:14,colour:j.colours.amber,children:["We already have the most dogs we can look after at ",U,". Try another time: dogs are very welcome then."]}):null,(0,B.jsx)(T.Button,{label:oe.length?oe[0]:'Save booking',testID:"nb-save",disabled:!Ce,onPress:()=>{if(M<(0,x.ymd)(h))return;const e=(0,D.needsPatch)(te),s=te.tableReq.find(e=>!re||ge.some(t=>t.table===e));f.repo.bookings.create({restaurantId:u,customerId:null,name:E.trim(),partySize:_,date:M,time:U,notes:Q.trim(),security:(0,i.depositDue)((0,i.depositOf)(c.settings),_)?'deposit':'none',depositPaid:0,...(0,i.depositDue)((0,i.depositOf)(c.settings),_)?{depositDue:(0,i.depositDue)((0,i.depositOf)(c.settings),_),depositPolicy:(0,i.depositWords)((0,i.depositOf)(c.settings),_,c.name).join(' '),depositRefundable:(0,i.depositOf)(c.settings).refundable,depositCutoffHours:(0,i.depositOf)(c.settings).cutoffHours}:{},phone:me.pretty,email:X.trim()||void 0,source:Z,...e,...pe.find(e=>e.time===U)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...re?{table:le??s??ge[0]?.table}:{}}).then(e=>(0,$.postNewBookingToKitchen)(e,O)).catch(()=>{}),d?.({date:M,time:U,name:E.trim()}),t()}})]})}},1119,[827,1120,1121,860,867,14,1122,34,859,402,102,872,1084,874,1123,1100,858,821,864,794,1025,1022,1124,1125,1130,1102,1096,1131,25]); __d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PartySizeInput=function({value:e,onChange:p,min:b=s.MIN_PARTY,max:y=s.MAX_PARTY,label:f="Party size",testID:h="party-size"}){const[x,$]=(0,t.useState)(String(e));(0,t.useEffect)(()=>{$(String(e))},[e]);const w=e=>p((0,s.clampParty)(e,b,y)),I=(t,n,l)=>{const s=t<0?e<=b:e>=y;return(0,d.jsx)(o.default,{testID:`${h}-${t>0?'up':'down'}${10===Math.abs(t)?'10':''}`,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:s},disabled:s,onPress:()=>w(e+t),hitSlop:4,style:{minWidth:44,height:44,paddingHorizontal:8,borderRadius:22,borderWidth:1.5,borderColor:c.colours.gold,alignItems:'center',justifyContent:'center',opacity:s?.4:1},children:(0,d.jsx)(u.T,{size:10===Math.abs(t)?14:20,weight:"semibold",colour:c.colours.gold,center:!0,children:n})},t)};return(0,d.jsxs)(l.default,{testID:h,style:{flexDirection:'row',alignItems:'center',gap:6,flexWrap:'wrap',justifyContent:'center'},children:[y-b>=20?I(-10,'\u221210',"10 fewer people"):null,I(-1,'\u2212','One fewer person'),(0,d.jsx)(n.default,{testID:`${h}-input`,value:x,keyboardType:"number-pad",inputMode:"numeric",maxLength:3,selectTextOnFocus:!0,accessibilityLabel:`${f}, ${b} to ${y} people`,accessibilityValue:{min:b,max:y,now:e,text:`${e} ${1===e?'person':'people'}`},onChangeText:e=>{$(e.replace(/\D/g,'')),e.replace(/\D/g,'')&&w((0,s.partyFromText)(e,b,y))},onBlur:()=>{const e=(0,s.partyFromText)(x,b,y);$(String(e)),w(e)},style:{width:64,height:44,borderRadius:10,borderWidth:1,borderColor:c.colours.border,color:c.colours.text,backgroundColor:c.colours.surface,textAlign:'center',fontSize:20,fontFamily:c.fonts.semibold}}),I(1,'+','One more person'),y-b>=20?I(10,'+10',"10 more people"):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),s=r(_d[4]),c=r(_d[5]),u=r(_d[6]),d=r(_d[7])},1120,[34,402,412,102,1121,821,794,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MAX_PARTY",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MIN_PARTY",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PARTY_RULE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"validParty",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"partyFromText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clampParty",{enumerable:!0,get:function(){return 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.`},1121,[]); @@ -1210,12 +1210,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}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"fitLabel",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"BIG_LABEL_MIN",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"OCC_LABEL_MIN",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"occupiedLabel",{enumerable:!0,get:function(){return S}}),_e.areaBounds=I,_e.minReadableScale=function(e,t){return Math.max(0,...e.tables.filter(e=>e.areaId===t).map(e=>{const t='round'===e.shape?.85:1,o=(7.4399999999999995*Math.max(1,(0,g.tableNumber)(e).length)+6)/(e.w*t),n=22/Math.min(e.w,e.h);return Math.max(o,n)}))},_e.seatSpots=R,_e.FixtureShape=T,_e.FloorCanvas=function(e){const[$,L]=(0,r.useState)({w:0,h:0}),z=e.plan.tables.filter(t=>t.areaId===e.areaId),E=e.crop&&z.length?I(e.plan,e.areaId):{x:0,y:0,w:l.PLAN_W,h:l.PLAN_H},F='live'===e.mode?[...new Map(z.flatMap(t=>{const o=e.view?.[t.name];if(!o?.group||o.group.length<2)return[];const n=[...o.group].sort().join('+');return[[n,{key:n,members:o.group,view:o}]]})).values()]:[],O=28*F.length,D={x:E.x,y:E.y,r:E.x+E.w,b:E.y+E.h},_=$.w?'width'===e.fit?Math.min($.w/l.PLAN_W,e.maxH?e.maxH/l.PLAN_H:9):Math.min($.w/E.w,Math.max(1,$.h-O)/E.h):0,B=e.fill&&'contain'===e.fit&&_>0&&$.h>0,N=B?($.w/_-E.w)/2:0,P=B?(($.h-O)/_-E.h)/2:0,W={x:D.x-N,y:D.y-P,r:D.r+N,b:D.b+P},H=W.r-W.x,G=W.b-W.y,[Y,X]=(0,r.useState)(null),U=(0,r.useRef)(null),[q,J]=(0,r.useState)(null),K=(0,r.useRef)(null);K.current=q,i.default.useEffect(()=>{if(!q)return;const e=setTimeout(()=>J(null),n.ARM_MS);return()=>clearTimeout(e)},[q]);const V='live'===e.mode&&!!e.onDrop,Q=e=>!V||(0,n.isArmed)(K.current,e.id,Date.now()),Z=t=>e.plan.sections.find(e=>e.id===t.sectionId),ee=t=>e.plan.joins.find(e=>e.tables.includes(t.name)),te=i.default.useMemo(()=>(0,g.numberClashes)(e.plan.tables).sameArea,[e.plan.tables]),oe=(t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>Q(t),onResponderTerminationRequest:()=>!Q(t),onResponderGrant:e=>{U.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,id:t.id,kind:o}},onResponderMove:n=>{const r=U.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,a=n.nativeEvent.pageY-r.y;Math.abs(i)+Math.abs(a)<6&&!Y||Q(t)&&('live'!==e.mode||e.onDrop&&e.view&&['seated','mains','dessert','bill'].includes(e.view[t.name]?.status)&&e.view[t.name]?.booking)&&X({id:t.id,dx:i,dy:a,kind:o})},onResponderRelease:r=>{const i=U.current;U.current=null;const s=r.nativeEvent.pageX-(i?.x??0),u=r.nativeEvent.pageY-(i?.y??0);if(X(null),Math.abs(s)+Math.abs(u)<6||!_){if('move'===o){if(V){const e=(0,n.releaseOn)(K.current,t.id,!1,Date.now());if(J(e.arm),'select'===e.action)try{a.default.announceForAccessibility(n.SELECTED_A11Y)}catch{}}e.onTap?.(t)}return}if(V){const e=(0,n.releaseOn)(K.current,t.id,!0,Date.now());if(J(e.arm),'move'!==e.action)return}const h=s/_,c=u/_;if('edit'===e.mode&&'move'===o)e.onMove?.(t,w(v(t.x+h,e.snapOn),0,l.PLAN_W-t.w),w(v(t.y+c,e.snapOn),0,l.PLAN_H-t.h));else if('edit'===e.mode&&'resize'===o)e.onResize?.(t,w(v(t.w+h,e.snapOn),50,400),w(v(t.h+c,e.snapOn),50,300));else if('live'===e.mode&&e.onDrop){const o=t.x+t.w/2+h,n=t.y+t.h/2+c,r=z.find(e=>e.id!==t.id&&o>=e.x-10&&o<=e.x+e.w+10&&n>=e.y-10&&n<=e.y+e.h+10);r&&e.onDrop(t,r)}}}),ne=e=>e*_,re=e=>ne(e-W.x),ie=e=>ne(e-W.y),ae='width'===e.fit?l.PLAN_H*_+O||200:void 0;return(0,x.jsxs)(s.default,{testID:"floor-canvas",onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),style:[{width:'100%',borderRadius:16,overflow:'hidden'},'contain'===e.fit?{flex:1}:{height:ae}],children:[F.map(e=>{const o=z.filter(t=>e.members.includes(t.name)),n=o.length?(Math.min(...o.map(e=>e.x))+Math.max(...o.map(e=>e.x+e.w)))/2:W.x+H/2,r=e.view.booking?.time??e.view.next?.time,i=`${A(e.members)}${r?` \xb7 ${'seated'===e.view.status?'Seated':'Booked'} ${r}`:''}`,a=Math.min(Math.max(0,$.w-8),260);return(0,x.jsx)(s.default,{testID:`joined-label-${e.key}`,accessible:!0,accessibilityLabel:`Joined tables ${i}`,pointerEvents:"none",style:{height:28,width:a,marginLeft:w(ne(n-W.x)-a/2,4,Math.max(4,$.w-a-4)),alignItems:'center',justifyContent:'center',overflow:'hidden',borderRadius:8,borderWidth:1,borderColor:h.colours.gold,backgroundColor:(0,t.soutersSurface)('#0B0B0B')},children:(0,x.jsx)(c.T,{size:16,weight:"bold",colour:h.colours.goldLight,center:!0,numberOfLines:1,children:i})},e.key)}),_?(0,x.jsx)(s.default,{style:{width:ne(H),height:ne(G),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0F0E0C'),borderRadius:16,borderWidth:1,borderColor:h.colours.border,overflow:'hidden'},children:(0,x.jsxs)(s.default,{style:{position:'absolute',left:0,top:0,width:ne(H),height:ne(G)},children:['edit'===e.mode?Array.from({length:l.PLAN_W/(2*l.GRID)},(e,o)=>(0,x.jsx)(s.default,{style:{position:'absolute',left:re(o*l.GRID*2),top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`v${o}`)):null,'edit'===e.mode?Array.from({length:l.PLAN_H/(2*l.GRID)},(e,o)=>(0,x.jsx)(s.default,{style:{position:'absolute',top:ie(o*l.GRID*2),left:0,right:0,height:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`h${o}`)):null,(e.plan.fixtures??[]).filter(t=>t.areaId===e.areaId).map(t=>(0,x.jsx)(T,{f:{...t,x:t.x-W.x,y:t.y-W.y},S:ne,live:'live'===e.mode},t.id)),e.plan.joins.map(e=>{const t=z.filter(t=>e.tables.includes(t.name));if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,x.jsx)(s.default,{testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:re((r+a)/2-u/2),top:ie((i+l)/2)-3,width:ne(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.55)',transform:[{rotate:`${h}rad`}]}},e.id)}),z.map(n=>{const r=e.view?.[n.name],a=r?u.STATUS[r.status]:u.STATUS.free,v=Y?.id===n.id,w=v&&'resize'===Y.kind?Math.max(50,n.w+Y.dx/_):n.w,$=v&&'resize'===Y.kind?Math.max(50,n.h+Y.dy/_):n.h,I=v&&'move'===Y.kind?n.x+Y.dx/_:n.x,T=v&&'move'===Y.kind?n.y+Y.dy/_:n.y,A=e.selected===n.id||e.highlight?.includes(n.name)||q?.id===n.id,L=Z(n),z='edit'===e.mode?'#2A2419':a.colour,E='edit'===e.mode?h.colours.text:a.fg,F='round'===n.shape?ne(Math.min(w,$))/2:ne(10),O='live'===e.mode?(0,g.liveTableLabel)(n,te):(0,l.tableLabel)(n),D=ne(Math.min(w,$))<64,B=r?r.covers>0?r.covers:'soon'===r.status?(r.next??r.dayBookings?.[0])?.partySize??0:0:0,N=e.big&&'live'===e.mode&&r&&!(r.group&&r.group.length>1)&&k.has(r.status)&&B>0,P=N?S(O,B):O,W=M(e.big?Math.max(13,Math.min(34,ne(Math.min(w,$))/3)):Math.max(11,Math.min(22,ne(Math.min(w,$))/4)),P,ne(w)*('round'===n.shape?.85:1),N?C:e.big?j:9),H=ne(w)*('round'===n.shape?.85:1),G=e=>e.length*W*.62+6,X=N&&G(P)>H,U=X&&Math.max(G(O),G(`(${B})`))<=H&&1.2*W*2<=ne($)-4,J=X&&!U,K=Math.max(e.big?11:12,Math.round(.62*W)),V=(ne($)-6-1.4*W)/(1.4*K),Q=V>=2&&ne(w)>=5*K?2:V>=1?1:0,ae=r?.booking&&void 0!==r.seatedMins?r.booking.time:void 0,se='soon'===r?.status?r.next?.time??r.dayBookings?.[0]?.time:void 0,le='edit'===e.mode?`Table ${(0,o.tableNumbers)(O)}, ${(0,l.shapeLabel)(n.shape).toLowerCase()}, ${n.minSeats}\u2013${n.maxSeats} seats${n.online?', bookable online':''}`:'soon'===r?.status?`Table ${(0,o.tableNumbers)(O)}, booked later${se?`, ${se}`:''}${r.group?`, combined with ${r.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`:`Table ${(0,o.tableNumbers)(O)}, ${a.label}${void 0!==r?.seatedMins?`, seated ${r.seatedMins} min`:''}${r?.covers?`, ${r.covers} Covers`:''}${r?.dayBookings?.length?`, booked: ${r.dayBookings.map(e=>`${e.time}, ${e.partySize} Covers`).join('; ')}`:''}${r?.group?`, combined with ${r.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`,de=void 0!==r?.seatedMins&&r.booking?Math.min(1.2,r.seatedMins/(r.booking.durationMins??(0,u.turnFor)(r.booking.partySize,e.turnBase))):null;return(0,x.jsxs)(i.default.Fragment,{children:[R({...n,w:w,h:$}).map((t,o)=>(0,x.jsx)(s.default,{pointerEvents:"none",style:[{position:'absolute',left:re(I+t.x)-Math.max(4,ne(8)),top:ie(T+t.y)-Math.max(4,ne(8)),width:Math.max(8,ne(16)),height:Math.max(8,ne(16)),borderRadius:99,backgroundColor:'edit'===e.mode?'#5A4C33':'rgba(255,255,255,0.16)',borderWidth:1,borderColor:'edit'===e.mode?h.colours.gold:'rgba(255,255,255,0.25)'},y()]},o)),'live'===e.mode&&(ne(w)<44||ne($)<44)?(0,x.jsx)(s.default,{accessible:!1,importantForAccessibility:"no-hide-descendants",'aria-hidden':!0,...oe(n,'move'),style:{position:'absolute',left:re(I+w/2)-Math.max(44,ne(w))/2,top:ie(T+$/2)-Math.max(44,ne($))/2,width:Math.max(44,ne(w)),height:Math.max(44,ne($)),zIndex:2}}):null,(0,x.jsxs)(s.default,{testID:`table-${n.name}`,accessibilityRole:"button",accessibilityLabel:le,onAccessibilityTap:()=>e.onTap?.(n),onKeyDown:t=>{'Enter'!==t?.key&&' '!==t?.key||e.onTap?.(n)},tabIndex:0,...oe(n,'move'),style:[{position:'absolute',left:re(I),top:ie(T),width:ne(w),height:ne($),borderRadius:F,backgroundColor:z,alignItems:'center',justifyContent:'center',padding:2,overflow:J?'visible':'hidden',borderWidth:A?3:e.sectionColours&&L?2.5:1.5,borderColor:A?'#FFFFFF':e.sectionColours&&L?(0,h.brandColour)(L.colour):'edit'===e.mode?h.colours.gold:'rgba(0,0,0,0.35)',transform:[{scale:v?1.06:1}],zIndex:v?50:J?4:3,opacity:v&&'live'===e.mode?.85:1,shadowColor:'#000',shadowOpacity:v?.6:.3,shadowRadius:v?14:6,cursor:'edit'===e.mode?'grab':'pointer',touchAction:'none'},v?null:y()],children:[(0,x.jsxs)(s.default,{style:J?{alignItems:'center',justifyContent:'center',overflow:'visible'}:{alignItems:'center',justifyContent:'center',maxWidth:'100%',maxHeight:'100%',overflow:'hidden'},pointerEvents:"none",children:[N?(0,x.jsx)(c.T,{testID:`table-label-${n.name}`,style:U?{flexShrink:0,lineHeight:Math.round(1.2*W),maxWidth:Math.max(20,H-4)}:J?{...p,whiteSpace:'nowrap',textShadowColor:'rgba(0,0,0,0.9)',textShadowRadius:3,textShadowOffset:{width:0,height:0}}:p,weight:"bold",size:W,colour:J?'#FFFFFF':E,center:!0,numberOfLines:U?2:1,children:P}):(0,x.jsx)(c.T,{style:p,weight:"bold",size:W,colour:E,center:!0,numberOfLines:1,children:O}),'live'===e.mode&&'blocked'===r?.status?(0,x.jsx)(c.T,{style:f,size:Math.max(10,Math.round(.5*W)),weight:"semibold",colour:E,center:!0,numberOfLines:1,children:"Blocked"}):null,N||'live'===e.mode&&r?.group&&r.group.length>1?null:e.big&&'live'===e.mode&&r&&1===Q?'free'!==r.status&&'soon'!==r.status&&(r.covers||ae)?(0,x.jsx)(c.T,{style:f,size:K,weight:"bold",colour:E,center:!0,numberOfLines:1,children:[r.covers?`${r.covers}`:'',ae??''].filter(Boolean).join(' \xb7 ')}):null:e.big&&'live'===e.mode&&r&&2===Q?(0,x.jsxs)(x.Fragment,{children:['soon'!==r.status&&r.covers?(0,x.jsxs)(c.T,{style:f,size:K,weight:"semibold",colour:E,center:!0,children:[r.covers," ",1===r.covers?'Cover':'Covers']}):'free'!==r.status||D?null:(0,x.jsxs)(c.T,{style:f,size:K,colour:E,center:!0,children:[n.minSeats,"\u2013",n.maxSeats]}),'free'!==r.status&&'soon'!==r.status&&ae?(0,x.jsx)(c.T,{style:f,size:K,weight:"bold",colour:E,center:!0,children:ae}):'dirty'===r.status?(0,x.jsx)(c.T,{style:f,size:K,colour:E,center:!0,children:"Clear"}):null]}):e.big&&'live'===e.mode?null:'edit'===e.mode?D?null:(0,x.jsxs)(c.T,{style:f,size:11,colour:h.colours.muted,center:!0,children:[n.minSeats,"\u2013",n.maxSeats,n.online?' \xb7 online':'']}):r?(0,x.jsxs)(x.Fragment,{children:['free'!==r.status||D?null:(0,x.jsxs)(c.T,{style:f,size:11,colour:E,center:!0,children:[n.minSeats,"\u2013",n.maxSeats," seats"]}),void 0!==r.seatedMins?(0,x.jsxs)(c.T,{style:f,size:12,weight:"semibold",colour:E,center:!0,children:[r.seatedMins,"m \xb7 ",r.covers,"\ud83d\udc65"]}):r.orderOnly?(0,x.jsx)(c.T,{style:f,size:11,colour:E,center:!0,children:"Open order"}):null,'dirty'!==r.status||D?null:(0,x.jsx)(c.T,{style:f,size:11,colour:E,center:!0,children:"Clear"}),!D||r.allergy||r.vip?(0,x.jsxs)(c.T,{style:f,size:11,colour:E,center:!0,children:[r.allergy?'\u26a0':'',r.vip?'VIP'===r.vip?'\u2605':'\u2665':'',r.occasion?u.OCCASION_ICON[r.occasion]:'',r.note?'\u270e':'']}):null]}):null]}),null,'live'===e.mode&&r&&!D&&(r.booking??r.next)&&(0,b.needsIcons)(r.booking??r.next).replace('\u26a0\ufe0f','').trim()?(0,x.jsx)(s.default,{pointerEvents:"none",testID:`needs-${n.name}`,style:{position:'absolute',bottom:e.big?-Math.max(9,.55*K):2,right:e.big?-6:4,backgroundColor:(0,t.soutersSurface)('rgba(11,11,11,0.85)'),borderRadius:8,paddingHorizontal:4,borderWidth:1,borderColor:'rgba(255,255,255,0.15)'},children:(0,x.jsx)(c.T,{size:e.big?Math.max(11,.75*K):10,children:(0,b.needsIcons)(r.booking??r.next).replace('\u26a0\ufe0f','').trim()})}):null,L&&'live'===e.mode&&e.sectionColours&&!D&&!e.big?(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:3,right:6,backgroundColor:(0,h.brandColour)(L.colour),borderRadius:6,paddingHorizontal:3},children:(0,x.jsx)(c.T,{size:9,weight:"bold",colour:"#0B0B0B",children:L.server})}):null,null===de||D?null:(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:'15%',right:'15%',bottom:5,height:4,borderRadius:2,backgroundColor:'rgba(0,0,0,0.25)'},children:(0,x.jsx)(s.default,{style:{width:`${Math.min(100,100*de)}%`,height:4,borderRadius:2,backgroundColor:de>=1?'#B3261E':'rgba(0,0,0,0.6)'}})}),ee(n)&&'edit'===e.mode?(0,x.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',bottom:2,left:4},children:(0,x.jsx)(c.T,{size:10,colour:h.colours.gold,children:"\u26d3"})}):null]}),'edit'===e.mode&&e.selected===n.id?(0,x.jsx)(s.default,{testID:"resize-handle",accessibilityLabel:"Resize table",...oe(n,'resize'),style:{position:'absolute',left:re(I+w)-14,top:ie(T+$)-14,width:28,height:28,borderRadius:14,backgroundColor:h.colours.gold,borderWidth:2,borderColor:'#fff',zIndex:60,cursor:'nwse-resize',touchAction:'none'}}):null]},n.id)}),0===z.length?(0,x.jsx)(s.default,{style:{position:'absolute',left:0,right:0,top:'45%'},children:(0,x.jsxs)(c.T,{center:!0,colour:h.colours.muted,children:["No tables in this area yet",'edit'===e.mode?' \u2014 add some in Tables':'',"."]})}):null]})}):null]})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),i=e(r),a=e(_r(d[4]));_r(d[5]);var s=e(_r(d[6])),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),c=_r(d[10]),b=_r(d[11]),g=_r(d[12]),x=_r(d[13]);const f={flexShrink:0},p={flexShrink:0,maxWidth:'none'},y=(e=250)=>({transitionProperty:'background-color, border-color, transform, left, top, width, height',transitionDuration:`${e}ms`}),v=(e,t=!0)=>t?Math.round(e/l.GRID)*l.GRID:Math.round(e),w=(e,t,o)=>Math.max(t,Math.min(o,e)),M=(e,t,o,n=9)=>Math.max(n,Math.min(e,(o-6)/(.62*Math.max(1,t.length)))),j=12,C=11,k=new Set(['soon','seated','mains','dessert','bill']),S=(e,t)=>`${e} (${t})`,$=46;function I(e,t){const o=e.tables.filter(e=>e.areaId===t);if(!o.length)return{x:0,y:0,w:l.PLAN_W,h:l.PLAN_H};const n=Math.max(0,Math.min(...o.map(e=>e.x))-$),r=Math.max(0,Math.min(...o.map(e=>e.y))-$);return{x:n,y:r,w:Math.min(l.PLAN_W,Math.max(...o.map(e=>e.x+e.w))+$)-n,h:Math.min(l.PLAN_H,Math.max(...o.map(e=>e.y+e.h))+$)-r}}function R(e){const t=Math.max(1,e.maxSeats),o=[];if('round'===e.shape){const n=e.w/2+9.6,r=e.h/2+9.6;for(let i=0;ie.w,r=Math.ceil(t/2),i=t-r;if(n){for(let t=0;te.w,a=n?{borderColor:'#FFFFFF',borderWidth:2}:null;return'bar'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#2A2216':'#3A2E1C',borderRadius:8,borderWidth:1.5,borderColor:o?'#5A4A30':h.colours.gold},a],children:(0,x.jsx)(c.T,{size:Math.max(9,Math.min(14,t(e.h)/2.4)),weight:"semibold",colour:h.colours.goldLight,children:"BAR"})}):'wall'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#3A3631':'#5C574F',borderRadius:2},a]}):'window'===e.kind?(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{backgroundColor:'rgba(226,196,137,0.16)',borderColor:'rgba(226,196,137,0.6)',borderWidth:1,borderRadius:2},a],children:!o&&t(i?e.h:e.w)>60?(0,x.jsx)(c.T,{size:9,colour:"#BFDDFF",style:i?{transform:[{rotate:'90deg'}]}:void 0,children:"WINDOW"}):null}):(0,x.jsx)(s.default,{pointerEvents:"none",style:[r,{borderColor:o?'#7A6440':h.colours.gold,borderWidth:1.5,borderStyle:'dashed',borderRadius:3,backgroundColor:'rgba(207,164,95,0.08)'},a],children:t(i?e.h:e.w)>40?(0,x.jsx)(c.T,{size:9,colour:h.colours.goldLight,style:i?{transform:[{rotate:'90deg'}]}:void 0,children:"DOOR"}):null})}function A(e){return(0,l.tablesLabel)(e.join('+')).replace(/^Tables? /,'').replace(/ \+ /g,'+')}},1127,[828,860,1128,34,281,236,102,1025,1100,821,794,1102,859,25]); __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])},1129,[34,402,102,874,861,863,821,794,25]); -__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 a}}),Object.defineProperty(_e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"guestMessageFields",{enumerable:!0,get:function(){return o}}),_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 d}}),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 l}}),Object.defineProperty(_e,"OCCASIONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"TAGS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"FIELD_WORDS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"draftOf",{enumerable:!0,get:function(){return f}}),_e.changedFields=P,_e.historyText=O,_e.editPatch=function(t,a,s,o=(new Date).toISOString()){const n=P(t,a);if(!n.length)return{};const d={};for(const c of n)switch(c){case'partySize':d.partySize=(0,e.clampParty)(Number(a.partySize));break;case'phone':case'email':case'table':d[c]=String(a[c]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[c]=String(a[c]??'').trim();break;case'area':d.area=(a.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(a.dogs??0)),d.dog=Number(a.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(a.highChairs??0))||void 0;break;case'wheelchair':d.access={...t.access??{},wheelchair:Math.max(0,Number(a.wheelchair??0))||void 0};break;case'occasion':d.occasion=a.occasion||void 0;break;case'allergies':d.allergies=[...a.allergies??[]],d.allergyNone=!!a.allergyNone&&!(a.allergies??[]).length,d.allergyNote=(a.allergyNote??'').trim()||void 0,(a.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(a.vegan??0)||void 0,vegetarian:Number(a.vegetarian??0)||void 0};break;case'deposit':if(!a.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(a.depositDue??0))),a.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(a.depositDate??'')?a.depositDate:o.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(a.depositAmount??0))),depositPaidBy:s.by.slice(0,80),depositPaidAt:e===o.slice(0,10)?o:`${e}T12:00:00.000Z`,depositMethod:a.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=a.status,'seated'!==a.status||t.seatedAt||(d.seatedAt=o),'finished'!==a.status||t.finishedAt||(d.finishedAt=o),'confirmed'!==a.status&&'pending'!==a.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=a.source||void 0;break;case'tags':d.tags=[...(t.tags??[]).filter(e=>!p.includes(e)),...a.tags??[]];break;case'duration':d.durationMins=Number(a.duration??0)>=15?Number(a.duration):void 0}n.includes('table')&&(d.tableSetHere=!0);const c=t;return d.locallyEdited=!0,d.editedFields=[...new Set([...c.editedFields??[],...n])],d.editLog=[...c.editLog??[],{at:o,by:s.by.slice(0,80),app:s.app,fields:n,text:O(t,a,n,s.by.slice(0,80),o)}].slice(-50),d},_e.historyLines=function(e){return(e.editLog??[]).slice().reverse().map(e=>e.text??`${e.fields.map(e=>b[e]??e).join(', ')} changed by ${e.by} ${N(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,a,s,o,n=90,d){const c=[];if(!P(e,a).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return c;const u={...e,date:a.date,time:a.time,partySize:a.partySize,...Number(a.duration??0)>=15?{durationMins:Number(a.duration)}:{}};if(a.table){const e=(0,t.tableOverlaps)(u,a.table,s.filter(e=>e.date===a.date),n);if(e.length&&c.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),d){const e=a.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>d.tables.find(t=>t.name===e)).filter(Boolean),t=e.reduce((e,t)=>e+t.maxSeats,0);e.length&&td.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(a.dogs??0)>0&&s.length&&c.push(`Dogs aren\u2019t allowed in ${s[0].name}. Pick a dog-friendly table.`)}}o&&c.push(`Bookings are paused ${o.from} to ${o.to}${o.reason?` (${o.reason})`:''}.`);return c},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return k}}),_e.bookingExtras=function(e){const t=e,a=e.dogs??(e.dog?1:0),s=[];a&&s.push(w(a,'dog','dogs'));t.highChairs&&s.push(w(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&s.push(w(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&s.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&s.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&s.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&s.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&s.push(`Deposit by ${t.depositMethod}`);return s.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]);const a='For example: birthday, high chair, dog, window seat',s='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.',o=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')},d=['date','time','partySize','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration'],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'}],l=[{id:'phone',label:'Phone'},{id:'in-person',label:'In person'},{id:'online',label:'Online'}],h=[{id:'',label:'None'},{id:'birthday',label:'Birthday'},{id:'anniversary',label:'Anniversary'},{id:'celebration',label:'Celebration'}],p=['VIP','Regular'],b={date:'date',time:'time',partySize:'covers',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'},f=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:(a=e.depositPaidAt,a?a.slice(0,10):''),depositDue:e.depositDue??0,status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>p.includes(e)).sort(),duration:e.durationMins??0};var a},y=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),$=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'']:[!1]);function v(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return y(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return $(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':return Number(t[e]??0);default:return String(t[e]??'').trim()}}function P(e,t){const a=f(e);return d.filter(e=>v(e,a)!==v(e,t))}const S=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,N=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},w=(e,t,a)=>`${e} ${1===e?t:a}`;function O(e,t,a,s,o){const n=f(e),d=[];for(const e of[...a].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))'deposit'===e?t.depositOn?t.depositPaid&&!n.depositPaid?d.push(`deposit marked paid (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&n.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${S(Number(t.depositDue??0))}`):d.push('deposit taken off'):'dogs'===e?d.push(!n.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?w(Number(t.dogs),'dog','dogs'):'no dog now'):'highChairs'===e?d.push(t.highChairs?w(Number(t.highChairs),'high chair','high chairs'):'no high chair now'):'wheelchair'===e?d.push(t.wheelchair?w(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now'):'partySize'===e?d.push(`covers ${n.partySize} to ${t.partySize}`):'time'===e?d.push(`time ${n.time} to ${t.time}`):'date'===e?d.push(`date ${n.date} to ${t.date}`):'table'===e?d.push(t.table?`table ${t.table}`:'table taken off'):'status'===e?d.push(`status ${u.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`):'occasion'===e?d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off'):'area'===e?d.push(t.area?`area ${t.area}`:'any area'):'duration'===e?d.push(t.duration?`table time ${t.duration} min`:'table time as usual'):d.push(`${b[e]} changed`);const c=d.join(', ');return`${c.charAt(0).toUpperCase()}${c.slice(1)} by ${s} ${N(o)}`}const k=e=>e.map(e=>b[e]).join(', ')},1130,[1121,1115]); +__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 n}}),_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 d}}),Object.defineProperty(_e,"EDIT_FIELDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"DEPOSIT_METHODS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"EDIT_STATUSES",{enumerable:!0,get:function(){return l}}),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}}),_e.changedFields=N,_e.historyText=k,_e.editPatch=function(t,a,s,o=(new Date).toISOString()){const n=N(t,a);if(!n.length)return{};const d={};for(const c of n)switch(c){case'partySize':d.partySize=(0,e.clampParty)(Number(a.partySize));break;case'phone':case'email':case'table':d[c]=String(a[c]??'').trim()||void 0;break;case'date':case'time':case'name':case'notes':d[c]=String(a[c]??'').trim();break;case'area':d.area=(a.area??'').trim()||void 0;break;case'dogs':d.dogs=Math.max(0,Number(a.dogs??0)),d.dog=Number(a.dogs??0)>0;break;case'highChairs':d.highChairs=Math.max(0,Number(a.highChairs??0))||void 0;break;case'wheelchair':d.access={...t.access??{},wheelchair:Math.max(0,Number(a.wheelchair??0))||void 0};break;case'occasion':d.occasion=a.occasion||void 0;break;case'allergies':d.allergies=[...a.allergies??[]],d.allergyNone=!!a.allergyNone&&!(a.allergies??[]).length,d.allergyNote=(a.allergyNote??'').trim()||void 0,(a.allergies??[]).length||(d.allergyAck=void 0);break;case'diet':d.diet={vegan:Number(a.vegan??0)||void 0,vegetarian:Number(a.vegetarian??0)||void 0};break;case'deposit':if(!a.depositOn){Object.assign(d,{security:'none',depositDue:0,depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break}if(d.security='deposit',d.depositDue=Math.max(0,Math.round(Number(a.depositDue??0))),a.depositPaid){const e=/^\d{4}-\d{2}-\d{2}$/.test(a.depositDate??'')?a.depositDate:o.slice(0,10);Object.assign(d,{depositPaid:Math.max(0,Math.round(Number(a.depositAmount??0))),depositPaidBy:s.by.slice(0,80),depositPaidAt:e===o.slice(0,10)?o:`${e}T12:00:00.000Z`,depositMethod:a.depositMethod||void 0})}else Object.assign(d,{depositPaid:0,depositPaidBy:void 0,depositPaidAt:void 0,depositMethod:void 0});break;case'status':d.status=a.status,'seated'!==a.status||t.seatedAt||(d.seatedAt=o),'finished'!==a.status||t.finishedAt||(d.finishedAt=o),'confirmed'!==a.status&&'pending'!==a.status||(d.seatedAt=void 0,d.finishedAt=void 0);break;case'source':d.source=a.source||void 0;break;case'tags':d.tags=[...(t.tags??[]).filter(e=>!b.includes(e)),...a.tags??[]];break;case'duration':d.durationMins=Number(a.duration??0)>=15?Number(a.duration):void 0}n.includes('table')&&(d.tableSetHere=!0);const c=t;return d.locallyEdited=!0,d.editedFields=[...new Set([...c.editedFields??[],...n])],d.editLog=[...c.editLog??[],{at:o,by:s.by.slice(0,80),app:s.app,fields:n,text:k(t,a,n,s.by.slice(0,80),o)}].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} ${w(e.at)}`.replace(/^./,e=>e.toUpperCase()))},_e.editWarnings=function(e,s,o,n,d=90,c){const u=[];if(!N(e,s).some(e=>['date','time','partySize','table','duration','dogs','status'].includes(e)))return u;const l={...e,date:s.date,time:s.time,partySize:s.partySize,...Number(s.duration??0)>=15?{durationMins:Number(s.duration)}:{}};if(s.table){const e=(0,t.tableOverlaps)(l,s.table,o.filter(e=>e.date===s.date),d);if(e.length&&u.push(`The table already has a booking at about the same time: ${e.map(e=>`${e.time} ${e.walkIn?'walk-in':e.name}`).join(', ')}.`),c){const e=s.table.split('+').map(e=>e.trim()).filter(Boolean).map(e=>c.tables.find(t=>t.name===e)).filter(Boolean),t=e.reduce((e,t)=>e+t.maxSeats,0),o=e.length?(0,a.overCapacityAsk)(e.map(e=>e.name),t,s.partySize):null;o&&u.push(o);const n=e.map(e=>c.areas.find(t=>t.id===e.areaId)).filter(e=>e&&!e.dogs);Number(s.dogs??0)>0&&n.length&&u.push(`Dogs aren\u2019t allowed in ${n[0].name}. Pick a dog-friendly table.`)}}n&&u.push(`Bookings are paused ${n.from} to ${n.to}${n.reason?` (${n.reason})`:''}.`);return u},Object.defineProperty(_e,"editedWords",{enumerable:!0,get:function(){return M}}),_e.bookingExtras=function(e){const t=e,a=e.dogs??(e.dog?1:0),s=[];a&&s.push(O(a,'dog','dogs'));t.highChairs&&s.push(O(t.highChairs,'high chair','high chairs'));e.access?.wheelchair&&s.push(O(e.access.wheelchair,'wheelchair','wheelchairs'));e.diet?.vegan&&s.push(`${e.diet.vegan} vegan`);e.diet?.vegetarian&&s.push(`${e.diet.vegetarian} vegetarian`);e.occasion&&s.push(e.occasion.charAt(0).toUpperCase()+e.occasion.slice(1));t.area&&s.push(t.area);t.depositMethod&&(e.depositPaid??0)>0&&s.push(`Deposit by ${t.depositMethod}`);return s.join(' \xb7 ')};var e=r(_d[0]),t=r(_d[1]),a=r(_d[2]);const s='For example: birthday, high chair, dog, window seat',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.',n=e=>e.filter(e=>'date'===e||'time'===e||'status'===e);const d=e=>{const t=e;return'Wix'===t.importedFrom||!!t.wix||(e.tags??[]).includes('Wix')},c=['date','time','partySize','name','phone','email','notes','table','area','dogs','highChairs','wheelchair','occasion','allergies','diet','deposit','status','source','tags','duration'],u=['card','cash','bank transfer','website','other'],l=[{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',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'},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:(a=e.depositPaidAt,a?a.slice(0,10):''),depositDue:e.depositDue??0,status:e.status,source:e.source??'',tags:[...e.tags??[]].filter(e=>b.includes(e)).sort(),duration:e.durationMins??0};var a},v=e=>JSON.stringify([[...e.allergies??[]].map(e=>`${e.allergen}:${e.severity}`).sort(),!!e.allergyNone,(e.allergyNote??'').trim()]),$=e=>JSON.stringify(e.depositOn?[!0,!!e.depositPaid,Number(e.depositAmount??0),Number(e.depositDue??0),e.depositPaid?e.depositMethod??'':'',e.depositPaid?e.depositDate??'':'']:[!1]);function P(e,t){switch(e){case'partySize':return Number(t.partySize);case'allergies':return v(t);case'diet':return`${Number(t.vegan??0)}/${Number(t.vegetarian??0)}`;case'deposit':return $(t);case'tags':return[...t.tags??[]].sort().join(',');case'dogs':case'highChairs':case'wheelchair':case'duration':return Number(t[e]??0);default:return String(t[e]??'').trim()}}function N(e,t){const a=y(e);return c.filter(e=>P(e,a)!==P(e,t))}const S=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,w=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},O=(e,t,a)=>`${e} ${1===e?t:a}`;function k(e,t,a,s,o){const n=y(e),d=[];for(const e of[...a].sort((e,t)=>Number('deposit'===t)-Number('deposit'===e)))'deposit'===e?t.depositOn?t.depositPaid&&!n.depositPaid?d.push(`deposit marked paid (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`):!t.depositPaid&&n.depositPaid?d.push('deposit marked not paid'):d.push(t.depositPaid?`deposit changed (${S(Number(t.depositAmount??0))}${t.depositMethod?`, ${t.depositMethod}`:''})`:`deposit due ${S(Number(t.depositDue??0))}`):d.push('deposit taken off'):'dogs'===e?d.push(!n.dogs&&t.dogs?1===t.dogs?'dog added':`${t.dogs} dogs added`:t.dogs?O(Number(t.dogs),'dog','dogs'):'no dog now'):'highChairs'===e?d.push(t.highChairs?O(Number(t.highChairs),'high chair','high chairs'):'no high chair now'):'wheelchair'===e?d.push(t.wheelchair?O(Number(t.wheelchair),'wheelchair user','wheelchair users'):'no wheelchair now'):'partySize'===e?d.push(`covers ${n.partySize} to ${t.partySize}`):'time'===e?d.push(`time ${n.time} to ${t.time}`):'date'===e?d.push(`date ${n.date} to ${t.date}`):'table'===e?d.push(t.table?`table ${t.table}`:'table taken off'):'status'===e?d.push(`status ${l.find(e=>e.id===t.status)?.label.toLowerCase()??t.status}`):'occasion'===e?d.push(t.occasion?`occasion ${t.occasion}`:'occasion taken off'):'area'===e?d.push(t.area?`area ${t.area}`:'any area'):'duration'===e?d.push(t.duration?`table time ${t.duration} min`:'table time as usual'):d.push(`${f[e]} changed`);const c=d.join(', ');return`${c.charAt(0).toUpperCase()}${c.slice(1)} by ${s} ${w(o)}`}const M=e=>e.map(e=>f[e]).join(', ')},1130,[1121,1115,1118]); __d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WALKIN_MATCH_MINS",{enumerable:!0,get:function(){return t}}),e.bookingsNearWalkIn=function(s,o,u,d=3){const c=n(o);return s.filter(t=>t.date===c&&!t.walkIn&&('confirmed'===t.status||'pending'===t.status)&&/^\d{2}:\d{2}/.test(t.time||'')).map(t=>({b:t,d:Math.abs((new Date(`${t.date}T${t.time.slice(0,5)}:00`).getTime()-o.getTime())/6e4)})).filter(n=>n.d<=t).sort((t,n)=>(u?Number(n.b.partySize===u)-Number(t.b.partySize===u):0)||t.d-n.d).slice(0,d).map(t=>t.b)},e.walkInMatchQuestion=function(t){return`Is this ${t.name}, ${t.time.slice(0,5)}, ${t.partySize} ${1===t.partySize?'person':'people'}?`};const t=45,n=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},1131,[]); __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 y}}),Object.defineProperty(_e,"canReinstateWalkIn",{enumerable:!0,get:function(){return h}}),_e.cancelWalkInWords=x,_e.reinstateWalkInWords=p,_e.cancelWalkInNow=$,_e.reinstateWalkInNow=I,_e.CancelWalkInButton=function({rid:e,b:t,onDone:l,small:s,big:o}){const[c,u]=(0,n.useState)(!1);return y(t)?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(f.Button,{kind:"secondary",small:s,label:"Cancel walk-in",testID:`cancel-walkin-${t.id}`,accessibilityLabel:`Cancel walk-in ${t.ref}, ${t.partySize} Covers`,onPress:()=>u(!0),style:o?{minHeight:64}:s?{minHeight:44}:w}),c?(0,k.jsx)(j,{rid:e,b:t,onClose:()=>u(!1),onDone:l}):null]}):null},_e.CancelWalkInConfirm=j,_e.ReinstateWalkInButton=function({rid:e,b:t,today:l,onDone:o,small:c}){const[u,y]=(0,n.useState)(!1);if(!h(t,l))return null;const x=p(t);if(!u)return(0,k.jsx)(f.Button,{kind:"ghost",small:c,label:"Undo cancel",testID:`reinstate-walkin-${t.id}`,accessibilityLabel:`Undo cancel for walk-in ${t.ref}`,onPress:()=>y(!0),style:c?{minHeight:44}:w});return(0,k.jsxs)(f.Sheet,{visible:!0,onClose:()=>y(!1),title:"Undo cancel?",maxWidth:560,testID:"reinstate-walkin-confirm",children:[(0,k.jsx)(s.default,{accessible:!0,accessibilityLabel:x,children:(0,k.jsx)(f.T,{size:18,colour:b.colours.text,children:x})}),(0,k.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(f.Button,{label:"Yes, put back to seated",testID:"reinstate-walkin-yes",accessibilityLabel:`Yes, put walk-in ${t.ref} back to seated`,style:[w,{flexGrow:1}],onPress:async()=>{await I(e,t),y(!1),o?.(`Walk-in ${t.ref} put back to seated.`)}}),(0,k.jsx)(f.Button,{kind:"secondary",label:"Keep cancelled",testID:"reinstate-walkin-no",onPress:()=>y(!1),style:w})]})]})};var e,t=r(d[0]),n=r(d[1]),l=r(d[2]),s=(e=l)&&e.__esModule?e:{default:e},o=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6]),f=r(d[7]),k=r(d[8]);const w={minHeight:56},y=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status),h=(e,t)=>!!e.walkIn&&'cancelled'===e.status&&e.date>=t;function x(e){const t=(0,c.tablesOf)(e.table),n=(0,u.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 p(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 $(e,n){await o.repo.bookings.setStatus(n.id,'cancelled'),await o.repo.bookings.update(n.id,{cancelled:(0,t.cancelStamp)(n)}),(0,c.tablesOf)(n.table).forEach(t=>c.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!1}))}async function I(e,t){await o.repo.bookings.setStatus(t.id,'seated'),(0,c.tablesOf)(t.table).forEach(t=>c.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function j({rid:e,b:t,onClose:n,onDone:l}){const o=x(t);return(0,k.jsxs)(f.Sheet,{visible:!0,onClose:n,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,k.jsx)(s.default,{accessible:!0,accessibilityLabel:o,children:(0,k.jsx)(f.T,{size:18,colour:b.colours.text,children:o})}),(0,k.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(f.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${t.ref}`,style:[w,{flexGrow:1}],onPress:async()=>{await $(e,t),n(),l?.(`Walk-in ${t.ref} cancelled.${(0,c.tablesOf)(t.table).length?` ${(0,u.tablesWords)((0,c.tablesOf)(t.table))} free.`:''}`)}}),(0,k.jsx)(f.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${t.ref}`,onPress:n,style:w})]})]})}},1132,[1133,34,102,874,1025,1118,821,794,25]); __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})]})]})}},1133,[34,102,874,1025,1115,1134,1118,821,1003,892,872,794,25]); __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))}},1134,[]); -__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:a,inStaffApp:n,shiftManager:l,big:o,testID:d}){const[r,u]=(0,t.useState)(!1),x=(0,p.useSession)(e=>e.meId),j=(0,b.useOwner)(e=>e.staff.find(e=>e.id===x&&e.active));return s.walkIn||!(0,h.canEditBooking)({variant:c.APP_VARIANT,inStaffApp:n,role:a,shiftManager:l})||x&&!(0,m.canChangeBookings)(j)?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.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}}),r?(0,T.jsx)(B,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:a,hidePrivate:n}){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,60);return o?(0,T.jsx)(B,{rid:e,id:o,who:i,hidePrivate:n,onClose:a}):(0,T.jsxs)(f.Sheet,{visible:!0,onClose:a,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,T.jsx)(f.T,{size:16,colour:j.colours.text,children:"Tip: tap the booking you want to change."}),r.length?r.map(e=>(0,T.jsx)(f.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${e.date===s?'Today':e.date} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'Cover':'Covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${e.date===s?'today':e.date}, ${e.time}, ${e.partySize} Covers`,onPress:()=>d(e.id),style:{minHeight:56,alignItems:'flex-start'}},e.id)):(0,T.jsx)(f.Muted,{children:"No bookings to edit from today on."}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:a,style:{minHeight:44}})]})},_e.EditBookingSheet=B;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),a=_r(_d[3]),n=(e=a)&&e.__esModule?e:{default:e},l=_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]),j=_r(_d[15]),y=_r(_d[16]),D=_r(_d[17]),C=_r(_d[18]),I=_r(_d[19]),f=_r(_d[20]),T=_r(_d[21]);const v=/^([01]\d|2[0-3]):[0-5]\d$/,w=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const k=e=>e?(e/100).toFixed(e%100?2:0):'',S=e=>{const t=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(t)&&t>=0?Math.round(100*t):NaN},P=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',$=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')}`:''},N=e=>e.charAt(0).toUpperCase()+e.slice(1);function E({title:e,children:t,testID:s}){return(0,T.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,T.jsx)(f.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const z=({label:e,value:t,onChange:s,max:i=20,testID:a})=>(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:e}),(0,T.jsx)(f.Stepper,{testID:a,value:t,min:0,max:i,onChange:s,label:e})]});function B({rid:e,id:a,who:p,onClose:b,hidePrivate:m='display'===c.APP_VARIANT}){const B=(0,l.useBookings)(e),A=B.find(e=>e.id===a),O=(0,r.useRestaurant)(e),R=(0,o.usePlan)(e),L=(0,d.useBlocks)(e=>e.blocks),[F,W]=(0,t.useState)(A?(0,h.draftOf)(A):null),[M,_]=(0,t.useState)(null),[H,V]=(0,t.useState)(null),[Y,G]=(0,t.useState)(k(A?(0,h.draftOf)(A).depositDue:0)),[U,X]=(0,t.useState)(k(A?(0,h.draftOf)(A).depositAmount:0)),[q,J]=(0,t.useState)(P(A?(0,h.draftOf)(A).depositDate:''));if(!A||!F||!O)return null;const K=e=>{_(null),V(null),W({...F,...e})},Q=w(F.time),Z=v.test(Q),ee=F.area?R.areas.filter(e=>e.name===F.area).map(e=>e.id):null,te=e=>!ee||e.split('+').every(e=>ee.includes(R.tables.find(t=>t.name===e)?.areaId??'')),se=(0,x.tableOptions)(R,B.filter(e=>e.date===F.date),F.table).filter(e=>te(e)||e===F.table),ie=!(F.depositOn&&(Number.isNaN(S(Y||'0'))||F.depositPaid&&(Number.isNaN(S(U||'0'))||q.trim()&&!$(q)))),ae={...F,time:Q,depositDue:S(Y||'0')||0,depositAmount:S(U||'0')||0,depositDate:$(q)},ne=(0,h.changedFields)(A,ae),le=O.settings.turnMins??90,oe=async()=>{const t=(0,h.editPatch)(A,ae,{by:p||'Team member',app:c.APP_VARIANT});if(Object.keys(t).length&&await l.repo.bookings.update(A.id,t),'seated'===A.status&&'table'in t&&t.table!==A.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(A.table),a=s(t.table),n=o.useFloor.getState(),l=i.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!a.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),a.forEach(t=>n.setLive(e,t,{stage:l,dirty:!1}))}V(`Saved. Changed: ${(0,h.editedWords)(ne)}.`),_(null),b()},de=F.allergies??[],re=e=>K({allergyNone:!1,allergies:de.some(t=>t.allergen===e)?de.filter(t=>t.allergen!==e):[...de,{allergen:e,severity:'allergy'}]}),ce=(0,h.historyLines)(A);return(0,T.jsxs)(f.Sheet,{visible:!0,onClose:b,title:`Edit booking \xb7 ${A.name} \xb7 ${A.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,T.jsx)(n.default,{style:{alignItems:'center'},children:(0,T.jsx)(C.DepositChip,{b:A,money:!0,big:!0,testID:"edit-deposit"})}),(0,h.isWixBooking)(A)?(0,T.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:h.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:h.WIX_EDIT_NOTE})}):null,(0,T.jsx)(f.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,T.jsxs)(E,{title:"Deposit",testID:"edit-section-deposit",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No deposit",selected:!F.depositOn,testID:"edit-deposit-none",onPress:()=>K({depositOn:!1,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit due",selected:!!F.depositOn&&!F.depositPaid,testID:"edit-deposit-due",onPress:()=>K({depositOn:!0,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit paid",selected:!!F.depositOn&&!!F.depositPaid,testID:"edit-deposit-paid",onPress:()=>{U||X(Y),q||J(P((0,y.ymd)(new Date))),K({depositOn:!0,depositPaid:!0})}})]}),F.depositOn?(0,T.jsx)(f.Field,{label:"Deposit due (\xa3)",value:Y,onChangeText:e=>{G(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,F.depositOn&&F.depositPaid?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Amount paid (\xa3)",value:U,onChangeText:e=>{X(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"How was it paid?"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.DEPOSIT_METHODS.map(e=>(0,T.jsx)(f.Chip,{label:N(e),selected:F.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>K({depositMethod:e})},e))}),(0,T.jsx)(f.Field,{label:"Date paid (DD/MM/YYYY)",value:q,onChangeText:e=>{J((0,s.slashDate)(e,q)),K({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),q.trim()&&!$(q)?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,ie?null:(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,T.jsx)(f.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,T.jsxs)(E,{title:"When",testID:"edit-section-when",children:[(0,T.jsx)(D.BookingDatePicker,{r:O,today:new Date,value:F.date,onChange:e=>K({date:e})}),(0,T.jsx)(f.Field,{label:"Time (24-hour, for example 19:15)",value:F.time,onChangeText:e=>K({time:e}),testID:"edit-time"}),Z?null:(0,T.jsx)(f.T,{size:15,colour:j.colours.amber,children:"Write the time like 19:15."}),(0,T.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,T.jsx)(f.T,{size:18,center:!0,children:"Covers"}),(0,T.jsx)(i.PartySizeInput,{value:F.partySize,onChange:e=>K({partySize:e}),label:"Covers",testID:"edit-covers"})]}),(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:"Table time"}),(0,T.jsx)(f.Stepper,{testID:"edit-duration",value:F.duration||0,min:0,max:360,step:15,onChange:e=>K({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,T.jsxs)(E,{title:"Where",testID:"edit-section-where",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"Any area",selected:!F.area,testID:"edit-area-any",onPress:()=>K({area:''})}),R.areas.map(e=>(0,T.jsx)(f.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:F.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>K({area:e.name})},e.id))]}),(0,T.jsx)(f.T,{size:18,weight:"semibold",center:!0,children:(0,x.tableButtonLabel)(F.table)}),(0,T.jsxs)(f.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Button,{kind:F.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(F.table?'':', chosen'),onPress:()=>K({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),se.map(e=>(0,T.jsx)(f.Button,{kind:e===F.table?'primary':'secondary',label:(0,x.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,x.tableButtonLabel)(e)}${e===F.table?', chosen':''}`,onPress:()=>K({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,T.jsxs)(E,{title:"Guest",testID:"edit-section-guest",children:[(0,T.jsx)(f.Field,{label:"Name",value:F.name,onChangeText:e=>K({name:e}),testID:"edit-name"}),m?(0,T.jsx)(f.Muted,{center:!0,children:"Phone and email can be changed in the Managers app. Use Show number on the booking to see the number."}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Phone",value:F.phone,onChangeText:e=>K({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,T.jsx)(f.Field,{label:"Email",value:F.email,onChangeText:e=>K({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Booked by"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.SOURCES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>K({source:e.id})},e.id))}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.TAGS.map(e=>{const t=(F.tags??[]).includes(e);return(0,T.jsx)(f.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>K({tags:t?(F.tags??[]).filter(t=>t!==e):[...F.tags??[],e].sort()})},e)})})]}),(0,T.jsxs)(E,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,T.jsx)(z,{label:"Dogs",value:F.dogs??0,max:6,onChange:e=>K({dogs:e}),testID:"edit-dogs"}),(0,T.jsx)(z,{label:"High chairs",value:F.highChairs??0,max:10,onChange:e=>K({highChairs:e}),testID:"edit-high-chairs"}),(0,T.jsx)(z,{label:"Wheelchair users",value:F.wheelchair??0,max:10,onChange:e=>K({wheelchair:e}),testID:"edit-wheelchair"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Occasion"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.OCCASIONS.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:(F.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>K({occasion:e.id})},e.id||'none'))})]}),(0,T.jsxs)(E,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No allergies",selected:!!F.allergyNone&&!de.length,testID:"edit-allergy-none",onPress:()=>K({allergyNone:!0,allergies:[]})}),u.ALLERGENS.map(e=>(0,T.jsx)(f.Chip,{label:e.short,selected:de.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>re(e.id)},e.id))]}),de.map(e=>(0,T.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,T.jsxs)(f.T,{size:15,center:!0,children:[u.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:u.SEVERITIES.map(t=>(0,T.jsx)(f.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>K({allergies:de.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,T.jsx)(f.Field,{label:"Anything else about allergies",value:F.allergyNote,onChangeText:e=>K({allergyNote:e}),testID:"edit-allergy-note"}),ne.includes('allergies')&&de.length?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,T.jsx)(z,{label:"Vegan",value:F.vegan??0,max:F.partySize,onChange:e=>K({vegan:e}),testID:"edit-vegan"}),(0,T.jsx)(z,{label:"Vegetarian",value:F.vegetarian??0,max:F.partySize,onChange:e=>K({vegetarian:e}),testID:"edit-vegetarian"})]}),'cancelled'!==A.status?(0,T.jsxs)(E,{title:"Status",testID:"edit-section-status",children:[(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.EDIT_STATUSES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>K({status:e.id})},e.id))}),(0,T.jsx)(f.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,T.jsx)(E,{title:"Notes",testID:"edit-section-notes",children:(0,T.jsx)(f.Field,{label:"Notes",value:F.notes,onChangeText:e=>K({notes:e}),placeholder:h.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),M?(0,T.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:[M.map(e=>(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,H?(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:H}):null,(0,T.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,T.jsx)(f.Button,{label:M?'Save anyway':'Save changes',testID:"edit-save",disabled:!Z||!ie||F.name.trim().length<1||!ne.length,onPress:()=>{const t=Z?(0,d.blockAt)(L,e,F.date,Q):void 0,s=(0,h.editWarnings)(A,ae,B,t,le,R);!s.length||M?oe():_(s)},style:{minHeight:56,flex:1}}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:b,style:{minHeight:56}})]}),ce.length?(0,T.jsx)(E,{title:"Changes",testID:"edit-history",children:ce.slice(0,12).map((e,t)=>(0,T.jsx)(f.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,T.jsx)(I.CancelBookingButton,{rid:e,b:A,name:A.name,big:!0,onDone:()=>b()}),(0,T.jsx)(I.ReinstateBookingButton,{b:A,name:A.name,today:(0,y.ymd)(new Date),onDone:()=>b()})]})}},1135,[34,1059,1120,102,874,1025,1022,876,872,1130,861,1003,892,1023,1115,821,858,1124,1112,1133,794,25]); +__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:a,inStaffApp:n,shiftManager:l,big:o,testID:r}){const[d,u]=(0,t.useState)(!1),x=(0,p.useSession)(e=>e.meId),j=(0,b.useOwner)(e=>e.staff.find(e=>e.id===x&&e.active));return s.walkIn||!(0,h.canEditBooking)({variant:c.APP_VARIANT,inStaffApp:n,role:a,shiftManager:l})||x&&!(0,m.canChangeBookings)(j)?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Button,{kind:"secondary",small:!o,label:"Edit booking",sub:o?void 0:"Deposit, dog, table, anything",testID:r??`edit-booking-${s.id}`,accessibilityLabel:`Edit booking, ${s.name}, ${s.time}`,onPress:()=>u(!0),style:{minHeight:o?64:44}}),d?(0,T.jsx)(B,{rid:e,id:s.id,who:i,onClose:()=>u(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:s,who:i,onClose:a,hidePrivate:n}){const[o,r]=(0,t.useState)(null),d=(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,T.jsx)(B,{rid:e,id:o,who:i,hidePrivate:n,onClose:a}):(0,T.jsxs)(f.Sheet,{visible:!0,onClose:a,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.text,children:"Tip: tap the booking you want to change. Any upcoming day."}),d.length?d.map(e=>(0,T.jsx)(f.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${k(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}, ${k(e.date,s).toLowerCase()}, ${e.time}, ${e.partySize} Covers`,onPress:()=>r(e.id),style:{minHeight:56}},e.id)):(0,T.jsx)(f.Muted,{center:!0,children:"No bookings to edit from today on."}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:a,style:{minHeight:44}})]})},_e.EditBookingSheet=B;var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),a=_r(_d[3]),n=(e=a)&&e.__esModule?e:{default:e},l=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),b=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),j=_r(_d[15]),y=_r(_d[16]),D=_r(_d[17]),C=_r(_d[18]),I=_r(_d[19]),f=_r(_d[20]),T=_r(_d[21]);const v=/^([01]\d|2[0-3]):[0-5]\d$/,w=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};const k=(e,t)=>{if(e===t)return'Today';const s=new Date(`${t}T12:00:00`);return s.setDate(s.getDate()+1),e===(0,y.ymd)(s)?'Tomorrow':$(e)};const S=e=>e?(e/100).toFixed(e%100?2:0):'',P=e=>{const t=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(t)&&t>=0?Math.round(100*t):NaN},$=e=>e&&/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}/${e.slice(0,4)}`:'',N=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=>e.charAt(0).toUpperCase()+e.slice(1);function z({title:e,children:t,testID:s}){return(0,T.jsxs)(n.default,{testID:s,style:{gap:8,paddingTop:10,borderTopWidth:1,borderTopColor:j.colours.hairline,alignItems:'stretch'},children:[(0,T.jsx)(f.T,{size:17,weight:"semibold",center:!0,colour:j.colours.goldLight,children:e}),t]})}const A=({label:e,value:t,onChange:s,max:i=20,testID:a})=>(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:e}),(0,T.jsx)(f.Stepper,{testID:a,value:t,min:0,max:i,onChange:s,label:e})]});function B({rid:e,id:a,who:p,onClose:b,hidePrivate:m='display'===c.APP_VARIANT}){const k=(0,l.useBookings)(e),B=k.find(e=>e.id===a),O=(0,d.useRestaurant)(e),R=(0,o.usePlan)(e),L=(0,r.useBlocks)(e=>e.blocks),[F,W]=(0,t.useState)(B?(0,h.draftOf)(B):null),[M,_]=(0,t.useState)(null),[H,V]=(0,t.useState)(null),[Y,G]=(0,t.useState)(S(B?(0,h.draftOf)(B).depositDue:0)),[U,X]=(0,t.useState)(S(B?(0,h.draftOf)(B).depositAmount:0)),[q,J]=(0,t.useState)($(B?(0,h.draftOf)(B).depositDate:''));if(!B||!F||!O)return null;const K=e=>{_(null),V(null),W({...F,...e})},Q=w(F.time),Z=v.test(Q),ee=F.area?R.areas.filter(e=>e.name===F.area).map(e=>e.id):null,te=e=>!ee||e.split('+').every(e=>ee.includes(R.tables.find(t=>t.name===e)?.areaId??'')),se=(0,x.tableOptions)(R,k.filter(e=>e.date===F.date),F.table).filter(e=>te(e)||e===F.table),ie=!(F.depositOn&&(Number.isNaN(P(Y||'0'))||F.depositPaid&&(Number.isNaN(P(U||'0'))||q.trim()&&!N(q)))),ae={...F,time:Q,depositDue:P(Y||'0')||0,depositAmount:P(U||'0')||0,depositDate:N(q)},ne=(0,h.changedFields)(B,ae),le=O.settings.turnMins??90,oe=async()=>{const t=(0,h.editPatch)(B,ae,{by:p||'Team member',app:c.APP_VARIANT});if(Object.keys(t).length&&await l.repo.bookings.update(B.id,t),'seated'===B.status&&'table'in t&&t.table!==B.table){const s=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],i=s(B.table),a=s(t.table),n=o.useFloor.getState(),l=i.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';i.filter(e=>!a.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),a.forEach(t=>n.setLive(e,t,{stage:l,dirty:!1}))}V(`Saved. Changed: ${(0,h.editedWords)(ne)}.`),_(null),b()},re=F.allergies??[],de=e=>K({allergyNone:!1,allergies:re.some(t=>t.allergen===e)?re.filter(t=>t.allergen!==e):[...re,{allergen:e,severity:'allergy'}]}),ce=(0,h.historyLines)(B);return(0,T.jsxs)(f.Sheet,{visible:!0,onClose:b,title:`Edit booking \xb7 ${B.name} \xb7 ${B.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,T.jsx)(n.default,{style:{alignItems:'center'},children:(0,T.jsx)(C.DepositChip,{b:B,money:!0,big:!0,testID:"edit-deposit"})}),(0,h.isWixBooking)(B)?(0,T.jsx)(n.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:h.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:j.colours.gold},children:(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:h.WIX_EDIT_NOTE})}):null,(0,T.jsx)(f.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,T.jsxs)(z,{title:"Deposit",testID:"edit-section-deposit",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No deposit",selected:!F.depositOn,testID:"edit-deposit-none",onPress:()=>K({depositOn:!1,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit due",selected:!!F.depositOn&&!F.depositPaid,testID:"edit-deposit-due",onPress:()=>K({depositOn:!0,depositPaid:!1})}),(0,T.jsx)(f.Chip,{label:"Deposit paid",selected:!!F.depositOn&&!!F.depositPaid,testID:"edit-deposit-paid",onPress:()=>{U||X(Y),q||J($((0,y.ymd)(new Date))),K({depositOn:!0,depositPaid:!0})}})]}),F.depositOn?(0,T.jsx)(f.Field,{label:"Deposit due (\xa3)",value:Y,onChangeText:e=>{G(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-due-amount"}):null,F.depositOn&&F.depositPaid?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Amount paid (\xa3)",value:U,onChangeText:e=>{X(e),K({})},keyboardType:"decimal-pad",testID:"edit-deposit-amount"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"How was it paid?"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.DEPOSIT_METHODS.map(e=>(0,T.jsx)(f.Chip,{label:E(e),selected:F.depositMethod===e,testID:`edit-deposit-method-${e.replace(' ','-')}`,onPress:()=>K({depositMethod:e})},e))}),(0,T.jsx)(f.Field,{label:"Date paid (DD/MM/YYYY)",value:q,onChangeText:e=>{J((0,s.slashDate)(e,q)),K({})},placeholder:"11/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10,testID:"edit-deposit-date"}),q.trim()&&!N(q)?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write the date like 11/11/2026."}):null]}):null,ie?null:(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"Write amounts in pounds, for example 60 or 12.50."}),(0,T.jsx)(f.Muted,{center:!0,children:"No payment is taken in CoverCharge: this records what the guest paid."})]}),(0,T.jsxs)(z,{title:"When",testID:"edit-section-when",children:[(0,T.jsx)(D.BookingDatePicker,{r:O,today:new Date,value:F.date,onChange:e=>K({date:e})}),(0,T.jsx)(f.Field,{label:"Time (24-hour, for example 19:15)",value:F.time,onChangeText:e=>K({time:e}),testID:"edit-time"}),Z?null:(0,T.jsx)(f.T,{size:15,colour:j.colours.amber,children:"Write the time like 19:15."}),(0,T.jsxs)(n.default,{style:{gap:6,alignItems:'center'},children:[(0,T.jsx)(f.T,{size:18,center:!0,children:"Covers"}),(0,T.jsx)(i.PartySizeInput,{value:F.partySize,onChange:e=>K({partySize:e}),label:"Covers",testID:"edit-covers"})]}),(0,T.jsxs)(f.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,T.jsx)(f.T,{size:16,children:"Table time"}),(0,T.jsx)(f.Stepper,{testID:"edit-duration",value:F.duration||0,min:0,max:360,step:15,onChange:e=>K({duration:e}),format:e=>e?`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`:'As usual',label:"Table time"})]})]}),(0,T.jsxs)(z,{title:"Where",testID:"edit-section-where",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"Any area",selected:!F.area,testID:"edit-area-any",onPress:()=>K({area:''})}),R.areas.map(e=>(0,T.jsx)(f.Chip,{label:`${e.name}${e.dogs?' \xb7 dogs ok':''}`,selected:F.area===e.name,testID:`edit-area-${e.id}`,onPress:()=>K({area:e.name})},e.id))]}),(0,T.jsx)(f.T,{size:18,weight:"semibold",center:!0,children:(0,x.tableButtonLabel)(F.table)}),(0,T.jsxs)(f.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Button,{kind:F.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+(F.table?'':', chosen'),onPress:()=>K({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),se.map(e=>(0,T.jsx)(f.Button,{kind:e===F.table?'primary':'secondary',label:(0,x.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,x.tableButtonLabel)(e)}${e===F.table?', chosen':''}`,onPress:()=>K({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]})]}),(0,T.jsxs)(z,{title:"Guest",testID:"edit-section-guest",children:[(0,T.jsx)(f.Field,{label:"Name",value:F.name,onChangeText:e=>K({name:e}),testID:"edit-name"}),m?(0,T.jsx)(f.Muted,{center:!0,children:"Phone and email can be changed in the Managers app. Use Show number on the booking to see the number."}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.Field,{label:"Phone",value:F.phone,onChangeText:e=>K({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,T.jsx)(f.Field,{label:"Email",value:F.email,onChangeText:e=>K({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Booked by"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.SOURCES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.source===e.id,testID:`edit-source-${e.id}`,onPress:()=>K({source:e.id})},e.id))}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.TAGS.map(e=>{const t=(F.tags??[]).includes(e);return(0,T.jsx)(f.Chip,{label:e,selected:t,testID:`edit-tag-${e}`,onPress:()=>K({tags:t?(F.tags??[]).filter(t=>t!==e):[...F.tags??[],e].sort()})},e)})})]}),(0,T.jsxs)(z,{title:"Dogs, high chairs and access",testID:"edit-section-needs",children:[(0,T.jsx)(A,{label:"Dogs",value:F.dogs??0,max:6,onChange:e=>K({dogs:e}),testID:"edit-dogs"}),(0,T.jsx)(A,{label:"High chairs",value:F.highChairs??0,max:10,onChange:e=>K({highChairs:e}),testID:"edit-high-chairs"}),(0,T.jsx)(A,{label:"Wheelchair users",value:F.wheelchair??0,max:10,onChange:e=>K({wheelchair:e}),testID:"edit-wheelchair"}),(0,T.jsx)(f.T,{size:16,center:!0,children:"Occasion"}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.OCCASIONS.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:(F.occasion??'')===e.id,testID:`edit-occasion-${e.id||'none'}`,onPress:()=>K({occasion:e.id})},e.id||'none'))})]}),(0,T.jsxs)(z,{title:"Allergies and dietary",testID:"edit-section-allergies",children:[(0,T.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,T.jsx)(f.Chip,{label:"No allergies",selected:!!F.allergyNone&&!re.length,testID:"edit-allergy-none",onPress:()=>K({allergyNone:!0,allergies:[]})}),u.ALLERGENS.map(e=>(0,T.jsx)(f.Chip,{label:e.short,selected:re.some(t=>t.allergen===e.id),testID:`edit-allergen-${e.id}`,onPress:()=>de(e.id)},e.id))]}),re.map(e=>(0,T.jsxs)(n.default,{style:{gap:4,alignItems:'center'},children:[(0,T.jsxs)(f.T,{size:15,center:!0,children:[u.ALLERGENS.find(t=>t.id===e.allergen)?.short,": how serious?"]}),(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:u.SEVERITIES.map(t=>(0,T.jsx)(f.Chip,{label:t.label,selected:e.severity===t.id,testID:`edit-severity-${e.allergen}-${t.id}`,onPress:()=>K({allergies:re.map(s=>s.allergen===e.allergen?{...s,severity:t.id}:s)})},t.id))})]},e.allergen)),(0,T.jsx)(f.Field,{label:"Anything else about allergies",value:F.allergyNote,onChangeText:e=>K({allergyNote:e}),testID:"edit-allergy-note"}),ne.includes('allergies')&&re.length?(0,T.jsx)(f.T,{size:15,center:!0,colour:j.colours.amber,children:"The kitchen signs off allergies again after this change."}):null,(0,T.jsx)(A,{label:"Vegan",value:F.vegan??0,max:F.partySize,onChange:e=>K({vegan:e}),testID:"edit-vegan"}),(0,T.jsx)(A,{label:"Vegetarian",value:F.vegetarian??0,max:F.partySize,onChange:e=>K({vegetarian:e}),testID:"edit-vegetarian"})]}),'cancelled'!==B.status?(0,T.jsxs)(z,{title:"Status",testID:"edit-section-status",children:[(0,T.jsx)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:h.EDIT_STATUSES.map(e=>(0,T.jsx)(f.Chip,{label:e.label,selected:F.status===e.id,testID:`edit-status-${e.id}`,onPress:()=>K({status:e.id})},e.id))}),(0,T.jsx)(f.Muted,{center:!0,children:"To cancel, use Cancel booking below. Nothing is ever deleted."})]}):null,(0,T.jsx)(z,{title:"Notes",testID:"edit-section-notes",children:(0,T.jsx)(f.Field,{label:"Notes",value:F.notes,onChangeText:e=>K({notes:e}),placeholder:h.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"})}),M?(0,T.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:[M.map(e=>(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:e},e)),(0,T.jsx)(f.T,{size:16,center:!0,colour:"#FFE2A8",children:"You can still save."})]}):null,H?(0,T.jsx)(f.T,{size:16,center:!0,colour:j.colours.goldLight,children:H}):null,(0,T.jsxs)(f.Row,{gap:8,wrap:!0,children:[(0,T.jsx)(f.Button,{label:M?'Save anyway':'Save changes',testID:"edit-save",disabled:!Z||!ie||F.name.trim().length<1||!ne.length,onPress:()=>{const t=Z?(0,r.blockAt)(L,e,F.date,Q):void 0,s=(0,h.editWarnings)(B,ae,k,t,le,R);!s.length||M?oe():_(s)},style:{minHeight:56,flex:1}}),(0,T.jsx)(f.Button,{kind:"ghost",label:"Close",onPress:b,style:{minHeight:56}})]}),ce.length?(0,T.jsx)(z,{title:"Changes",testID:"edit-history",children:ce.slice(0,12).map((e,t)=>(0,T.jsx)(f.T,{size:14,center:!0,colour:j.colours.muted,children:e},t))}):null,(0,T.jsx)(I.CancelBookingButton,{rid:e,b:B,name:B.name,big:!0,onDone:()=>b()}),(0,T.jsx)(I.ReinstateBookingButton,{b:B,name:B.name,today:(0,y.ymd)(new Date),onDone:()=>b()})]})}},1135,[34,1059,1120,102,874,1025,1022,876,872,1130,861,1003,892,1023,1115,821,858,1124,1112,1133,794,25]); __d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceSlot",{enumerable:!0,get:function(){return w}}),_e.voiceAppFor=h,_e.useVoiceTarget=p,_e.VoiceSlot=function({size:e=56,layer:t=0}){const u=p(),c=(0,n.useRef)(null),l=(0,n.useRef)(y++).current,{width:f,height:h,fontScale:v}=(0,o.default)(),A=()=>{if(t{if(c.current!==e||!s||tu+.5?w.getState().owner===l&&w.setState({rect:null,owner:0}):w.setState({rect:{x:n,y:o,size:s},owner:l})})},W=(0,n.useRef)(A);return W.current=A,(0,n.useLayoutEffect)(()=>{if(u?.on)return S.set(l,{layer:t,measure:()=>W.current()}),()=>{S.delete(l),w.getState().owner===l&&w.setState({rect:null,owner:0}),requestAnimationFrame(b)}},[u?.on,t]),(0,n.useLayoutEffect)(()=>{A();const e=requestAnimationFrame(A);return()=>cancelAnimationFrame(e)},[f,h,v,u?.on]),(0,n.useEffect)(()=>{const e=c.current;if(!u?.on||'undefined'==typeof ResizeObserver||!e?.parentElement)return;const t=new ResizeObserver(A);return t.observe(e.parentElement),e.parentElement.parentElement&&t.observe(e.parentElement.parentElement),()=>t.disconnect()},[u?.on]),(0,n.useEffect)(()=>()=>{w.getState().owner===l&&w.setState({rect:null,owner:0})},[]),(0,n.useEffect)(()=>{u?.on||w.getState().owner!==l||w.setState({rect:null,owner:0})},[u?.on]),u?.on?(0,m.jsx)(s.default,{ref:c,testID:"voice-slot",onLayout:A,style:{width:e,height:e,flexShrink:0}}):null};var t=r(d[0]),n=r(d[1]),o=e(r(d[2])),s=e(r(d[3])),u=r(d[4]),c=r(d[5]),l=r(d[6]),f=r(d[7]),m=r(d[8]);const w=(0,u.create)(()=>({rect:null,owner:0}));function h(e){return'customer'===c.APP_VARIANT||/^\/(customer|table|demo)/.test(e)?null:e.startsWith('/owner')||e.startsWith('/admin')?'owner':e.startsWith('/team')?'staff':e.startsWith('/kitchen')?'chef':e.startsWith('/display')?'display':null}function p(){const e=(0,t.usePathname)()||'/',n=(0,l.useCtx)(6e4),o=(0,f.useVoiceSettings)(e=>e.enabled),s=h(e);if(!s)return null;const u='owner'===s?'owner'===n.role?'owner':'manager'===n.role?'manager':'staff':s;return{app:s,role:u,actions:'staff'===u?'staff':s,on:(0,f.voiceOn)(o,n.rid,u)}}let y=1;const S=new Map,E=()=>{let e=-1;return S.forEach(t=>{t.layer>e&&(e=t.layer)}),e};function b(){const e=E();S.forEach(t=>{t.layer===e&&t.measure()})}},1136,[30,34,426,102,846,872,1084,1137,25]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_ROLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"VOICE_ROLE_LABEL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useVoiceSettings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"voiceOn",{enumerable:!0,get:function(){return f}}),_e.micExplainedFor=function(e){try{if('1'===b()?.getItem(s(e)))return!0}catch{}return u.getState().micExplained},_e.setMicExplainedFor=function(e){try{b()?.setItem(s(e),'1')}catch{}u.getState().setMicExplained(!0)};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},c=r(d[1]),l=r(d[2]);const o=['owner','manager','staff','chef','display'],p={owner:'Owner (Managers app)',manager:'Managers (Managers app)',staff:'Staff app (full voice assistant, no money or HR)',chef:'Head Chef app',display:'Main Display'},u=(0,c.create)()((0,l.persist)(e=>({enabled:{},micExplained:!1,setEnabled:(n,t,c)=>e(e=>({enabled:{...e.enabled,[n]:{...e.enabled[n]??{},[t]:c}}})),setMicExplained:n=>e({micExplained:n})}),{name:'covercharge-voice-v1',version:4,storage:(0,l.createJSONStorage)(()=>t.default),migrate:(e,n)=>({enabled:n<2?{}:e?.enabled??{},micExplained:!!e?.micExplained}),merge:(e,n)=>({...n,enabled:e?.enabled??n.enabled,micExplained:e?.micExplained??n.micExplained}),partialize:e=>({enabled:e.enabled,micExplained:e.micExplained})})),f=(e,n,t)=>!1!==e[n]?.[t],s=e=>`cc-voice-mic-explained-${e}`,b=()=>{try{return'undefined'!=typeof window?window.localStorage:void 0}catch{return}}},1137,[839,846,849]); __d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VAT",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return n}}),e.dishCost=i,Object.defineProperty(e,"gpPct",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"priceForTarget",{enumerable:!0,get:function(){return c}}),e.costings=function(r,c,s,u){const d=(0,t.dishStats)(r);return c.map(t=>{const c=r.find(r=>r.id===t.dishId);if(!c||null==c.price)return null;const p=i(t,s),l=n(c.price),f=o(p,c.price),b=d.find(t=>t.item.id===c.id)?.sold??0;return{item:c,recipe:t,cost:p,priceInc:c.price,priceEx:l,gp:f,cashGp:l-p,below:ft.prevCost&&t.prevCost!==t.cost).map(s=>{const u=(s.cost-(s.prevCost??s.cost))/(s.prevCost??1)*100,d=r.filter(t=>t.lines.some(t=>t.ing===s.id)).map(r=>{const u=t.find(t=>t.id===r.dishId);if(!u||null==u.price)return null;const d=o(i(r,n,{ing:s.id,cost:s.prevCost}),u.price),p=o(i(r,n),u.price);return{item:u,before:d,after:p,dropped:d>=c&&pt.dropped),below:d.filter(t=>t.below)}})},e.weekGp=function(t,r,n){const i=t.reduce((t,r)=>t+r.priceEx*r.soldWeek,0),o=t.reduce((t,r)=>t+r.cost*r.soldWeek,0),c=o+r+Math.max(0,n);return{sales:i,theoCost:o,actualCost:c,theo:i?(i-o)/i*100:0,actual:i?(i-c)/i*100:0}},Object.defineProperty(e,"fmtQty",{enumerable:!0,get:function(){return s}});var t=_r(_d[0]);const r=.2,n=t=>Math.round(t/1.2);function i(t,r,n){return Math.round(t.lines.reduce((t,i)=>{const o=r.find(t=>t.id===i.ing);return t+(n&&n.ing===i.ing?n.cost:o?.cost??0)*i.qty},0))}const o=(t,r)=>{const i=n(r);return i>0?(i-t)/i*100:0},c=(t,r)=>50*Math.ceil(t/(1-r/100)*1.2/50);const s=(t,r)=>`${Number.isInteger(t)?t:t.toFixed(t<1?3:2).replace(/0+$/,'').replace(/\.$/,'')} ${'each'===r?'':r}`.trim()},1138,[1139]); @@ -1389,7 +1389,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}},1306,[827,860,34,102,794,861,867,1154,1307,874,821,25]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1307,[934,988,1154]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1308,[30,34,872,1309,1373,25]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ge}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:b,headerExtra:K,subHeader:He,noVoice:Pe=!1}={}){const Ue=(0,N.default)(),Je=b??Ue.width,Xe=Ue.height,Ze=Je<700,et=Je>=Xe,tt=!Ze&&et&&Je>=600,lt=tt,st=Math.round(Math.min(520,Math.max(Je>=1e3?448:280,.3*Je))),it=$.default.useRef(null),ot=$.default.useRef(0),[nt,at]=(0,T.useState)({w:0,h:0}),rt=(0,X.useOwner)(e=>e.site),dt=(0,Y.useRestaurant)(rt);(0,Ie.useAlertWatcher)(rt,{enabled:!e});const ct=(0,Y.useOrders)(rt),ut=(0,Y.useBookings)(rt),ht=(0,Y.useEvents)(rt),gt=(0,Y.useStore)(e=>e.skipMinutes),bt=(0,Y.useStore)(e=>e.clock.mode),yt=(0,Y.useNow)(5e3),pt=(0,X.useOwner)(e=>e.staff),ft=(0,X.useOwner)(e=>e.attendance),xt=(0,X.useOwner)(e=>e.shifts);$.default.useEffect(()=>{(0,ee.ensureAttendance)((0,q.ymd)(yt),yt)},[(0,q.ymd)(yt)]);const mt=ft.filter(e=>e.in&&!e.out&&yt.getTime()-new Date(e.in).getTime()<72e6&&yt.getTime()>=new Date(e.in).getTime()),jt=Ve(pt.find(e=>e.id===mt[0]?.staffId)?.name)||'Duty Manager',wt=k.IS_CAR?'Car':'Display';(0,v.useSoldOutLink)(!1,e?void 0:wt,!0);const kt=(0,q.ymd)(yt),It=(0,R.useTravelDay)('display',kt),Dt=(0,Z.useFrontDoor)(kt,et),vt=(0,te.useDisplaySettings)(rt),St=vt.privacy,Ct=(0,ce.useSaverSync)(),Tt=(0,te.usePlan)(rt),$t=(0,te.useFloor)(e=>e.live[rt]),Bt=(0,De.useBlocks)(e=>e.blocks),[Rt,Lt]=(0,T.useState)('plan'),[Wt,zt]=(0,T.useState)(!1),[Mt,Ht]=(0,T.useState)('all'),[Pt,Et]=(0,T.useState)(null),[Ot,At]=(0,T.useState)(null),[Nt,_t]=(0,T.useState)(null),[Gt,Vt]=(0,T.useState)(!1),[Ft,Ut]=(0,T.useState)(!1),[Kt,qt]=(0,T.useState)(null),[Yt,Qt]=(0,T.useState)(!1),[Jt,Xt]=(0,T.useState)(!1),[Zt,el]=(0,T.useState)(null),[tl,ll]=(0,T.useState)(null),[sl,il]=(0,T.useState)(null),ol=$.default.useRef(0),nl=e=>{ol.current=Date.now(),il(e)};$.default.useEffect(()=>{if(!sl)return;const e=setInterval(()=>{Date.now()-ol.current>=Te.DAY_IDLE_MS&&il(null)},5e3);return()=>clearInterval(e)},[sl]);const al=(0,Y.useWaitlist)(rt),rl=(0,Y.useStore)(e=>e.walkIns[rt]??0),[dl,cl]=(0,T.useState)(!1),[ul,hl]=(0,T.useState)(!1),[gl,bl]=(0,T.useState)(!1);(0,F.useReviewAlerts)(rt);const[yl,pl]=(0,T.useState)({view:0,content:0}),[fl,xl]=(0,T.useState)(null);$.default.useEffect(()=>{fl&&((0,S.notify)({id:`floor-note:${Date.now()}`,title:fl,timeoutMs:4500,big:!0,testID:'floor-toast'}),xl(null))},[fl]),$.default.useEffect(()=>{if(!e)return(0,L.setDisplaySilent)(!0),()=>(0,L.setDisplaySilent)(!1)},[e]);const[ml,jl]=(0,T.useState)(null),wl=$.default.useRef(0),[kl,Il]=(0,T.useState)(null);$.default.useEffect(()=>{if(!ml)return;wl.current=Date.now();const e=setInterval(()=>{const e=Date.now()-wl.current;if(e>=Ge)return jl(null),void xl('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Il(e>=105e3?Math.ceil((Ge-e)/1e3):null)},1e3);return()=>clearInterval(e)},[ml]);const Dl=e=>e.date!==kt?_t({title:`Guest details \xb7 ${(0,Te.dayWord)(e.date,kt)} ${e.time}`,body:(0,Ae.jsx)(Ae.Fragment,{children:(0,me.bookingDetails)(e)})}):_t({title:`Guest details \xb7 ${e.time}`,body:(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(Qe,{rid:rt,id:e.id,turnBase:dt.settings.turnMins}),e.walkIn?null:(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ae.jsx)(ye.CancelWalkInButton,{rid:rt,b:e,big:!0,onDone:e=>{_t(null),xl(e)}}):null,e.walkIn?(0,Ae.jsx)(ye.ReinstateWalkInButton,{rid:rt,b:e,today:kt,onDone:e=>{_t(null),xl(e)}}):null,(0,me.bookingDetails)(e)]})}),vl=ut.filter(e=>e.date===kt).sort((e,t)=>e.time.localeCompare(t.time)),Sl=vl.filter(e=>!['cancelled','noshow'].includes(e.status)),Cl=ct.filter(Fe).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Tl=(0,T.useMemo)(()=>(0,c.forecastToday)(dt,ut,ct,ht,yt),[dt,ut,ct,ht,yt.getTime()/6e4|0]),$l=(0,De.closedAreasAt)(Bt,rt,kt,(0,q.hm)(yt)),Bl=[...$l].join(','),Rl=(0,T.useMemo)(()=>(0,le.floorView)(Tt,ut,ct,$t??{},yt,dt.settings.turnMins,$l),[Tt,ut,ct,$t,yt.getTime(),Bl]),Ll=(0,xe.hoursFor)(dt,yt),Wl=Ll?.open??new Date(`${kt}T12:00:00`),zl=Ll?.close??new Date(`${kt}T21:00:00`),Ml=(0,q.addMins)(Wl,-Wl.getMinutes()),Hl=(0,q.addMins)(zl,30),Pl=e=>new Date(`${kt}T${e}:00`),El=(0,De.blocksOn)(Bt,rt,kt).map(e=>({from:Pl(e.from),to:Pl(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(dt,yt,kt)),Ol=Object.keys(Rl).filter(e=>'blocked'===Rl[e]?.status),Al=sl&&sl!==kt?sl:kt,Nl=Al!==kt,_l=(0,Te.dayWord)(Al,kt),Gl=/^(Today|Yesterday|Tomorrow)$/.test(_l),Vl=Nl?(0,Te.bookingsForDay)(ut,Al,kt).sort((e,t)=>e.time.localeCompare(t.time)):vl,Fl=(0,q.parseYmd)(Al);Fl.setHours(12);const Ul=Nl?(0,xe.hoursFor)(dt,Fl):Ll,Kl=Ul?.open??new Date(`${Al}T12:00:00`),ql=Ul?.close??new Date(`${Al}T21:00:00`),Yl=e=>new Date(`${Al}T${e}:00`),Ql=[...Nl?(0,De.blocksOn)(Bt,rt,Al).map(e=>({from:Yl(e.from),to:Yl(e.to),label:e.reason??'Paused'})):El,...Nl?(0,o.queuedServicePauses)(dt,Fl,Al):[]],Jl=(0,o.queuedServiceSessions)(dt,Fl),Xl=s.IS_QUEUED_VENUE&&(void 0===Jl||!Jl.length),Zl=(0,Ae.jsxs)(A.default,{testID:"queued-hours-gate",style:[We.look.panel,{padding:14,gap:8}],children:[(0,Ae.jsx)(G.T,{weight:"semibold",children:void 0===Jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ae.jsx)(G.Muted,{children:i.queuedVenues[rt]?.hours.note})]}),es=Nl?Ul||Vl.length?AlNl?(0,le.dayFloorView)(Tt,Vl,Al):Rl,[Nl,Tt,Vl,Al,Rl]),[ls,ss]=(0,T.useState)(null),is=Nl?Vl.filter(e=>!['cancelled','noshow'].includes(e.status)):Sl,os=is.reduce((e,t)=>e+t.partySize,0),ns=(0,u.coversSplit)(is,Al),as=(0,$e.cancelledDayTally)(ut,Al),rs=(0,Be.cancellationsFor)(ut,Al,e=>e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)','')),ds=(0,$e.cancelledTallyWords)(as,Gl?_l.toLowerCase():Nl?`on ${_l}`:'today'),cs=Bt.filter(e=>e.rid===rt&&e.date===Al&&!e.removedAt),us=(0,Ce.chartBands)(cs,60*Kl.getHours()+Kl.getMinutes(),60*ql.getHours()+ql.getMinutes()),hs=new Set((0,Ce.blockedHours)(us)),gs=yt.getHours()+(yt.getMinutes()>=30?1:0),bs=Tl.hours.filter(e=>e.hour>=gs&&!hs.has(e.hour)),ys=bs.reduce((e,t)=>e+t.coversHigh,0),ps=bs.reduce((e,t)=>e+t.coversLow,0),fs=Math.round((ps+ys)/2),xs=!Tl.example&&Tl.open&&Tl.enough&&ys>0?`Usually ${(0,c.coversRange)(fs,fs)} more`:void 0,ms=async(e,t)=>{const l=Rl[e]?.booking;if(!l||e===t)return;const s=Rl[t]?.status;if(s&&!['free','soon'].includes(s))return void xl('dirty'===s?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${le.STATUS[s].label.toLowerCase()}. Pick a free table.`);await Y.repo.bookings.update(l.id,{table:t});const i=$t?.[e]?.stage;te.useFloor.getState().setLive(rt,t,{stage:i??'seated',dirty:!1}),te.useFloor.getState().setLive(rt,e,{stage:void 0,dirty:!0}),xl(`${(0,ue.privName)(l,St)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`)},js=tl?ut.find(e=>e.id===tl.id):void 0,ws=tl&&js?(()=>{const e=js.walkIn?(0,ue.privName)(js,St):Ve(js.name),t=(0,fe.seatsOf)(Tt,tl.tables).total,l=(0,fe.seatLine)(t,js.partySize),s=(0,fe.pickClashes)(js,tl.tables,ut.filter(e=>e.date===js.date),dt.settings.turnMins),i=(0,fe.tableKey)(tl.tables)!==(0,fe.tableKey)((0,te.tablesOf)(js.table));return(0,Ae.jsxs)(A.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:Q.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:Q.colours.gold,padding:10},children:[(0,Ae.jsxs)(A.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Te.dayWord)(js.date,kt)} ${js.time}. Tap tables on the plan to add or take them off. ${(0,fe.tablesWords)(tl.tables)}. ${l.text}.${s.length?` ${s.length} clash${1===s.length?'':'es'} with other bookings.`:''}`,children:[(0,Ae.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Te.dayWord)(js.date,kt)," ",js.time]}),(0,Ae.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[(0,fe.tablesWords)(tl.tables)," \xb7 ",l.text,s.length?` \xb7 ${[...new Set(s.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,Ae.jsxs)(G.Row,{gap:8,wrap:!0,children:[(0,Ae.jsx)(G.Button,{testID:"plan-pick-save",label:s.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${s.length?'Save anyway':'Save'}, ${(0,fe.tablesWords)(tl.tables)} for ${e}. ${l.text}.`,onPress:async()=>{if(js){try{await(0,pe.saveBookingTables)(rt,js,tl.tables),xl((0,fe.savedWords)(e,js.partySize,tl.tables,t))}catch(t){xl(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}ll(null)}else ll(null)}}),(0,Ae.jsx)(G.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>ll(null)})]})]})})():null,ks=Tt.areas.filter(e=>Tt.tables.some(t=>t.areaId===e.id)),Is=e=>{const t=Tt.tables.filter(t=>t.areaId===e);return Nl?`${t.filter(e=>!ts[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Rl[e.name]?.status??'free')).length}/${t.length} free`},Ds='all'===Mt||ks.some(e=>e.id===Mt)?Mt:'all',vs=e=>(0,Ae.jsx)(se.FloorCanvas,{plan:Tt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:tt,big:!0,view:ts,privacy:St,turnBase:dt.settings.turnMins,highlight:tl?tl.tables:Ot?[Ot]:void 0,onTap:e=>{return t=e.name,void(tl?ll(e=>e?{...e,tables:(0,fe.toggleTable)(e.tables,t)}:e):Nl?ss(t):Ot?(t!==Ot&&ms(Ot,t),At(null)):Et(t));var t},onDrop:(e,t)=>tl||Nl?void 0:ms(e.name,t.name)}),Ss=Ze?1:et||ks.length>2?2:1,Cs=e=>{const t=Tt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const l=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/l},Ts=[];for(let e=0;e{const t=(0,se.areaBounds)(Tt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,se.minReadableScale)(Tt,e.id)}}),nt.w,nt.h):null,Bs=e=>(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between',height:ie.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,children:Is(e.id)})]}),Rs=(0,Ae.jsx)(A.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:l}=e.nativeEvent.layout;(Math.abs(t-nt.w)>1||Math.abs(l-nt.h)>1)&&at({w:t,h:l})},children:$s?(0,Ae.jsx)(O.default,{style:{flex:1},scrollEnabled:$s.scroll,showsVerticalScrollIndicator:$s.scroll,contentContainerStyle:{gap:ie.GRID_GAP},children:$s.rows.map((e,t)=>(0,Ae.jsx)(A.default,{style:{height:$s.rowHeights[t],flexDirection:'row',gap:ie.GRID_GAP},children:e.map(e=>{const t=ks.find(t=>t.id===e);return(0,Ae.jsxs)(A.default,{testID:`area-cell-${e}`,style:{width:$s.cellW,gap:2},children:[Bs(t),(0,Ae.jsx)(A.default,{style:{flex:1},children:vs(e)})]},e)})},t))}):null}),Ls=(0,Ae.jsxs)(A.default,{testID:"venue-plan",style:{flex:Ze?void 0:1,gap:10,minWidth:0},children:[(0,Ae.jsx)(r.TableNumberWarning,{plan:Tt}),Tt.tables.length?null:(0,Ae.jsxs)(A.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ae.jsx)(G.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ae.jsx)(G.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),s.IS_WILDINGS||s.IS_KIRKMICHAEL||s.IS_SOUTERS?(0,Ae.jsx)(G.Muted,{center:!0,testID:"display-venue-hours",children:(s.IS_WILDINGS?a.WILDINGS_GUIDE:s.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ae.jsx)(qe,{chipId:"all",compact:!Ze,label:"Whole venue",selected:'all'===Ds,onPress:()=>Ht('all')},"__all"),...ks.map(e=>(0,Ae.jsx)(qe,{chipId:e.id,compact:!Ze,label:`${e.name}${(0,oe.areaMarks)(e)}`,colour:(0,Q.brandColour)(e.colour),sub:Ze?$l.has(e.id)?'closed':Ds===e.id?Is(e.id):void 0:void 0,selected:Ds===e.id,onPress:()=>Ht(e.id)},e.id))];return Ze?(0,Ae.jsx)(A.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ae.jsx)(O.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;pl(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>pl(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:yl.view>0&&yl.content>0&&yl.content<=yl.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:yl.view>0&&yl.content<=yl.view+1?'100%':void 0},children:e})})(),(0,Ae.jsx)(g.FloorLegend,{}),ws,Ot?(0,Ae.jsxs)(G.Row,{gap:8,style:{backgroundColor:Q.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ae.jsxs)(G.T,{weight:"semibold",colour:Q.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Ot),": tap the new table."]}),(0,Ae.jsx)(G.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>At(null)})]}):null,'all'===Ds&&tt?Rs:'all'===Ds?(0,Ae.jsx)(A.default,{style:{flex:Ze?void 0:1,gap:12,minHeight:lt?void 0:360},children:Ts.map((e,t)=>(0,Ae.jsxs)(A.default,{style:{flex:Ze?void 0:Math.max(.3,...e.map(e=>Cs(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ae.jsxs)(A.default,{style:{flex:1,gap:2},children:[Ze?(0,Ae.jsxs)(A.default,{style:{alignItems:'center',gap:4},children:[(0,Ae.jsxs)(G.T,{center:!0,size:18,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{center:!0,size:14,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.Muted,{center:!0,children:Is(e.id)})]}):(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$l.has(e.id)?(0,Ae.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Ae.jsx)(G.Muted,{children:Is(e.id)})]}),(0,Ae.jsx)(A.default,{style:Ze?{height:Math.max(280,Math.round((Je-40)*Cs(e.id)))}:{flex:1},children:vs(e.id)})]},e.id)),e.length{if(Nl)return void el(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rl[t]?Et(t):Dl(e)}},Al)}),zs='timeline'===Rt,Ms=Wt?(0,Ae.jsx)(H.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>zt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ae.jsxs)(A.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:Q.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ae.jsx)(E.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>zt(!1),style:{minHeight:64,minWidth:Je<600?120:180,paddingHorizontal:Je<600?14:22,borderRadius:16,borderWidth:2,borderColor:Q.colours.goldLight,backgroundColor:Q.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(G.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ae.jsx)(A.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ae.jsx)(G.T,{size:22,weight:"semibold",colour:Q.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${Nl?(0,Te.dayLong)(Al):'Today'}`})}),Je<600?null:(0,Ae.jsx)(A.default,{style:{minWidth:180}})]}),Xl?Zl:(0,Ae.jsx)(A.default,{style:{flex:1,minHeight:0},children:(0,Ae.jsx)(re.Timeline,{hideNow:!0,fit:!0,plan:Tt,bookings:Nl?Vl:vl,now:Nl?Kl:yt,privacy:St,turnBase:dt.settings.turnMins,t0:Nl?(0,q.addMins)(Kl,-Kl.getMinutes()):Ml,t1:Nl?(0,q.addMins)(ql,30):Hl,pauses:Nl?Ql:El,blockedTables:Nl?[]:Ol,onOpen:e=>{if(zt(!1),Nl)return void el(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rl[t]?Et(t):Dl(e)}},`full-${Al}`)})]})}):null,Hs=Nl?(0,Ae.jsxs)(A.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:Q.colours.gold,backgroundColor:Q.colours.goldTint},children:[(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:Gl?`Showing ${_l} \xb7 ${(0,q.niceDate)((0,q.parseYmd)(Al))}`:`Showing ${(0,Te.dayWord)(Al,kt)}`}),(0,Ae.jsx)(A.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${ds}. Showing ${(0,Te.dayLong)(Al)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ae.jsx)(G.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ll(null),nl(null)},style:{minHeight:44}})]}):null,Ps=(0,Ae.jsx)(A.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:Ze?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,l])=>{const i='timeline'===e===(zs||Wt);return(0,Ae.jsx)(E.default,{testID:l,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Lt('plan'),zt(!0)):(zt(!1),Lt('plan'))},style:{flex:Ze?1:void 0,minHeight:Ze?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?Q.colours.gold:'transparent',...We.look.web(i?{backgroundImage:s.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:s.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Ae.jsx)(G.T,{size:Ze?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Es='display'!==k.APP_VARIANT||e?Ps:(0,Ae.jsxs)(A.default,{testID:"display-view-row",style:{flexDirection:Ze?'column':'row',flexWrap:Ze?'nowrap':'wrap',gap:6,alignItems:Ze?'stretch':'center'},children:[Ps,(0,Ae.jsx)(w.DisplayRotaKitchenButtons,{phone:Ze,shifts:xt,staff:pt,today:kt})]}),Os=(0,h.useBookingWrite)(),As=e=>(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"Walk-in",onPress:Dt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint}),(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"New booking",onPress:Dt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint}),(0,Ae.jsx)(ze.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Ut(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Os.ok,accessibilityHint:Os.hint})]});(0,Oe.useDisplayNotices)(rt,!e);const Ns=Ze?180:168,[_s,Gs]=(0,T.useState)(Ns),Vs=$.default.useRef(Ns),Fs=$.default.useRef(null),Us=$.default.useRef(null),Ks=()=>{const e=Fs.current,t=Us.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,l,s,i)=>{t.measureInWindow((e,t)=>{const s=Xe<820?8:12,o=44+(Xe<820?4:8),n=i>Vs.current?Math.ceil(i-Vs.current):Se.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Ns,Math.floor(t-s-l)-n-o));Math.abs(Vs.current-a)>=2&&(Vs.current=a,Gs(a))})})};$.default.useEffect(()=>{const e=setTimeout(Ks,60);return()=>clearTimeout(e)},[Je,Xe]);const qs=(0,Ae.jsxs)(A.default,{ref:Us,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ks()},style:{flexDirection:'row',flexWrap:Je>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ze?12:6,justifyContent:Ze?'center':void 0,borderTopWidth:1,borderTopColor:Q.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ae.jsx)(Ee.DisplayClockButton,{}),(0,Ae.jsx)(ae.HoldToEdit,{quiet:!0,onUnlock:()=>{Il(null),jl({at:Date.now()})},onHint:()=>xl('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ae.jsx)(ve.BlockBookingsButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,display:!0,day:Al}),Tt.areas.some(e=>e.outdoor)?(0,Ae.jsx)(ve.CloseGardenButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,short:!0}):null,(0,Ae.jsx)(E.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>bl(!0),style:({pressed:e})=>({...We.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR?null:(0,Ae.jsx)(f.GiftQrButton,{rid:rt,venue:dt.name})]}),Ys=Cl.length?(0,Ae.jsxs)(A.default,{testID:"takeaway-panel",style:[We.look.panel,{overflow:'hidden'}],children:[(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ae.jsx)(G.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ae.jsxs)(G.T,{size:12,colour:Q.colours.muted,children:[Cl.length," live"]})]}),(0,Ae.jsx)(A.default,{style:{padding:10},children:(0,Ae.jsx)(Ye,{list:Cl,me:jt,compact:!0,bookings:ut})})]}):null,Qs=(Le.DueToday,Nl?Vl:vl.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Js=Nl?Gl?`${_l}\u2019s guests`:`Guests ${_l}`:'Today\u2019s guests',Xs=(0,Ae.jsxs)(Ae.Fragment,{children:[0===Qs.length?(0,Ae.jsx)(G.Muted,{children:Nl?Al{const t=(0,J.isSeatedHighlight)(e.status,{otherDay:Nl}),l=(0,he.guestRowText)(e,{name:e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)',''),seated:t}),s=Q.colours.text,i=t?Q.colours.goldLight:Q.colours.muted,o=Q.colours.gold,n=l.depositWarn?Q.colours.amber:Q.colours.goldLight;return(0,Ae.jsxs)(E.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:Nl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Xt(!1),el(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,J.seatedHighlightStyle)({backgroundColor:e?_e:Ne,borderColor:Q.colours.gold,borderLeftColor:Q.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:Q.colours.hairline,backgroundColor:e?Q.colours.tilePressed:'transparent'},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ae.jsx)(G.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Ae.jsx)(G.T,{size:18,weight:"semibold",colour:s,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Ae.jsx)(A.default,{style:{paddingTop:2},children:(0,Ae.jsx)(M.AllergyIcon,{text:l.allergy,size:22,colour:Q.colours.amber,ink:Q.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Ae.jsxs)(G.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ae.jsx)(G.T,{size:16,colour:s,children:l.people}),l.deposit?(0,Ae.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}):null,l.deposit?(0,Ae.jsx)(G.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Ae.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}),(0,Ae.jsx)(G.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===l.table?i:s,children:l.table}),l.dog?(0,Ae.jsx)(G.T,{size:16,children:" "}):null,l.dog?(0,Ae.jsx)(A.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ae.jsx)(ge.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,Ae.jsx)(Re.CancellationsSection,{items:rs,dayWord:Nl?Gl?_l.toLowerCase():`on ${_l}`:'today'})]}),Zs=(0,Ae.jsx)(O.default,{testID:"display-guest-list",accessibilityLabel:Js,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Xs}),ei=P.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Xt(!1)}}),ti=(0,Ae.jsxs)(E.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Js}, ${Qs.length}`,accessibilityState:{expanded:Jt},'aria-expanded':Jt,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Xt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:Jt?Q.colours.gold:Q.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?Q.colours.tilePressed:Jt?Q.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ae.jsx)(G.T,{size:16,weight:"bold",colour:Q.colours.gold,children:Qs.length}),(0,Ae.jsx)(A.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(A.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ae.jsxs)(G.T,{size:13,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,children:[Js," ",Jt?'\u2039':'\u203a']})})})]}),li=Jt?(0,Ae.jsxs)(A.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ae.jsxs)(A.default,{testID:"guests-drawer",...ei.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Je)),backgroundColor:Q.colours.surface,borderRightWidth:1,borderColor:Q.colours.gold,borderRadius:14,...We.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ae.jsxs)(A.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Ae.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[Js.toUpperCase()," (",Qs.length,")"]}),(0,Ae.jsx)(l.GoldClose,{testID:"guests-close",label:`Close ${Js}`,onPress:()=>Xt(!1),style:{marginRight:-6}})]}),as.count?(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,testID:"cancelled-day-tally-guests",children:ds}):null]}),Zs]}),(0,Ae.jsx)(E.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Js}`,accessibilityRole:"button",onPress:()=>Xt(!1),style:{flex:1}})]}):null,si=Xl?Zl:s.IS_KIRKTON&&!Object.values(dt.kitchenHours??{}).some(Boolean)?(0,Ae.jsxs)(A.default,{testID:"kirkton-hours-to-confirm",style:[We.look.panel,{padding:14,gap:8}],children:[(0,Ae.jsx)(G.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ae.jsx)(G.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ae.jsx)(Se.DayGraph,{busyThreshold:(0,t.venueBusy)(dt,ut,yt).busy,todays:Vl,open:Kl,close:ql,now:yt,turnBase:dt.settings.turnMins,blocks:cs,pauses:Ql,compact:Ze,dense:!Ze,fit:tt,tight:tt&&Xe<600,height:Ns,forecastNote:Nl?void 0:xs,emptyText:es,past:Al{Nl?Xt(!0):zt(!0)},ai=(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',padding:Xe<820?8:12,paddingTop:Xe<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[It?null:ti,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[It?null:Hs,It?(0,Ae.jsx)(O.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ae.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"})}):zs?Ws:Ls,Ms,li]}),(0,Ae.jsxs)(A.default,{testID:"display-side",style:{width:st,gap:Xe<820?4:8,minHeight:0},children:[(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:As(!1)}),(0,Ae.jsx)(A.default,{style:{flexShrink:0},children:Es}),It?null:(0,Ae.jsx)(A.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,compact:Xe<820,snug:Xe<820,tight:Xe<700,sound:(0,L.flapSoundOn)(),onPress:ni})}),It?null:(0,Ae.jsx)(A.default,{ref:Fs,testID:"day-graph-slot",onLayout:Ks,style:{flexGrow:0,flexShrink:1,flexBasis:Ns+52,minHeight:Xe<600?90:120,overflow:'visible'},children:ii}),(0,Ae.jsxs)(O.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Ae.jsx)(E.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>hl(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ae.jsx)(G.T,{center:!0,weight:"semibold",children:"Reviews"})}),Ys,(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt})]})]})]});return(0,Ae.jsxs)(_.SafeAreaView,{style:{flex:1,backgroundColor:Q.colours.bg},onTouchStart:()=>{ol.current=Date.now()},onMouseDown:()=>{ol.current=Date.now()},children:[Ze?(0,Ae.jsxs)(A.default,{style:{flex:1},children:[(0,Ae.jsxs)(O.default,{ref:it,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ae.jsxs)(A.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ae.jsx)(A.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ae.jsx)(j.ExitButton,{})}),(0,Ae.jsx)(U.RestaurantLogo,{rid:rt,size:64}),(0,Ae.jsx)(G.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:dt.name}),(0,Ae.jsx)(U.PoweredBy,{}),(0,Ae.jsx)(C.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ae.jsx)(A.default,{accessible:!0,accessibilityLabel:`Current time ${(0,q.hm)(yt)}`,children:(0,Ae.jsx)(G.T,{center:!0,size:30,weight:"semibold",colour:Q.colours.goldLight,children:(0,q.hm)(yt)})}),(0,Ae.jsx)(Me.ShellfishChip,{rid:rt,by:jt,app:"display",size:"m"}),(0,Ae.jsx)(Me.SundayRoastChip,{rid:rt,by:jt,app:"display",size:"m"}),K]}),He,oi,(0,Ae.jsx)(A.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ae.jsx)(Ke,{phone:!0,split:ns,items:[{label:`Tables \xb7 ${_l}`,value:is.length,testID:'badge-tables'},{label:`Covers \xb7 ${_l}`,value:os,testID:'badge-covers'},{label:'Takeaway',value:Cl.length,alert:Cl.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Vt(!0)}]})}),(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{gap:8},children:As(!0)}),(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),Es,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[zs?Ws:Ls,Ms]}),(0,Ae.jsxs)(A.default,{onLayout:e=>{ot.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[We.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ae.jsxs)(G.T,{center:!0,size:20,weight:"semibold",colour:Q.colours.goldLight,accessibilityRole:"header",children:[Js," (",Qs.length,")"]}),(0,Ae.jsx)(A.default,{testID:"display-guest-list",accessibilityLabel:Js,style:{gap:4},children:Xs})]}),Ys,ii,(0,Ae.jsx)(A.default,{testID:"covers-dock",children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,compact:!0,sound:(0,L.flapSoundOn)(),onPress:()=>it.current?.scrollTo({y:ot.current,animated:!0})})}),(0,Ae.jsxs)(A.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ae.jsx)(G.T,{center:!0,size:14,colour:St?Q.colours.muted:Q.colours.amber,children:St?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ae.jsx)(G.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cl(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Ae.jsx)(G.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>hl(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),qs]}),e?null:(0,Ae.jsx)(A.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:Q.colours.hairline},children:(0,Ae.jsx)(z.VoiceSlot,{size:56})})]}):(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Je>=1e3?18:14,paddingVertical:Xe<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),...We.look.web({backgroundImage:s.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Ae.jsx)(A.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ae.jsx)(U.RestaurantBrand,{rid:dt.id,size:Je<900?32:40,beside:!0})}),(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ae.jsx)(G.T,{size:Je<900?18:21,weight:"semibold",colour:Q.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,q.hm)(yt)}),Je>=900?(0,Ae.jsx)(G.T,{size:13,colour:Q.colours.muted,children:(0,q.niceDate)(yt)}):null]})]}),It?(0,Ae.jsx)(A.default,{style:{width:220}}):(0,Ae.jsx)(A.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:oi}),(0,Ae.jsxs)(A.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ae.jsx)(Me.ShellfishChip,{rid:rt,by:jt,app:"display",size:Je<1200?'xs':Je<1280||Xe<700?'s':'m'}),(0,Ae.jsx)(E.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cl(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Ae.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.muted,children:"?"})}),'simulated'===bt?(0,Ae.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>gt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ae.jsx)(G.T,{size:11,colour:Q.colours.muted,children:"+15"})}):null,e?null:(0,Ae.jsx)(j.ExitButton,{}),K,Pe?null:(0,Ae.jsx)(z.VoiceSlot,{size:44})]})]}),He,It?null:(0,Ae.jsxs)(A.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,Ae.jsx)(Ke,{splitOnly:!0,split:ns,items:[]}),(0,Ae.jsx)(A.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Je>=1e3?18:14)+(e?0:52)+('simulated'===bt?52:0),zIndex:4},children:(0,Ae.jsx)(Me.SundayRoastChip,{rid:rt,by:jt,app:"display",size:Je<1100||Xe<700?'s':'m'})})]}),tt?ai:(ri=(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ae.jsx)(A.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:As(!1)}),Es]}),(0,Ae.jsx)(ve.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),It?(0,Ae.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"}):(0,Ae.jsx)(Ae.Fragment,{children:(0,Ae.jsxs)(A.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[ti,(0,Ae.jsxs)(A.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Hs,zs?Ws:Ls,Ms,li]})]})}),Ys,It?null:(0,Ae.jsx)(A.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ae.jsx)(B.CoversToday,{rid:rt,day:Al,sound:(0,L.flapSoundOn)(),onPress:ni})}),It?null:(0,Ae.jsx)(A.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Ns+Se.DAY_GRAPH_CHROME},children:ii})]}),(0,Ae.jsx)(O.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:ri})),qs]}),(0,Ae.jsx)(I.SoldOutStrip,{rid:rt,by:wt,onOpen:()=>bl(!0)}),(0,Ae.jsx)(D.SoldOutSheet,{visible:gl,onClose:()=>bl(!1),rid:rt,by:wt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ae.jsx)(p.TableOrderCue,{rid:rt}),Dt.elements,Ft?(0,Ae.jsx)(y.EditBookingPicker,{rid:rt,today:kt,who:jt,hidePrivate:!0,onClose:()=>Ut(!1)}):null,Kt?(0,Ae.jsx)(y.EditBookingSheet,{rid:rt,id:Kt,who:jt,hidePrivate:!0,onClose:()=>qt(null)}):null,Pt?(0,Ae.jsx)(me.TableSheet,{rid:rt,name:Pt,view:Rl,plan:Tt,todays:vl,now:yt,privacy:St,turnBase:dt.settings.turnMins,onClose:()=>Et(null),onWalkIn:e=>Dt.openWalkInAt(e),onMove:e=>At(e),onDetails:Dl}):null,ls?(()=>{const e=ts[ls],t=e?.dayBookings??[];return(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>ss(null),title:`${(0,d.tableNumbers)(ls)} \xb7 ${Gl?_l:(0,Te.dayLong)(Al)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ae.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${Gl?_l.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${Gl?_l.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ue.privName)(e,St):Ve(e.name);return(0,Ae.jsx)(G.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,fe.tablesWords)((0,te.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ss(null),el(e.id)},style:{minHeight:56}},e.id)}),(0,Ae.jsx)(G.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ss(null),style:{minHeight:56}})]})})():null,Zt?(()=>{const e=ut.find(e=>e.id===Zt);return e?(0,Ae.jsx)(be.GuestActionsSheet,{rid:rt,b:e,name:e.walkIn?(0,ue.privName)(e,St):Ve(e.name),view:Rl,now:yt,otherDay:e.date!==kt,turnBase:dt.settings.turnMins,onClose:()=>el(null),onDetails:Dl,onDone:xl,onPickOnPlan:(e,t)=>{Xt(!1),Lt('plan'),Ht('all'),ll({id:e.id,tables:t})}}):null})():null,Nt?(0,Ae.jsx)(me.DetailsPanel,{title:Nt.title,onClose:()=>_t(null),children:Nt.body}):null,Yt?(0,Ae.jsx)(me.ServiceSummary,{r:dt,todays:vl,orders:ct,waitlistAll:al,walkInCount:rl,onClose:()=>Qt(!1)}):null,dl?(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>cl(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ae.jsx)(g.FloorLegend,{}),(0,Ae.jsx)(G.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>cl(!1)})]}):null,ul?(0,Ae.jsxs)(G.Sheet,{visible:!0,onClose:()=>hl(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ae.jsx)(V.ReviewsSection,{rid:rt,mode:"read",venueName:dt.name}),(0,Ae.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>hl(!1)})]}):null,Gt?(0,Ae.jsxs)(me.DetailsPanel,{title:"Takeaway",onClose:()=>Vt(!1),children:[(0,Ae.jsx)(G.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ae.jsx)(Ye,{list:Cl,me:jt,bookings:ut})]}):null,ml?(0,Ae.jsx)(A.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:Q.colours.bg},children:(0,Ae.jsx)(ne.PlanDesigner,{initial:Tt,venue:dt.name,mode:"display",startStep:"arrange",onActivity:()=>{wl.current=Date.now(),null!==kl&&Il(null)},notice:null!==kl?`Locking again in ${kl} s \xb7 touch to keep editing`:null,onSave:e=>{te.useFloor.getState().setPlan(rt,e),jl(null),xl('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{te.useFloor.getState().setPlan(rt,e),xl('Live seating plan updated on every screen.')},onCancel:()=>{jl(null),xl('No changes kept. Editing is locked again.')}},ml.at)}):null,e?null:(0,Ae.jsx)(de.Screensaver,{rid:rt,idleMins:vt.idleMins,pinOn:vt.pinOn,wake:vt,tonightCards:vt.tonightCards,cfg:Ct}),e?null:(0,Ae.jsx)(we.PrintHost,{rid:rt}),e?null:(0,Ae.jsx)(je.AlertHost,{variant:"display",rid:rt,skipTakeaway:!0}),e?null:(0,Ae.jsx)(W.SeatAllergenReminder,{rid:rt}),e?null:(0,Ae.jsx)(ke.TakeawayTakeover,{rid:rt,me:jt})]});var ri};var t=_r(_d[0]),l=_r(_d[1]),s=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=e(T),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),W=_r(_d[30]),z=_r(_d[31]),M=_r(_d[32]),H=e(_r(_d[33])),P=e(_r(_d[34])),E=e(_r(_d[35])),O=e(_r(_d[36])),A=e(_r(_d[37])),N=e(_r(_d[38])),_=_r(_d[39]),G=_r(_d[40]),V=_r(_d[41]),F=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),se=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),We=_r(_d[84]),ze=_r(_d[85]),Me=_r(_d[86]),He=_r(_d[87]),Pe=_r(_d[88]),Ee=_r(_d[89]),Oe=_r(_d[90]),Ae=_r(_d[91]);const Ne='#221C12',_e='#2E2618',Ge=12e4,Ve=e=>(e??'').replace(' (example)',''),Fe=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Ue=e=>e.slotTime?(0,q.hm)(new Date(e.slotTime)):'ASAP';function Ke({items:e,tight:t,phone:l,split:s,inline:i,splitOnly:o}){return(0,Ae.jsxs)(A.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Ae.jsx)(A.default,{style:{flexDirection:'row',flexWrap:l?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,s)=>{const i=(0,Ae.jsxs)(A.default,{testID:e.testID,style:{flex:l?1:void 0,minWidth:l?148:void 0,flexBasis:l?148:void 0,flexDirection:l?'column':'row',alignItems:l?'center':'baseline',justifyContent:l?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:s?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...l?{minHeight:76}:{}},children:[(0,Ae.jsx)(G.T,{size:l?24:19,weight:"semibold",colour:e.alert?Q.colours.amber:Q.colours.text,children:e.value}),(0,Ae.jsx)(G.T,{size:l?14:12,colour:Q.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ae.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:l?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ae.jsx)($.default.Fragment,{children:i},e.testID)})}),s?(0,Ae.jsx)(A.default,{testID:"covers-split",accessible:!0,accessibilityLabel:s.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:s.empty?(0,Ae.jsx)(G.T,{size:14,colour:Q.colours.muted,children:"No Covers yet"}):(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)(A.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ae.jsx)(G.T,{size:i?13:14,weight:"semibold",colour:Q.colours.gold,children:`Walk-ins ${s.walkIns} \xb7 ${s.walkInPct}%`}),(0,Ae.jsx)(G.T,{size:i?13:14,weight:"semibold",children:`Bookings ${s.bookings} \xb7 ${s.bookingPct}%`})]}),(0,Ae.jsxs)(A.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:Q.colours.gold},children:[(0,Ae.jsx)(A.default,{style:{width:`${s.walkInPct}%`,backgroundColor:Q.colours.gold}}),(0,Ae.jsx)(A.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function qe({chipId:e,label:t,sub:l,selected:s,onPress:i,colour:o,compact:n}){return(0,Ae.jsxs)(E.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${t}${l?`, ${l}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Ae.jsx)(A.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Ae.jsx)(G.T,{size:n?12:14,weight:s?'semibold':'medium',colour:s?Q.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),l?(0,Ae.jsx)(G.T,{size:12,colour:Q.colours.muted,children:l}):null]})}function Ye({list:e,me:t,compact:l,bookings:s}){const i=(e,t)=>(0,Pe.statusBlock)(e,t,(0,Pe.linkedBooking)(e,s));return e.length?(0,Ae.jsx)(A.default,{style:{gap:8},children:e.map(e=>(0,Ae.jsxs)(A.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:Q.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?Q.colours.ok:e.allergies.length?Q.colours.red:Q.colours.gold},children:[(0,Ae.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Ae.jsxs)(G.T,{size:l?16:18,weight:"bold",children:[Ue(e)," \xb7 ",Ve(e.customerName)]}),(0,Ae.jsx)(G.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,Ae.jsxs)(G.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,Ae.jsxs)(G.T,{size:14,weight:"semibold",colour:Q.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,K.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ae.jsx)(He.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ae.jsxs)(G.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ae.jsx)(G.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>Y.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Ae.jsx)(G.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Ae.jsx)(G.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Ae.jsx)(we.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ae.jsx)(G.Muted,{children:"No takeaway orders right now."})}function Qe({rid:e,id:t,turnBase:l}){const s=(0,Y.useBookings)(e).find(e=>e.id===t);return s?(0,Ae.jsx)(b.BookingTableButton,{rid:e,booking:s,turnBase:l}):null}},1309,[1141,796,5,6,1310,828,853,1117,860,1140,1311,1312,1313,1114,1135,1314,1315,1320,1321,1322,872,1323,1153,980,1122,1324,34,1094,1172,1044,1110,1136,1325,395,380,402,295,102,426,36,794,1210,1214,873,861,858,874,821,1113,892,1119,1084,1025,1100,1127,1326,1126,1327,1334,1336,1339,1342,1338,1343,1345,1346,1132,1116,1118,878,1350,1199,1351,1209,1201,1022,1356,1364,1365,1097,1134,1367,1368,1369,1166,1370,1165,1159,869,1371,1372,25]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ge}}),_e2.DisplayBoard=function({embedded:e=!1,boardW:b,headerExtra:K,subHeader:Me,noVoice:Pe=!1}={}){const Ue=(0,N.default)(),Je=b??Ue.width,Xe=Ue.height,Ze=Je<700,et=Je>=Xe,tt=!Ze&&et&&Je>=600,st=tt,lt=Math.round(Math.min(520,Math.max(Je>=1e3?448:280,.3*Je))),it=$.default.useRef(null),ot=$.default.useRef(0),[nt,at]=(0,T.useState)({w:0,h:0}),rt=(0,X.useOwner)(e=>e.site),dt=(0,Y.useRestaurant)(rt);(0,Ie.useAlertWatcher)(rt,{enabled:!e});const ct=(0,Y.useOrders)(rt),ut=(0,Y.useBookings)(rt),ht=(0,Y.useEvents)(rt),gt=(0,Y.useStore)(e=>e.skipMinutes),bt=(0,Y.useStore)(e=>e.clock.mode),yt=(0,Y.useNow)(5e3),pt=(0,X.useOwner)(e=>e.staff),ft=(0,X.useOwner)(e=>e.attendance),mt=(0,X.useOwner)(e=>e.shifts);$.default.useEffect(()=>{(0,ee.ensureAttendance)((0,q.ymd)(yt),yt)},[(0,q.ymd)(yt)]);const xt=ft.filter(e=>e.in&&!e.out&&yt.getTime()-new Date(e.in).getTime()<72e6&&yt.getTime()>=new Date(e.in).getTime()),jt=Fe(pt.find(e=>e.id===xt[0]?.staffId)?.name)||'Duty Manager',wt=k.IS_CAR?'Car':'Display';(0,D.useSoldOutLink)(!1,e?void 0:wt,!0);const kt=(0,q.ymd)(yt),It=(0,R.useTravelDay)('display',kt),vt=(0,Z.useFrontDoor)(kt,et),Dt=(0,te.useDisplaySettings)(rt),St=Dt.privacy,Ct=(0,ce.useSaverSync)(),Tt=(0,te.usePlan)(rt),$t=(0,te.useFloor)(e=>e.live[rt]),Bt=(0,ve.useBlocks)(e=>e.blocks),[Rt,Lt]=(0,T.useState)('plan'),[zt,Wt]=(0,T.useState)(!1),[Ht,Mt]=(0,T.useState)('all'),[Pt,Et]=(0,T.useState)(null),[At,Ot]=(0,T.useState)(null),[Nt,_t]=(0,T.useState)(null),[Gt,Ft]=(0,T.useState)(!1),[Vt,Ut]=(0,T.useState)(!1),[Kt,qt]=(0,T.useState)(null),[Yt,Qt]=(0,T.useState)(!1),[Jt,Xt]=(0,T.useState)(!1),[Zt,es]=(0,T.useState)(null),[ts,ss]=(0,T.useState)(null),[ls,is]=(0,T.useState)(null),os=$.default.useRef(0),ns=e=>{os.current=Date.now(),is(e)};$.default.useEffect(()=>{if(!ls)return;const e=setInterval(()=>{Date.now()-os.current>=Te.DAY_IDLE_MS&&is(null)},5e3);return()=>clearInterval(e)},[ls]);const as=(0,Y.useWaitlist)(rt),rs=(0,Y.useStore)(e=>e.walkIns[rt]??0),[ds,cs]=(0,T.useState)(!1),[us,hs]=(0,T.useState)(!1),[gs,bs]=(0,T.useState)(!1);(0,V.useReviewAlerts)(rt);const[ys,ps]=(0,T.useState)({view:0,content:0}),[fs,ms]=(0,T.useState)(null);$.default.useEffect(()=>{fs&&((0,S.notify)({id:`floor-note:${Date.now()}`,title:fs,timeoutMs:4500,big:!0,testID:'floor-toast'}),ms(null))},[fs]),$.default.useEffect(()=>{if(!e)return(0,L.setDisplaySilent)(!0),()=>(0,L.setDisplaySilent)(!1)},[e]);const[xs,js]=(0,T.useState)(null),ws=$.default.useRef(0),[ks,Is]=(0,T.useState)(null);$.default.useEffect(()=>{if(!xs)return;ws.current=Date.now();const e=setInterval(()=>{const e=Date.now()-ws.current;if(e>=Ge)return js(null),void ms('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Is(e>=105e3?Math.ceil((Ge-e)/1e3):null)},1e3);return()=>clearInterval(e)},[xs]);const vs=e=>e.date!==kt?_t({title:`Guest details \xb7 ${(0,Te.dayWord)(e.date,kt)} ${e.time}`,body:(0,Oe.jsxs)(Oe.Fragment,{children:[!e.walkIn&&e.date>kt?(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Te.dayWord)(e.date,kt)}, ${e.time}`,disabled:!Fl.ok,accessibilityHint:Fl.hint,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}):null,(0,xe.bookingDetails)(e)]})}):_t({title:`Guest details \xb7 ${e.time}`,body:(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsx)(Qe,{rid:rt,id:e.id,turnBase:dt.settings.turnMins}),e.walkIn?null:(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{_t(null),qt(e.id)},style:{minHeight:56}}),e.walkIn?(0,Oe.jsx)(ye.CancelWalkInButton,{rid:rt,b:e,big:!0,onDone:e=>{_t(null),ms(e)}}):null,e.walkIn?(0,Oe.jsx)(ye.ReinstateWalkInButton,{rid:rt,b:e,today:kt,onDone:e=>{_t(null),ms(e)}}):null,(0,xe.bookingDetails)(e)]})}),Ds=ut.filter(e=>e.date===kt).sort((e,t)=>e.time.localeCompare(t.time)),Ss=Ds.filter(e=>!['cancelled','noshow'].includes(e.status)),Cs=ct.filter(Ve).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Ts=(0,T.useMemo)(()=>(0,c.forecastToday)(dt,ut,ct,ht,yt),[dt,ut,ct,ht,yt.getTime()/6e4|0]),$s=(0,ve.closedAreasAt)(Bt,rt,kt,(0,q.hm)(yt)),Bs=[...$s].join(','),Rs=(0,T.useMemo)(()=>(0,se.floorView)(Tt,ut,ct,$t??{},yt,dt.settings.turnMins,$s),[Tt,ut,ct,$t,yt.getTime(),Bs]),Ls=(0,me.hoursFor)(dt,yt),zs=Ls?.open??new Date(`${kt}T12:00:00`),Ws=Ls?.close??new Date(`${kt}T21:00:00`),Hs=(0,q.addMins)(zs,-zs.getMinutes()),Ms=(0,q.addMins)(Ws,30),Ps=e=>new Date(`${kt}T${e}:00`),Es=(0,ve.blocksOn)(Bt,rt,kt).map(e=>({from:Ps(e.from),to:Ps(e.to),label:e.reason??'Paused'})).concat((0,o.queuedServicePauses)(dt,yt,kt)),As=Object.keys(Rs).filter(e=>'blocked'===Rs[e]?.status),Os=ls&&ls!==kt?ls:kt,Ns=Os!==kt,_s=(0,Te.dayWord)(Os,kt),Gs=/^(Today|Yesterday|Tomorrow)$/.test(_s),Fs=Ns?(0,Te.bookingsForDay)(ut,Os,kt).sort((e,t)=>e.time.localeCompare(t.time)):Ds,Vs=(0,q.parseYmd)(Os);Vs.setHours(12);const Us=Ns?(0,me.hoursFor)(dt,Vs):Ls,Ks=Us?.open??new Date(`${Os}T12:00:00`),qs=Us?.close??new Date(`${Os}T21:00:00`),Ys=e=>new Date(`${Os}T${e}:00`),Qs=[...Ns?(0,ve.blocksOn)(Bt,rt,Os).map(e=>({from:Ys(e.from),to:Ys(e.to),label:e.reason??'Paused'})):Es,...Ns?(0,o.queuedServicePauses)(dt,Vs,Os):[]],Js=(0,o.queuedServiceSessions)(dt,Vs),Xs=l.IS_QUEUED_VENUE&&(void 0===Js||!Js.length),Zs=(0,Oe.jsxs)(O.default,{testID:"queued-hours-gate",style:[ze.look.panel,{padding:14,gap:8}],children:[(0,Oe.jsx)(G.T,{weight:"semibold",children:void 0===Js?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Oe.jsx)(G.Muted,{children:i.queuedVenues[rt]?.hours.note})]}),el=Ns?Us||Fs.length?OsNs?(0,se.dayFloorView)(Tt,Fs,Os):Rs,[Ns,Tt,Fs,Os,Rs]),[sl,ll]=(0,T.useState)(null),[il,ol]=(0,T.useState)(null),[nl,al]=(0,T.useState)(null),rl=Ns?Fs.filter(e=>!['cancelled','noshow'].includes(e.status)):Ss,dl=rl.reduce((e,t)=>e+t.partySize,0),cl=(0,u.coversSplit)(rl,Os),ul=(0,$e.cancelledDayTally)(ut,Os),hl=(0,Be.cancellationsFor)(ut,Os,e=>e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)','')),gl=(0,$e.cancelledTallyWords)(ul,Gs?_s.toLowerCase():Ns?`on ${_s}`:'today'),bl=Bt.filter(e=>e.rid===rt&&e.date===Os&&!e.removedAt),yl=(0,Ce.chartBands)(bl,60*Ks.getHours()+Ks.getMinutes(),60*qs.getHours()+qs.getMinutes()),pl=new Set((0,Ce.blockedHours)(yl)),fl=yt.getHours()+(yt.getMinutes()>=30?1:0),ml=Ts.hours.filter(e=>e.hour>=fl&&!pl.has(e.hour)),xl=ml.reduce((e,t)=>e+t.coversHigh,0),jl=ml.reduce((e,t)=>e+t.coversLow,0),wl=Math.round((jl+xl)/2),kl=!Ts.example&&Ts.open&&Ts.enough&&xl>0?`Usually ${(0,c.coversRange)(wl,wl)} more`:void 0,Il=async(e,t)=>{const s=Rs[e]?.booking;if(!s||e===t)return;const l=Rs[t]?.status;if(l&&!['free','soon'].includes(l))return void ms('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${se.STATUS[l].label.toLowerCase()}. Pick a free table.`);await Y.repo.bookings.update(s.id,{table:t});const i=$t?.[e]?.stage;te.useFloor.getState().setLive(rt,t,{stage:i??'seated',dirty:!1}),te.useFloor.getState().setLive(rt,e,{stage:void 0,dirty:!0}),ms(`${(0,ue.privName)(s,St)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`)},vl=e=>{if(ts)return ol(null),void ss(t=>t?{...t,tables:(0,fe.toggleTable)(t.tables,e)}:t);Ns?ll(e):At?(e!==At&&Il(At,e),Ot(null)):Et(e)},Dl=ts?ut.find(e=>e.id===ts.id):void 0,Sl=ts&&Dl?(()=>{const e=Dl.walkIn?(0,ue.privName)(Dl,St):Fe(Dl.name),t=(0,fe.seatsOf)(Tt,ts.tables).total,s=(0,fe.seatLine)(t,Dl.partySize),l=(0,fe.pickClashes)(Dl,ts.tables,ut.filter(e=>e.date===Dl.date),dt.settings.turnMins),i=(0,fe.tableKey)(ts.tables)!==(0,fe.tableKey)((0,te.tablesOf)(Dl.table));return(0,Oe.jsxs)(O.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:Q.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:Q.colours.gold,padding:10},children:[(0,Oe.jsxs)(O.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Te.dayWord)(Dl.date,kt)} ${Dl.time}. Tap tables on the plan to add or take them off. ${(0,fe.tablesWords)(ts.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Te.dayWord)(Dl.date,kt)," ",Dl.time]}),(0,Oe.jsxs)(G.T,{size:16,colour:Q.colours.text,children:[(0,fe.tablesWords)(ts.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),il?(0,Oe.jsx)(O.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:il,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:Q.colours.amber,backgroundColor:Q.colours.amberBg},children:(0,Oe.jsx)(G.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:il})}):null,(0,Oe.jsxs)(G.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Oe.jsx)(G.Button,{testID:il?'plan-pick-overcap-yes':'plan-pick-save',label:il?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${il?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,fe.tablesWords)(ts.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!Dl)return void ss(null);const s=(0,fe.overCapacityAsk)(ts.tables,t,Dl.partySize);if(!s||il){ol(null);try{await(0,pe.saveBookingTables)(rt,Dl,ts.tables),ms((0,fe.savedWords)(e,Dl.partySize,ts.tables,t))}catch(t){ms(`Couldn\u2019t save tables for ${e}: ${String(t?.message??t).slice(0,120)}`)}ss(null)}else ol(s)}}),(0,Oe.jsx)(G.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{ol(null),ss(null)}})]})]})})():null,Cl=Tt.areas.filter(e=>Tt.tables.some(t=>t.areaId===e.id)),Tl=e=>{const t=Tt.tables.filter(t=>t.areaId===e);return Ns?`${t.filter(e=>!tl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Rs[e.name]?.status??'free')).length}/${t.length} free`},$l='all'===Ht||Cl.some(e=>e.id===Ht)?Ht:'all',Bl=e=>(0,Oe.jsx)(le.FloorCanvas,{plan:Tt,areaId:e,mode:"live",fit:"contain",crop:!0,fill:tt,big:!0,view:tl,privacy:St,turnBase:dt.settings.turnMins,highlight:ts?ts.tables:At?[At]:void 0,onTap:e=>vl(e.name),onDrop:(e,t)=>ts||Ns?void 0:Il(e.name,t.name)}),Rl=Ze?1:et||Cl.length>2?2:1,Ll=e=>{const t=Tt.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},zl=[];for(let e=0;e{const t=(0,le.areaBounds)(Tt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,le.minReadableScale)(Tt,e.id)}}),nt.w,nt.h):null,Hl=e=>(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between',height:ie.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,children:Tl(e.id)})]}),Ml=(0,Oe.jsx)(O.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-nt.w)>1||Math.abs(s-nt.h)>1)&&at({w:t,h:s})},children:Wl?(0,Oe.jsx)(A.default,{style:{flex:1},scrollEnabled:Wl.scroll,showsVerticalScrollIndicator:Wl.scroll,contentContainerStyle:{gap:ie.GRID_GAP},children:Wl.rows.map((e,t)=>(0,Oe.jsx)(O.default,{style:{height:Wl.rowHeights[t],flexDirection:'row',gap:ie.GRID_GAP},children:e.map(e=>{const t=Cl.find(t=>t.id===e);return(0,Oe.jsxs)(O.default,{testID:`area-cell-${e}`,style:{width:Wl.cellW,gap:2},children:[Hl(t),(0,Oe.jsx)(O.default,{style:{flex:1},children:Bl(e)})]},e)})},t))}):null}),Pl=(0,Oe.jsxs)(O.default,{testID:"venue-plan",style:{flex:Ze?void 0:1,gap:10,minWidth:0},children:[(0,Oe.jsx)(r.TableNumberWarning,{plan:Tt}),Tt.tables.length?null:(0,Oe.jsxs)(O.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Oe.jsx)(G.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Oe.jsx)(G.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,Oe.jsx)(G.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,Oe.jsx)(qe,{chipId:"all",compact:!Ze,label:"Whole venue",selected:'all'===$l,onPress:()=>Mt('all')},"__all"),...Cl.map(e=>(0,Oe.jsx)(qe,{chipId:e.id,compact:!Ze,label:`${e.name}${(0,oe.areaMarks)(e)}`,colour:(0,Q.brandColour)(e.colour),sub:Ze?$s.has(e.id)?'closed':$l===e.id?Tl(e.id):void 0:void 0,selected:$l===e.id,onPress:()=>Mt(e.id)},e.id))];return Ze?(0,Oe.jsx)(O.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Oe.jsx)(A.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;ps(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>ps(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:ys.view>0&&ys.content>0&&ys.content<=ys.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:ys.view>0&&ys.content<=ys.view+1?'100%':void 0},children:e})})(),(0,Oe.jsx)(g.FloorLegend,{}),Sl,At?(0,Oe.jsxs)(G.Row,{gap:8,style:{backgroundColor:Q.colours.goldTint,borderRadius:10,padding:8},children:[(0,Oe.jsxs)(G.T,{weight:"semibold",colour:Q.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(At),": tap the new table."]}),(0,Oe.jsx)(G.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ot(null)})]}):null,'all'===$l&&tt?Ml:'all'===$l?(0,Oe.jsx)(O.default,{style:{flex:Ze?void 0:1,gap:12,minHeight:st?void 0:360},children:zl.map((e,t)=>(0,Oe.jsxs)(O.default,{style:{flex:Ze?void 0:Math.max(.3,...e.map(e=>Ll(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Oe.jsxs)(O.default,{style:{flex:1,gap:2},children:[Ze?(0,Oe.jsxs)(O.default,{style:{alignItems:'center',gap:4},children:[(0,Oe.jsxs)(G.T,{center:!0,size:18,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{center:!0,size:14,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.Muted,{center:!0,children:Tl(e.id)})]}):(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:(0,Q.brandColour)(e.colour),children:[e.name,(0,oe.areaMarks)(e)]}),$s.has(e.id)?(0,Oe.jsx)(G.T,{size:13,weight:"semibold",colour:Q.colours.blue,children:"Closed for weather"}):(0,Oe.jsx)(G.Muted,{children:Tl(e.id)})]}),(0,Oe.jsx)(O.default,{style:Ze?{height:Math.max(280,Math.round((Je-40)*Ll(e.id)))}:{flex:1},children:Bl(e.id)})]},e.id)),e.length{if(Ns)return void es(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rs[t]?Et(t):vs(e)}},Os)}),Al='timeline'===Rt,Ol=zt?(0,Oe.jsx)(M.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Wt(!1),supportedOrientations:['landscape','portrait'],children:(0,Oe.jsxs)(O.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:Q.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Oe.jsx)(E.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Wt(!1),style:{minHeight:64,minWidth:Je<600?120:180,paddingHorizontal:Je<600?14:22,borderRadius:16,borderWidth:2,borderColor:Q.colours.goldLight,backgroundColor:Q.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(G.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Oe.jsx)(O.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Oe.jsx)(G.T,{size:22,weight:"semibold",colour:Q.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${Ns?(0,Te.dayLong)(Os):'Today'}`})}),Je<600?null:(0,Oe.jsx)(O.default,{style:{minWidth:180}})]}),Xs?Zs:(0,Oe.jsx)(O.default,{style:{flex:1,minHeight:0},children:(0,Oe.jsx)(re.Timeline,{hideNow:!0,fit:!0,plan:Tt,bookings:Ns?Fs:Ds,now:Ns?Ks:yt,privacy:St,turnBase:dt.settings.turnMins,t0:Ns?(0,q.addMins)(Ks,-Ks.getMinutes()):Hs,t1:Ns?(0,q.addMins)(qs,30):Ms,pauses:Ns?Qs:Es,blockedTables:Ns?[]:As,onOpen:e=>{if(Wt(!1),Ns)return void es(e.id);const t=(0,te.tablesOf)(e.table)[0];t&&Rs[t]?Et(t):vs(e)}},`full-${Os}`)})]})}):null,Nl=Ns?(0,Oe.jsxs)(O.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:Q.colours.gold,backgroundColor:Q.colours.goldTint},children:[(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:Gs?`Showing ${_s} \xb7 ${(0,q.niceDate)((0,q.parseYmd)(Os))}`:`Showing ${(0,Te.dayWord)(Os,kt)}`}),(0,Oe.jsx)(O.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${gl}. Showing ${(0,Te.dayLong)(Os)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Oe.jsx)(G.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ss(null),ns(null)},style:{minHeight:44}})]}):null,_l=(0,Oe.jsx)(O.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:Ze?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(Al||zt);return(0,Oe.jsx)(E.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?(Lt('plan'),Wt(!0)):(Wt(!1),Lt('plan'))},style:{flex:Ze?1:void 0,minHeight:Ze?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?Q.colours.gold:'transparent',...ze.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,Oe.jsx)(G.T,{size:Ze?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),Gl='display'!==k.APP_VARIANT||e?_l:(0,Oe.jsxs)(O.default,{testID:"display-view-row",style:{flexDirection:Ze?'column':'row',flexWrap:Ze?'nowrap':'wrap',gap:6,alignItems:Ze?'stretch':'center'},children:[_l,(0,Oe.jsx)(w.DisplayRotaKitchenButtons,{phone:Ze,shifts:mt,staff:pt,today:kt})]}),Fl=(0,h.useBookingWrite)(),Vl=e=>(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsx)(We.BigAction,{premium:!0,label:"Walk-in",onPress:vt.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint}),(0,Oe.jsx)(We.BigAction,{premium:!0,label:"New booking",onPress:vt.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint}),(0,Oe.jsx)(We.BigAction,{premium:!0,label:"Edit booking",onPress:()=>Ut(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Fl.ok,accessibilityHint:Fl.hint})]});(0,Ae.useDisplayNotices)(rt,!e);const Ul=Ze?180:168,[Kl,ql]=(0,T.useState)(Ul),Yl=$.default.useRef(Ul),Ql=$.default.useRef(null),Jl=$.default.useRef(null),Xl=()=>{const e=Ql.current,t=Jl.current;e?.measureInWindow&&t?.measureInWindow&&e.measureInWindow((e,s,l,i)=>{t.measureInWindow((e,t)=>{const l=Xe<820?8:12,o=44+(Xe<820?4:8),n=i>Yl.current?Math.ceil(i-Yl.current):Se.DAY_GRAPH_CHROME,a=Math.max(70,Math.min(Ul,Math.floor(t-l-s)-n-o));Math.abs(Yl.current-a)>=2&&(Yl.current=a,ql(a))})})};$.default.useEffect(()=>{const e=setTimeout(Xl,60);return()=>clearTimeout(e)},[Je,Xe]);const Zl=(0,Oe.jsxs)(O.default,{ref:Jl,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xl()},style:{flexDirection:'row',flexWrap:Je>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:Ze?12:6,justifyContent:Ze?'center':void 0,borderTopWidth:1,borderTopColor:Q.colours.hairline,backgroundColor:(0,n.soutersSurface)('#0D0D0C')},children:[e?null:(0,Oe.jsx)(Ee.DisplayClockButton,{}),(0,Oe.jsx)(ae.HoldToEdit,{quiet:!0,onUnlock:()=>{Is(null),js({at:Date.now()})},onHint:()=>ms('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Oe.jsx)(De.BlockBookingsButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,display:!0,day:Os}),Tt.areas.some(e=>e.outdoor)?(0,Oe.jsx)(De.CloseGardenButton,{rid:rt,r:dt,now:yt,by:jt,quiet:!0,short:!0}):null,(0,Oe.jsx)(E.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>bs(!0),style:({pressed:e})=>({...ze.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR?null:(0,Oe.jsx)(f.GiftQrButton,{rid:rt,venue:dt.name})]}),ei=Cs.length?(0,Oe.jsxs)(O.default,{testID:"takeaway-panel",style:[ze.look.panel,{overflow:'hidden'}],children:[(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Oe.jsx)(G.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Oe.jsxs)(G.T,{size:12,colour:Q.colours.muted,children:[Cs.length," live"]})]}),(0,Oe.jsx)(O.default,{style:{padding:10},children:(0,Oe.jsx)(Ye,{list:Cs,me:jt,compact:!0,bookings:ut})})]}):null,ti=(Le.DueToday,Ns?Fs:Ds.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),si=Ns?Gs?`${_s}\u2019s guests`:`Guests ${_s}`:'Today\u2019s guests',li=(0,Oe.jsxs)(Oe.Fragment,{children:[0===ti.length?(0,Oe.jsx)(G.Muted,{children:Ns?Os{const t=(0,J.isSeatedHighlight)(e.status,{otherDay:Ns}),s=(0,he.guestRowText)(e,{name:e.walkIn?(0,ue.privName)(e,St):(e.name??'').replace(' (example)',''),seated:t}),l=Q.colours.text,i=t?Q.colours.goldLight:Q.colours.muted,o=Q.colours.gold,n=s.depositWarn?Q.colours.amber:Q.colours.goldLight;return(0,Oe.jsxs)(E.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:s.a11y,accessibilityHint:Ns?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{Xt(!1),es(e.id)},style:({pressed:e})=>t?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,J.seatedHighlightStyle)({backgroundColor:e?_e:Ne,borderColor:Q.colours.gold,borderLeftColor:Q.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:Q.colours.hairline,backgroundColor:e?Q.colours.tilePressed:'transparent'},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Oe.jsx)(G.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:s.time}),(0,Oe.jsx)(G.T,{size:18,weight:"semibold",colour:l,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:s.name}),s.allergy?(0,Oe.jsx)(O.default,{style:{paddingTop:2},children:(0,Oe.jsx)(H.AllergyIcon,{text:s.allergy,size:22,colour:Q.colours.amber,ink:Q.colours.bg,testID:`display-allergy-${e.id}`})}):null]}),(0,Oe.jsxs)(G.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Oe.jsx)(G.T,{size:16,colour:l,children:s.people}),s.deposit?(0,Oe.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}):null,s.deposit?(0,Oe.jsx)(G.T,{size:16,weight:"semibold",colour:n,testID:`display-deposit-${e.id}`,children:s.deposit}):null,(0,Oe.jsx)(G.T,{size:16,colour:i,children:" \xb7 "}),(0,Oe.jsx)(G.T,{size:16,weight:t?'semibold':'regular',colour:'No table yet'===s.table?i:l,children:s.table}),s.dog?(0,Oe.jsx)(G.T,{size:16,children:" "}):null,s.dog?(0,Oe.jsx)(O.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Oe.jsx)(ge.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)}),(0,Oe.jsx)(Re.CancellationsSection,{items:hl,dayWord:Ns?Gs?_s.toLowerCase():`on ${_s}`:'today'})]}),ii=(0,Oe.jsx)(A.default,{testID:"display-guest-list",accessibilityLabel:si,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:li}),oi=P.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&Xt(!1)}}),ni=(0,Oe.jsxs)(E.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${si}, ${ti.length}`,accessibilityState:{expanded:Jt},'aria-expanded':Jt,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>Xt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:Jt?Q.colours.gold:Q.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?Q.colours.tilePressed:Jt?Q.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Oe.jsx)(G.T,{size:16,weight:"bold",colour:Q.colours.gold,children:ti.length}),(0,Oe.jsx)(O.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(O.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Oe.jsxs)(G.T,{size:13,weight:"semibold",colour:Q.colours.goldLight,numberOfLines:1,children:[si," ",Jt?'\u2039':'\u203a']})})})]}),ai=Jt?(0,Oe.jsxs)(O.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Oe.jsxs)(O.default,{testID:"guests-drawer",...oi.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*Je)),backgroundColor:Q.colours.surface,borderRightWidth:1,borderColor:Q.colours.gold,borderRadius:14,...ze.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Oe.jsxs)(O.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",colour:Q.colours.gold,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:[si.toUpperCase()," (",ti.length,")"]}),(0,Oe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${si}`,onPress:()=>Xt(!1),style:{marginRight:-6}})]}),ul.count?(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,testID:"cancelled-day-tally-guests",children:gl}):null]}),ii]}),(0,Oe.jsx)(E.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${si}`,accessibilityRole:"button",onPress:()=>Xt(!1),style:{flex:1}})]}):null,ri=Xs?Zs:l.IS_KIRKTON&&!Object.values(dt.kitchenHours??{}).some(Boolean)?(0,Oe.jsxs)(O.default,{testID:"kirkton-hours-to-confirm",style:[ze.look.panel,{padding:14,gap:8}],children:[(0,Oe.jsx)(G.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Oe.jsx)(G.Muted,{children:"No service hours have been set for this venue."})]}):(0,Oe.jsx)(Se.DayGraph,{busyThreshold:(0,t.venueBusy)(dt,ut,yt).busy,todays:Fs,open:Ks,close:qs,now:yt,turnBase:dt.settings.turnMins,blocks:bl,pauses:Qs,compact:Ze,dense:!Ze,fit:tt,tight:tt&&Xe<600,height:Ul,forecastNote:Ns?void 0:kl,emptyText:el,past:Os{Ns?Xt(!0):Wt(!0)},hi=(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',padding:Xe<820?8:12,paddingTop:Xe<820?6:10,gap:12,minHeight:0,overflow:'hidden'},children:[It?null:ni,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[It?null:Nl,It?(0,Oe.jsx)(A.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Oe.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"})}):Al?El:Pl,Ol,ai]}),(0,Oe.jsxs)(O.default,{testID:"display-side",style:{width:lt,gap:Xe<820?4:8,minHeight:0},children:[(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Vl(!1)}),(0,Oe.jsx)(O.default,{style:{flexShrink:0},children:Gl}),It?null:(0,Oe.jsx)(O.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,compact:Xe<820,snug:Xe<820,tight:Xe<700,sound:(0,L.flapSoundOn)(),onPress:ui})}),It?null:(0,Oe.jsx)(O.default,{ref:Ql,testID:"day-graph-slot",onLayout:Xl,style:{flexGrow:0,flexShrink:1,flexBasis:Ul+52,minHeight:Xe<600?90:120,overflow:'visible'},children:di}),(0,Oe.jsxs)(A.default,{testID:"display-side-scroll",style:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},children:[(0,Oe.jsx)(E.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>hs(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Oe.jsx)(G.T,{center:!0,weight:"semibold",children:"Reviews"})}),ei,(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt})]})]})]});return(0,Oe.jsxs)(_.SafeAreaView,{style:{flex:1,backgroundColor:Q.colours.bg},onTouchStart:()=>{os.current=Date.now()},onMouseDown:()=>{os.current=Date.now()},children:[Ze?(0,Oe.jsxs)(O.default,{style:{flex:1},children:[(0,Oe.jsxs)(A.default,{ref:it,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Oe.jsxs)(O.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Oe.jsx)(O.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Oe.jsx)(j.ExitButton,{})}),(0,Oe.jsx)(U.RestaurantLogo,{rid:rt,size:64}),(0,Oe.jsx)(G.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:dt.name}),(0,Oe.jsx)(U.PoweredBy,{}),(0,Oe.jsx)(C.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Oe.jsx)(O.default,{accessible:!0,accessibilityLabel:`Current time ${(0,q.hm)(yt)}`,children:(0,Oe.jsx)(G.T,{center:!0,size:30,weight:"semibold",colour:Q.colours.goldLight,children:(0,q.hm)(yt)})}),(0,Oe.jsx)(He.ShellfishChip,{rid:rt,by:jt,app:"display",size:"m"}),(0,Oe.jsx)(He.SundayRoastChip,{rid:rt,by:jt,app:"display",size:"m"}),K]}),Me,ci,(0,Oe.jsx)(O.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Oe.jsx)(Ke,{phone:!0,split:cl,items:[{label:`Tables \xb7 ${_s}`,value:rl.length,testID:'badge-tables'},{label:`Covers \xb7 ${_s}`,value:dl,testID:'badge-covers'},{label:'Takeaway',value:Cs.length,alert:Cs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>Ft(!0)}]})}),(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{gap:8},children:Vl(!0)}),(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),Gl,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[Al?El:Pl,Ol]}),(0,Oe.jsxs)(O.default,{onLayout:e=>{ot.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[ze.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Oe.jsxs)(G.T,{center:!0,size:20,weight:"semibold",colour:Q.colours.goldLight,accessibilityRole:"header",children:[si," (",ti.length,")"]}),(0,Oe.jsx)(O.default,{testID:"display-guest-list",accessibilityLabel:si,style:{gap:4},children:li})]}),ei,di,(0,Oe.jsx)(O.default,{testID:"covers-dock",children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,compact:!0,sound:(0,L.flapSoundOn)(),onPress:()=>it.current?.scrollTo({y:ot.current,animated:!0})})}),(0,Oe.jsxs)(O.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Oe.jsx)(G.T,{center:!0,size:14,colour:St?Q.colours.muted:Q.colours.amber,children:St?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Oe.jsx)(G.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cs(!0),style:{minHeight:48,alignSelf:'stretch'}}),(0,Oe.jsx)(G.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>hs(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zl]}),e?null:(0,Oe.jsx)(O.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:Q.colours.hairline},children:(0,Oe.jsx)(W.VoiceSlot,{size:56})})]}):(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:Je>=1e3?18:14,paddingVertical:Xe<820?4:8,gap:8,minHeight:52,backgroundColor:(0,n.soutersSurface)('#0D0D0C'),...ze.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',alignItems:'center',gap:8,minWidth:0,overflow:'hidden'},children:[(0,Oe.jsx)(O.default,{style:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Oe.jsx)(U.RestaurantBrand,{rid:dt.id,size:Je<900?32:40,beside:!0})}),(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Oe.jsx)(G.T,{size:Je<900?18:21,weight:"semibold",colour:Q.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,q.hm)(yt)}),Je>=900?(0,Oe.jsx)(G.T,{size:13,colour:Q.colours.muted,children:(0,q.niceDate)(yt)}):null]})]}),It?(0,Oe.jsx)(O.default,{style:{width:220}}):(0,Oe.jsx)(O.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:ci}),(0,Oe.jsxs)(O.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Oe.jsx)(He.ShellfishChip,{rid:rt,by:jt,app:"display",size:Je<1200?'xs':Je<1280||Xe<700?'s':'m'}),(0,Oe.jsx)(E.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>cs(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,Oe.jsx)(G.T,{size:15,weight:"semibold",colour:Q.colours.muted,children:"?"})}),'simulated'===bt?(0,Oe.jsx)(E.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>gt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Oe.jsx)(G.T,{size:11,colour:Q.colours.muted,children:"+15"})}):null,e?null:(0,Oe.jsx)(j.ExitButton,{}),K,Pe?null:(0,Oe.jsx)(W.VoiceSlot,{size:44})]})]}),Me,It?null:(0,Oe.jsxs)(O.default,{testID:"display-day-stats",style:{paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},children:[(0,Oe.jsx)(Ke,{splitOnly:!0,split:cl,items:[]}),(0,Oe.jsx)(O.default,{testID:"roast-under-shellfish",style:{position:'absolute',top:2,right:104+(Je>=1e3?18:14)+(e?0:52)+('simulated'===bt?52:0),zIndex:4},children:(0,Oe.jsx)(He.SundayRoastChip,{rid:rt,by:jt,app:"display",size:Je<1100||Xe<700?'s':'m'})})]}),tt?hi:(gi=(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Oe.jsx)(O.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Vl(!1)}),Gl]}),(0,Oe.jsx)(De.BlocksBanner,{rid:rt,now:yt,big:!0,by:jt}),It?(0,Oe.jsx)(R.DayView,{rid:rt,day:It,today:kt,app:"display"}):(0,Oe.jsx)(Oe.Fragment,{children:(0,Oe.jsxs)(O.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[ni,(0,Oe.jsxs)(O.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Nl,Al?El:Pl,Ol,ai]})]})}),ei,It?null:(0,Oe.jsx)(O.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Oe.jsx)(B.CoversToday,{rid:rt,day:Os,sound:(0,L.flapSoundOn)(),onPress:ui})}),It?null:(0,Oe.jsx)(O.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Ul+Se.DAY_GRAPH_CHROME},children:di})]}),(0,Oe.jsx)(A.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:gi})),Zl]}),(0,Oe.jsx)(I.SoldOutStrip,{rid:rt,by:wt,onOpen:()=>bs(!0)}),(0,Oe.jsx)(v.SoldOutSheet,{visible:gs,onClose:()=>bs(!1),rid:rt,by:wt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Oe.jsx)(p.TableOrderCue,{rid:rt}),vt.elements,Vt?(0,Oe.jsx)(y.EditBookingPicker,{rid:rt,today:kt,who:jt,hidePrivate:!0,onClose:()=>Ut(!1)}):null,Kt?(0,Oe.jsx)(y.EditBookingSheet,{rid:rt,id:Kt,who:jt,hidePrivate:!0,onClose:()=>qt(null)}):null,Pt?(0,Oe.jsx)(xe.TableSheet,{rid:rt,name:Pt,view:Rs,plan:Tt,todays:Ds,now:yt,privacy:St,turnBase:dt.settings.turnMins,onClose:()=>Et(null),onWalkIn:e=>vt.openWalkInAt(e),onMove:e=>Ot(e),onDetails:vs}):null,sl?(()=>{const e=tl[sl],t=e?.dayBookings??[];return(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>{al(null),ll(null)},title:`${(0,d.tableNumbersA11y)(sl)} \xb7 ${Gs?_s:(0,Te.dayLong)(Os)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Oe.jsxs)(G.T,{size:16,center:!0,colour:Q.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${Gs?_s.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${Gs?_s.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,ue.privName)(e,St):Fe(e.name);return(0,Oe.jsx)(G.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,fe.tablesWords)((0,te.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ll(null),es(e.id)},style:{minHeight:56}},e.id)}),Os>=kt?(()=>{const t=e?.table.maxSeats??0,s=ut.filter(e=>e.date===Os&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,te.tablesOf)(e.table).includes(sl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Oe.jsxs)(O.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Oe.jsxs)(G.T,{size:17,weight:"semibold",center:!0,colour:Q.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(sl)]}),nl?(0,Oe.jsxs)(O.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:nl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:Q.colours.amber,backgroundColor:Q.colours.amberBg},children:[(0,Oe.jsx)(G.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:nl.ask}),(0,Oe.jsxs)(G.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Oe.jsx)(G.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!Fl.ok,accessibilityHint:Fl.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=ut.find(e=>e.id===nl.id);if(al(null),!e)return;const s=Fe(e.name);try{await(0,pe.saveBookingTables)(rt,e,[sl]),ms((0,fe.savedWords)(s,e.partySize,[sl],t))}catch(e){ms(`Couldn\u2019t save tables for ${s}: ${String(e?.message??e).slice(0,120)}`)}ll(null)}}),(0,Oe.jsx)(G.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>al(null)})]})]}):null,nl?null:s.slice(0,12).map(e=>{const s=Fe(e.name),l=e.partySize>t;return(0,Oe.jsx)(G.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:!Fl.ok,accessibilityHint:Fl.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(sl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{const l=(0,fe.overCapacityAsk)([sl],t,e.partySize);if(l)al({id:e.id,ask:l});else{try{await(0,pe.saveBookingTables)(rt,e,[sl]),ms((0,fe.savedWords)(s,e.partySize,[sl],t))}catch(e){ms(`Couldn\u2019t save tables for ${s}: ${String(e?.message??e).slice(0,120)}`)}ll(null)}},style:{minHeight:56}},e.id)})]}):null})():null,(0,Oe.jsx)(G.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{al(null),ll(null)},style:{minHeight:56}})]})})():null,Zt?(()=>{const e=ut.find(e=>e.id===Zt);return e?(0,Oe.jsx)(be.GuestActionsSheet,{rid:rt,b:e,name:e.walkIn?(0,ue.privName)(e,St):Fe(e.name),view:Rs,now:yt,otherDay:e.date!==kt,turnBase:dt.settings.turnMins,onClose:()=>es(null),onDetails:vs,onDone:ms,onEdit:e=>{es(null),qt(e.id)},onPickOnPlan:(e,t)=>{Xt(!1),Lt('plan'),Mt('all'),ss({id:e.id,tables:t})}}):null})():null,Nt?(0,Oe.jsx)(xe.DetailsPanel,{title:Nt.title,onClose:()=>_t(null),children:Nt.body}):null,Yt?(0,Oe.jsx)(xe.ServiceSummary,{r:dt,todays:Ds,orders:ct,waitlistAll:as,walkInCount:rs,onClose:()=>Qt(!1)}):null,ds?(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>cs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Oe.jsx)(g.FloorLegend,{}),(0,Oe.jsx)(G.T,{center:!0,size:14,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"}),(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>cs(!1)})]}):null,us?(0,Oe.jsxs)(G.Sheet,{visible:!0,onClose:()=>hs(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Oe.jsx)(F.ReviewsSection,{rid:rt,mode:"read",venueName:dt.name}),(0,Oe.jsx)(G.Button,{kind:"secondary",label:"Close",onPress:()=>hs(!1)})]}):null,Gt?(0,Oe.jsxs)(xe.DetailsPanel,{title:"Takeaway",onClose:()=>Ft(!1),children:[(0,Oe.jsx)(G.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Oe.jsx)(Ye,{list:Cs,me:jt,bookings:ut})]}):null,xs?(0,Oe.jsx)(O.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:Q.colours.bg},children:(0,Oe.jsx)(ne.PlanDesigner,{initial:Tt,venue:dt.name,mode:"display",startStep:"arrange",onActivity:()=>{ws.current=Date.now(),null!==ks&&Is(null)},notice:null!==ks?`Locking again in ${ks} s \xb7 touch to keep editing`:null,onSave:e=>{te.useFloor.getState().setPlan(rt,e),js(null),ms('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{te.useFloor.getState().setPlan(rt,e),ms('Live seating plan updated on every screen.')},onCancel:()=>{js(null),ms('No changes kept. Editing is locked again.')}},xs.at)}):null,e?null:(0,Oe.jsx)(de.Screensaver,{rid:rt,idleMins:Dt.idleMins,pinOn:Dt.pinOn,wake:Dt,tonightCards:Dt.tonightCards,cfg:Ct}),e?null:(0,Oe.jsx)(we.PrintHost,{rid:rt}),e?null:(0,Oe.jsx)(je.AlertHost,{variant:"display",rid:rt,skipTakeaway:!0}),e?null:(0,Oe.jsx)(z.SeatAllergenReminder,{rid:rt}),e?null:(0,Oe.jsx)(ke.TakeawayTakeover,{rid:rt,me:jt})]});var gi};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),D=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),$=e(T),B=_r(_d[27]),R=_r(_d[28]),L=_r(_d[29]),z=_r(_d[30]),W=_r(_d[31]),H=_r(_d[32]),M=e(_r(_d[33])),P=e(_r(_d[34])),E=e(_r(_d[35])),A=e(_r(_d[36])),O=e(_r(_d[37])),N=e(_r(_d[38])),_=_r(_d[39]),G=_r(_d[40]),F=_r(_d[41]),V=_r(_d[42]),U=_r(_d[43]),K=_r(_d[44]),q=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),oe=_r(_d[56]),ne=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),me=_r(_d[69]),xe=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),ke=_r(_d[73]),Ie=_r(_d[74]),ve=_r(_d[75]),De=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),$e=_r(_d[80]),Be=_r(_d[81]),Re=_r(_d[82]),Le=_r(_d[83]),ze=_r(_d[84]),We=_r(_d[85]),He=_r(_d[86]),Me=_r(_d[87]),Pe=_r(_d[88]),Ee=_r(_d[89]),Ae=_r(_d[90]),Oe=_r(_d[91]);const Ne='#221C12',_e='#2E2618',Ge=12e4,Fe=e=>(e??'').replace(' (example)',''),Ve=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),Ue=e=>e.slotTime?(0,q.hm)(new Date(e.slotTime)):'ASAP';function Ke({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:o}){return(0,Oe.jsxs)(O.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:o?'center':'stretch',maxWidth:o?560:void 0,width:o?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[o?null:(0,Oe.jsx)(O.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,Oe.jsxs)(O.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,Oe.jsx)(G.T,{size:s?24:19,weight:"semibold",colour:e.alert?Q.colours.amber:Q.colours.text,children:e.value}),(0,Oe.jsx)(G.T,{size:s?14:12,colour:Q.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Oe.jsx)(E.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,Oe.jsx)($.default.Fragment,{children:i},e.testID)})}),l?(0,Oe.jsx)(O.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||o?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Oe.jsx)(G.T,{size:14,colour:Q.colours.muted,children:"No Covers yet"}):(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(O.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Oe.jsx)(G.T,{size:i?13:14,weight:"semibold",colour:Q.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Oe.jsx)(G.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Oe.jsxs)(O.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:Q.colours.gold},children:[(0,Oe.jsx)(O.default,{style:{width:`${l.walkInPct}%`,backgroundColor:Q.colours.gold}}),(0,Oe.jsx)(O.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function qe({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:o,compact:n}){return(0,Oe.jsxs)(E.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:n?4:7,minHeight:44,paddingHorizontal:n?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,Oe.jsx)(O.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,Oe.jsx)(G.T,{size:n?12:14,weight:l?'semibold':'medium',colour:l?Q.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Oe.jsx)(G.T,{size:12,colour:Q.colours.muted,children:s}):null]})}function Ye({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Pe.statusBlock)(e,t,(0,Pe.linkedBooking)(e,l));return e.length?(0,Oe.jsx)(O.default,{style:{gap:8},children:e.map(e=>(0,Oe.jsxs)(O.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:Q.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?Q.colours.ok:e.allergies.length?Q.colours.red:Q.colours.gold},children:[(0,Oe.jsxs)(G.Row,{style:{justifyContent:'space-between'},children:[(0,Oe.jsxs)(G.T,{size:s?16:18,weight:"bold",children:[Ue(e)," \xb7 ",Fe(e.customerName)]}),(0,Oe.jsx)(G.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,Oe.jsxs)(G.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,Oe.jsxs)(G.T,{size:14,weight:"semibold",colour:Q.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,K.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Oe.jsx)(Me.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Oe.jsxs)(G.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Oe.jsx)(G.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>Y.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Oe.jsx)(G.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Oe.jsx)(G.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>Y.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Oe.jsx)(we.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Oe.jsx)(G.Muted,{children:"No takeaway orders right now."})}function Qe({rid:e,id:t,turnBase:s}){const l=(0,Y.useBookings)(e).find(e=>e.id===t);return l?(0,Oe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1309,[1141,796,5,6,1310,828,853,1117,860,1140,1311,1312,1313,1114,1135,1314,1315,1320,1321,1322,872,1323,1153,980,1122,1324,34,1094,1172,1044,1110,1136,1325,395,380,402,295,102,426,36,794,1210,1214,873,861,858,874,821,1113,892,1119,1084,1025,1100,1127,1326,1126,1327,1334,1336,1339,1342,1338,1343,1345,1346,1132,1116,1118,878,1350,1199,1351,1209,1201,1022,1356,1364,1365,1097,1134,1367,1368,1369,1166,1370,1165,1159,869,1371,1372,25]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1311,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useBookingWrite=function(){const t=(0,s.useSignedIn)(),c=(0,n.canChangeBookings)(t);return{ok:c,hint:c?void 0:n.BOOKING_VIEW_ONLY,lock:s=>c?{disabled:!1,accessibilityLabel:s}:{disabled:!0,accessibilityLabel:s,accessibilityHint:n.BOOKING_VIEW_ONLY}}};var n=r(d[0]),s=r(d[1])},1312,[1023,1084]); @@ -1416,7 +1416,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.listSavedPlans=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))},_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const{data:c,error:u}=await(0,n.getSupabase)().from('table_plans').insert({venue_id:a,name:o.name,is_active:!1,areas:t.areas??[],tables:t.tables??[],joins:t.joins??[],sections:t.sections??[],fixtures:t.fixtures??[],updated_by:s()}).select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').single();if(u)throw u;return l(c)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return c(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:c(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}function c(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1333,[1332,1021,872,934,988]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},1334,[34,236,402,102,821,794,1166,1335,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},1335,[]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return w}}),_e.Timeline=function({plan:e,bookings:T,now:C,privacy:S,onOpen:v,turnBase:I,t0:D,t1:E,height:z,pauses:L,blockedTables:R,hideNow:$,compact:_=!1,fit:O=!1}){const B=(0,o.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),W=T.filter(e=>!['cancelled','noshow'].includes(e.status)),[N,F]=(0,o.useState)(0),A=O&&!W.some(e=>!e.table)?B.filter(e=>'__none'!==e.key):B,P=O&&N>0?Math.max(w,Math.min(k,Math.floor(N/Math.max(1,A.length)))):k,H=P<44,Y=(0,o.useMemo)(()=>(0,c.clashes)(W,I),[W,I]),V=Math.max(1,Math.ceil((E.getTime()-D.getTime())/9e5)),[U,X]=(0,o.useState)(0),G=Math.max(30,U-M-2),q=Math.min(V,Math.max(1,Math.floor(G/j))),J=U>0?Math.max(j,Math.floor(G/q*100)/100):j,[K,Q]=(0,o.useState)(0),Z=Math.max(0,V-q),ee=Math.max(0,Math.min(Z,K)),te=(0,u.addMins)(D,15*ee),le=(0,u.addMins)(te,15*q),oe=e=>(e.getTime()-te.getTime())/9e5*J,[ie,ne]=(0,o.useState)(null),re=(0,o.useRef)(null);(0,o.useEffect)(()=>{const e=$?0:Math.floor((C.getTime()-D.getTime())/9e5)-Math.floor(q/3);Q(Math.max(0,Math.min(Z,e)))},[D.getTime(),q,Z,$]);const[se,ae]=(0,o.useState)(''),[de,ce]=(0,o.useState)(null),he=(0,o.useRef)(null);he.current=de,(0,o.useEffect)(()=>{if(!de)return;const e=setTimeout(()=>ce(null),s.ARM_MS);return()=>clearTimeout(e)},[de]);const ue=de?W.find(e=>e.id===de.id):void 0,be=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(he.current,e.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(he.current,e.id,Date.now()),onResponderGrant:e=>{re.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:l=>{if(!re.current||!(0,s.isArmed)(he.current,e.id,Date.now()))return;const o=l.nativeEvent.pageX-re.current.x,i=l.nativeEvent.pageY-re.current.y;(Math.abs(i)>=6||Math.abs(o)>=6)&&ne({id:e.id,row:t,dy:i})},onResponderRelease:l=>{const o=re.current;re.current=null,ne(null);const n=l.nativeEvent.pageX-(o?.x??0),r=l.nativeEvent.pageY-(o?.y??0),d=(0,s.releaseOn)(he.current,e.id,!(Math.abs(n)<6&&Math.abs(r)<6),Date.now());if(ce(d.arm),'select'===d.action){ae('');try{i.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===d.action)return void ae('');if('none'===d.action)return;ae('');const h=A.findIndex(e=>e.key===t),f=Math.max(0,Math.min(A.length-1,h+Math.round(r/P))),g=(0,b.dragTables)(e.table,t,A[f].key);g?(a.repo.bookings.update(e.id,{table:g,tableSetHere:!0}),ae(`${(0,p.privName)(e,S)} \u2192 ${(0,b.tablesWords)(g.split('+'))}, still ${(0,u.hm)((0,c.startOf)(e))}`)):Math.abs(n)>=6&&Math.abs(r)

=600||se?(0,y.jsx)(r.default,{style:{flex:U>=600?1:void 0,flexBasis:U>=600?void 0:'100%',minWidth:0},children:(0,y.jsx)(x.T,{size:13,center:U<600,colour:g.colours.muted,numberOfLines:U>=600?1:2,testID:"timeline-hint",children:se||s.SELECT_HINT})}):null,L?.length?(0,y.jsxs)(x.Row,{gap:4,children:[(0,y.jsx)(r.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:13,children:"Blocked"})]}):null,(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.goldLight,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(r.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))})}),(0,y.jsx)(r.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})})]}):null]}):(0,y.jsxs)(y.Fragment,{children:[_?(0,y.jsxs)(r.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,y.jsx)(r.default,{style:{alignSelf:'center'},children:(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'})}),(0,y.jsx)(x.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),se?(0,y.jsx)(r.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:se})}):null]}):(0,y.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(x.Row,{gap:8,children:[(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'}),(0,y.jsx)(r.default,{style:{flex:1,minWidth:0},children:(0,y.jsx)(x.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,y.jsx)(r.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{size:13,colour:g.colours.goldLight,children:se})})]}),(0,y.jsxs)(x.T,{center:!0,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})]}):null,L?.length?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(r.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:14,children:"Blocked"})]}):null]}),(0,y.jsxs)(r.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-U)>1&&X(t)},style:{flex:z?void 0:1,height:z,flexShrink:_?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,y.jsxs)(r.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:g.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,y.jsx)(r.default,{testID:"timeline-table-head",style:{width:M,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:(0,y.jsx)(x.T,{size:13,weight:"semibold",colour:g.colours.goldLight,children:"Table"})}),(0,y.jsxs)(r.default,{style:{width:q*J,flexShrink:0},children:[Array.from({length:Math.ceil(q/4)},(e,t)=>(0,y.jsx)(r.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*J,top:26,bottom:0,width:1,backgroundColor:g.colours.border}},t)),Array.from({length:Math.ceil(q/4)},(e,t)=>{const l=4*t*J,o=Math.max(0,Math.min(q*J-56,l-28));return(0,y.jsx)(r.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:o,width:56,top:4,height:22,justifyContent:'center'},children:(0,y.jsx)(x.T,{size:15,weight:"semibold",colour:g.colours.goldLight,center:!0,numberOfLines:1,children:(0,u.hm)((0,u.addMins)(te,60*t))})},`l${t}`)})]})]}),(0,y.jsxs)(n.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-N)>1&&F(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,y.jsx)(r.default,{style:{width:M,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:A.map((e,t,l)=>(0,y.jsx)(r.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:P,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:H?(0,y.jsxs)(r.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,y.jsx)(r.default,{style:{width:q*J,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!he.current,onResponderRelease:()=>{ce(null),ae('')},children:(0,y.jsxs)(r.default,{style:{width:q*J},children:[(L??[]).map((e,t)=>{const l=Math.max(0,oe(e.from)),o=Math.min(q*J,oe(e.to));return o<=l?null:(0,y.jsx)(r.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,u.hm)(e.from)} to ${(0,u.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:o-l,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),A.map((e,o,i)=>{return(0,y.jsxs)(r.default,{testID:`tl-row-${e.key}`,style:{height:P,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:o>0&&i[o-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(q/4)},(e,l)=>(0,y.jsx)(r.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*J,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),R?.includes(e.key)?(0,y.jsx)(r.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,y.jsx)(x.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,W.filter(e=>('__none'===n?!e.table:(0,d.tablesOf)(e.table).includes(n))&&(0,c.startOf)(e)te)).map(t=>{const o=ie?.id===t.id&&ie.row===e.key?ie:null,i=oe((0,c.startOf)(t)),n=Math.max(0,Math.min(q*J-44,i)),a=Math.min(q*J,oe((0,u.addMins)((0,c.startOf)(t),(0,c.durOf)(t,I)))),d=Math.min(q*J-n,Math.max(44,a-Math.max(0,i))),b=Y.has(t.id),j=de?.id===t.id;return(0,y.jsx)(r.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,p.privName)(t,S)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,u.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,I)} min${b?', clash':''}${(0,h.depositView)(t,!0)?`, ${(0,h.depositView)(t,!0).a11y}`:''}${j?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:j},accessibilityHint:j?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:j?'1':'0'},...be(t,e.key),style:[{position:'absolute',left:n,top:(H?2:4)+(o?o.dy:0),width:d,height:P-(H?4:8),borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:j?3:b?2.5:1,borderColor:j?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...j?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:o?40:j?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:j?'ns-resize':'pointer',touchAction:j?'none':'pan-y'},o?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,y.jsx)(x.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:H?1:2,style:{lineHeight:16},children:d<100?H&&d>=70?`${t.partySize} \xb7 ${(0,u.hm)((0,c.startOf)(t))}`:String(t.partySize):(0,y.jsxs)(y.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key||H?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,p.privName)(t,S)," \xb7 ",t.partySize,H?' \xb7 ':'\n',(0,u.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,h.depositView)(t,!0)?d>=150?` \xb7 ${(0,h.depositView)(t,!0).label}`:'Deposit paid'===(0,h.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n}),!$&&me>=0&&me<=q*J?(0,y.jsx)(r.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:me,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,y.jsx)(r.default,{style:{position:'absolute',top:0,left:Math.max(-me,Math.min(-18,q*J-me-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,y.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,u.hm)(C)})})}):null]})})]}),ue?(0,y.jsx)(r.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,y.jsxs)(x.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,y.jsx)(r.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,p.privName)(ue,S)} ${s.SELECTED_A11Y}`,children:(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,p.privName)(ue,S)," \xb7 ",ue.partySize]})}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{ce(null),v(ue)}}),(0,y.jsx)(x.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{ce(null),ae('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=_r(_d[2]),i=e(_r(_d[3]));_r(_d[4]);var n=e(_r(_d[5])),r=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),u=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),x=_r(_d[16]),p=_r(_d[17]),y=_r(_d[18]);const j=30,k=52,w=28,M=120},1336,[828,860,34,281,236,295,102,1128,874,1025,1100,14,858,1118,1337,821,794,1338,25]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SLOT_W",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return w}}),_e.Timeline=function({plan:e,bookings:T,now:C,privacy:S,onOpen:v,turnBase:I,t0:D,t1:z,height:E,pauses:$,blockedTables:L,hideNow:R,compact:_=!1,fit:O=!1}){const B=(0,o.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,d.tableLabel)(e)})))],[e]),W=T.filter(e=>!['cancelled','noshow'].includes(e.status)),[N,A]=(0,o.useState)(0),F=O&&!W.some(e=>!e.table)?B.filter(e=>'__none'!==e.key):B,P=O&&N>0?Math.max(w,Math.min(k,Math.floor(N/Math.max(1,F.length)))):k,H=P<44,Y=(0,o.useMemo)(()=>(0,c.clashes)(W,I),[W,I]),V=Math.max(1,Math.ceil((z.getTime()-D.getTime())/9e5)),[U,X]=(0,o.useState)(0),G=Math.max(30,U-M-2),q=Math.min(V,Math.max(1,Math.floor(G/j))),J=U>0?Math.max(j,Math.floor(G/q*100)/100):j,[K,Q]=(0,o.useState)(0),Z=Math.max(0,V-q),ee=Math.max(0,Math.min(Z,K)),te=(0,u.addMins)(D,15*ee),le=(0,u.addMins)(te,15*q),oe=e=>(e.getTime()-te.getTime())/9e5*J,[ie,re]=(0,o.useState)(null),ne=(0,o.useRef)(null);(0,o.useEffect)(()=>{const e=R?0:Math.floor((C.getTime()-D.getTime())/9e5)-Math.floor(q/3);Q(Math.max(0,Math.min(Z,e)))},[D.getTime(),q,Z,R]);const[se,ae]=(0,o.useState)(''),[de,ce]=(0,o.useState)(null),he=(0,o.useRef)(null);he.current=de,(0,o.useEffect)(()=>{if(!de)return;const e=setTimeout(()=>ce(null),s.ARM_MS);return()=>clearTimeout(e)},[de]);const ue=de?W.find(e=>e.id===de.id):void 0,be=(t,l)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,s.isArmed)(he.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,s.isArmed)(he.current,t.id,Date.now()),onResponderGrant:e=>{ne.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!ne.current||!(0,s.isArmed)(he.current,t.id,Date.now()))return;const o=e.nativeEvent.pageX-ne.current.x,i=e.nativeEvent.pageY-ne.current.y;(Math.abs(i)>=6||Math.abs(o)>=6)&&re({id:t.id,row:l,dy:i})},onResponderRelease:o=>{const r=ne.current;ne.current=null,re(null);const n=o.nativeEvent.pageX-(r?.x??0),d=o.nativeEvent.pageY-(r?.y??0),h=(0,s.releaseOn)(he.current,t.id,!(Math.abs(n)<6&&Math.abs(d)<6),Date.now());if(ce(h.arm),'select'===h.action){ae('');try{i.default.announceForAccessibility(s.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void ae('');if('none'===h.action)return;ae('');const f=F.findIndex(e=>e.key===l),g=Math.max(0,Math.min(F.length-1,f+Math.round(d/P))),x=(0,b.dragTables)(t.table,l,F[g].key);if(x){a.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,b.overCapacityAsk)(x.split('+'),(0,b.seatsOf)(e,x.split('+')).total,t.partySize);ae(`${(0,p.privName)(t,S)} \u2192 ${(0,b.tablesWords)(x.split('+'))}, still ${(0,u.hm)((0,c.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`)}else Math.abs(n)>=6&&Math.abs(d)

=600||se?(0,y.jsx)(n.default,{style:{flex:U>=600?1:void 0,flexBasis:U>=600?void 0:'100%',minWidth:0},children:(0,y.jsx)(x.T,{size:13,center:U<600,colour:g.colours.muted,numberOfLines:U>=600?1:2,testID:"timeline-hint",children:se||s.SELECT_HINT})}):null,$?.length?(0,y.jsxs)(x.Row,{gap:4,children:[(0,y.jsx)(n.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:13,children:"Blocked"})]}):null,(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.goldLight,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(n.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))})}),(0,y.jsx)(n.default,{style:{flexShrink:0},children:(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})})]}):null]}):(0,y.jsxs)(y.Fragment,{children:[_?(0,y.jsxs)(n.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,y.jsx)(n.default,{style:{alignSelf:'center'},children:(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'})}),(0,y.jsx)(x.Muted,{center:!0,testID:"timeline-hint",children:s.SELECT_HINT}),(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),se?(0,y.jsx)(n.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{center:!0,size:14,colour:g.colours.goldLight,children:se})}):null]}):(0,y.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(x.Row,{gap:8,children:[(0,y.jsx)(x.Badge,{kind:Y.size?'red':'ok',label:Y.size?`${Y.size} bookings clash`:'No clashes'}),(0,y.jsx)(n.default,{style:{flex:1,minWidth:0},children:(0,y.jsx)(x.Muted,{testID:"timeline-hint",children:s.SELECT_HINT})})]}),(0,y.jsx)(n.default,{testID:"clash-count",accessibilityLabel:`clashes ${Y.size}`,children:(0,y.jsx)(x.T,{size:13,colour:g.colours.goldLight,children:se})})]}),(0,y.jsxs)(x.T,{center:!0,testID:"timeline-window",children:[(0,u.hm)(te)," to ",(0,u.hm)(le)]}),V>q?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ee,onPress:()=>Q(Math.max(0,ee-q))}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ee>=Z,onPress:()=>Q(Math.min(Z,ee+q))})]}):null,$?.length?(0,y.jsxs)(x.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(n.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,y.jsx)(x.T,{size:14,children:"Blocked"})]}):null]}),(0,y.jsxs)(n.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-U)>1&&X(t)},style:{flex:E?void 0:1,height:E,flexShrink:_?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:g.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,y.jsxs)(n.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:g.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,y.jsx)(n.default,{testID:"timeline-table-head",style:{width:M,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:(0,y.jsx)(x.T,{size:13,weight:"semibold",colour:g.colours.goldLight,children:"Table"})}),(0,y.jsxs)(n.default,{style:{width:q*J,flexShrink:0},children:[Array.from({length:Math.ceil(q/4)},(e,t)=>(0,y.jsx)(n.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*J,top:26,bottom:0,width:1,backgroundColor:g.colours.border}},t)),Array.from({length:Math.ceil(q/4)},(e,t)=>{const l=4*t*J,o=Math.max(0,Math.min(q*J-56,l-28));return(0,y.jsx)(n.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:o,width:56,top:4,height:22,justifyContent:'center'},children:(0,y.jsx)(x.T,{size:15,weight:"semibold",colour:g.colours.goldLight,center:!0,numberOfLines:1,children:(0,u.hm)((0,u.addMins)(te,60*t))})},`l${t}`)})]})]}),(0,y.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-N)>1&&A(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,y.jsx)(n.default,{style:{width:M,borderRightWidth:1,borderColor:g.colours.border,backgroundColor:g.colours.surface},children:F.map((e,t,l)=>(0,y.jsx)(n.default,{accessible:!0,accessibilityLabel:'__none'===e.key||/^tables?\b/i.test(e.name)?'__none'===e.key?'No table':e.name:`Table ${e.name}`,style:{height:P,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:g.colours.gold},children:H?(0,y.jsxs)(n.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(x.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,y.jsx)(x.T,{size:10,colour:g.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,y.jsx)(n.default,{style:{width:q*J,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!he.current,onResponderRelease:()=>{ce(null),ae('')},children:(0,y.jsxs)(n.default,{style:{width:q*J},children:[($??[]).map((e,t)=>{const l=Math.max(0,oe(e.from)),o=Math.min(q*J,oe(e.to));return o<=l?null:(0,y.jsx)(n.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,u.hm)(e.from)} to ${(0,u.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:o-l,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1}},`pz${t}`)}),F.map((e,o,i)=>{return(0,y.jsxs)(n.default,{testID:`tl-row-${e.key}`,style:{height:P,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:o>0&&i[o-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(q/4)},(e,l)=>(0,y.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*J,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),L?.includes(e.key)?(0,y.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:6},children:(0,y.jsx)(x.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(r=e.key,W.filter(e=>('__none'===r?!e.table:(0,d.tablesOf)(e.table).includes(r))&&(0,c.startOf)(e)te)).map(t=>{const o=ie?.id===t.id&&ie.row===e.key?ie:null,i=oe((0,c.startOf)(t)),r=Math.max(0,Math.min(q*J-44,i)),a=Math.min(q*J,oe((0,u.addMins)((0,c.startOf)(t),(0,c.durOf)(t,I)))),d=Math.min(q*J-r,Math.max(44,a-Math.max(0,i))),b=Y.has(t.id),j=de?.id===t.id;return(0,y.jsx)(n.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,p.privName)(t,S)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,u.hm)((0,c.startOf)(t))}, ${(0,c.durOf)(t,I)} min${b?', clash':''}${(0,h.depositView)(t,!0)?`, ${(0,h.depositView)(t,!0).a11y}`:''}${j?`. ${s.SELECTED_A11Y}`:''}`,accessibilityState:{selected:j},accessibilityHint:j?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:j?'1':'0'},...be(t,e.key),style:[{position:'absolute',left:r,top:(H?2:4)+(o?o.dy:0),width:d,height:P-(H?4:8),borderRadius:8,backgroundColor:(0,f.blockColour)(t),borderWidth:j?3:b?2.5:1,borderColor:j?g.colours.gold:b?'#FF6B5E':'rgba(0,0,0,0.4)',...j?{boxShadow:'0 0 0 3px rgba(226,196,137,0.55), 0 0 14px rgba(226,196,137,0.6)'}:{},paddingHorizontal:6,justifyContent:'center',zIndex:o?40:j?20:2,opacity:'finished'===t.status?f.FINISHED_OPACITY:1,cursor:j?'ns-resize':'pointer',touchAction:j?'none':'pan-y'},o?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,y.jsx)(x.T,{size:14,weight:"semibold",colour:(0,f.blockTextColour)(t),numberOfLines:H?1:2,style:{lineHeight:16},children:d<100?H&&d>=70?`${t.partySize} \xb7 ${(0,u.hm)((0,c.startOf)(t))}`:String(t.partySize):(0,y.jsxs)(y.Fragment,{children:[b?'\u26a0 ':'','__none'===e.key||H?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,p.privName)(t,S)," \xb7 ",t.partySize,H?' \xb7 ':'\n',(0,u.hm)((0,c.startOf)(t)),t.allergies.length?' \u26a0':'',(0,h.depositView)(t,!0)?d>=150?` \xb7 ${(0,h.depositView)(t,!0).label}`:'Deposit paid'===(0,h.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var r}),!R&&me>=0&&me<=q*J?(0,y.jsx)(n.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:me,top:0,bottom:0,width:2,backgroundColor:g.colours.gold,zIndex:30},children:(0,y.jsx)(n.default,{style:{position:'absolute',top:0,left:Math.max(-me,Math.min(-18,q*J-me-38)),width:38,backgroundColor:g.colours.gold,borderRadius:6},children:(0,y.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,u.hm)(C)})})}):null]})})]}),ue?(0,y.jsx)(n.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,y.jsxs)(x.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:g.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,y.jsx)(n.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,p.privName)(ue,S)} ${s.SELECTED_A11Y}`,children:(0,y.jsxs)(x.T,{size:14,weight:"semibold",colour:g.colours.gold,center:!0,children:["Selected: ",(0,p.privName)(ue,S)," \xb7 ",ue.partySize]})}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{ce(null),v(ue)}}),(0,y.jsx)(x.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{ce(null),ae('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),o=_r(_d[2]),i=e(_r(_d[3]));_r(_d[4]);var r=e(_r(_d[5])),n=e(_r(_d[6])),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),u=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),x=_r(_d[16]),p=_r(_d[17]),y=_r(_d[18]);const j=30,k=52,w=28,M=120},1336,[828,860,34,281,236,295,102,1128,874,1025,1100,14,858,1118,1337,821,794,1338,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},1337,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},1338,[]); __d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:i,tonightCards:s,cfg:l=null}){const[a,c]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[h,f]=(0,o.useState)(''),p=(0,o.useRef)(Date.now()),b=(0,o.useRef)(!1),k=(0,o.useRef)(0);b.current=a,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(a),()=>v.useScreensaverAsleep.getState().set(!1)),[a]);const I=(0,j.idleMsFor)(l,t);(0,o.useEffect)(()=>D?(0,y.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!D)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return b.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,b.current=!1,window.__ccWokeAt=n,c(!1),E.current&&d(!0),void(p.current=Date.now())):n{p.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{null!==I&&!b.current&&!T.current&&Date.now()-p.current>=I&&(b.current=!0,c(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[I]);const E=(0,o.useRef)(n);E.current=n;const T=(0,o.useRef)(u);return T.current=u,(0,o.useEffect)(()=>{if(!D)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),u?(0,S.jsx)(z,{wake:i,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),p.current=Date.now(),i.pinDefault&&(0,w.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):a?(0,S.jsx)(L,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[i,s]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t)return(0,b.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(P.Provider,{value:i,children:(0,S.jsx)(c.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(C,{rid:e,size:n,textSize:14})})})},_e.Saver=L;var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),i=e(o),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),c=e(r(_d[7])),u=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),p=r(_d[12]),w=r(_d[13]),v=r(_d[14]),y=r(_d[15]),x=r(_d[16]),j=r(_d[17]),b=r(_d[18]),k=r(_d[19]),I=r(_d[20]),S=r(_d[21]);const D='undefined'!=typeof window;function z({wake:e,entry:t,setEntry:o,onOk:i}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);o(l),l.length===s&&((0,p.wakePinMatches)(e,l)?i():setTimeout(()=>o(''),300))};return(0,S.jsxs)(c.default,{testID:"wake-pin",style:{position:D?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,S.jsx)(f.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(f.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,S.jsx)(a.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>l(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(f.T,{size:26,colour:d.colours.gold,children:e})},e))})]})}const E=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',T={logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function L({rid:e,cfg:t=null,box:n}){const i=(0,u.default)(),l=n?.width??i.width,a=n?.height??i.height,d=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(d,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[h,f]=(0,o.useState)(()=>new Date);(0,o.useEffect)(()=>{const e=setInterval(()=>f(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',w=!!t&&(0,j.dimNow)(t,h),[v,y]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let e=!0;if(t?.logo)return(0,b.saverPhotoUrl)(t.logo).then(t=>{e&&y(t)}),()=>{e=!1};y(null)},[t?.logo]),(0,S.jsx)(P.Provider,{value:v,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?T[t.style]:'logo'}${w?', dimmed for the night':''}. Touch anywhere to wake.`,style:{position:n?'relative':D?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?l:void 0,height:n?a:void 0,zIndex:n?0:1e5,backgroundColor:E(e),opacity:d,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['logo'===p?(0,S.jsx)(_,{rid:e,width:l,height:a}):'clock'===p?(0,S.jsx)(A,{rid:e,now:h,width:l,height:a}):'covers'===p?(0,S.jsx)(N,{rid:e,now:h,width:l,height:a}):'photos'===p?(0,S.jsx)(R,{rid:e,paths:t?.photos??[],width:l,height:a}):'black'===p?(0,S.jsx)(c.default,{testID:"saver-black"}):(0,S.jsx)(M,{rid:e,width:l,height:a}),w?(0,S.jsx)(c.default,{testID:"saver-dim",pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)'}}):null]})})}const P=i.default.createContext(null);function C({rid:e,size:t,textSize:n}){const o=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??o.logo,a=i.default.useContext(P);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${o.name} logo`}):(0,S.jsx)(f.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:o.name})}function M({rid:e,width:t,height:n}){return(0,S.jsx)(c.default,{testID:"saver-still",children:(0,S.jsx)(C,{rid:e,size:.5*Math.min(t,n)})})}function _({rid:e,width:t,height:n}){const i=.34*Math.min(t,n),l=(0,o.useRef)(new s.default.ValueXY({x:0,y:0})).current;return(0,o.useEffect)(()=>{const e=Math.max(0,(t-i)/2-12),o=Math.max(0,(n-i)/2-12),a=[{x:-e,y:.6*-o},{x:.7*e,y:-o},{x:e,y:.5*o},{x:.4*-e,y:o},{x:0,y:0}],c=s.default.loop(s.default.sequence(a.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return c.start(),()=>c.stop()},[t,n,i]),(0,S.jsx)(s.default.View,{testID:"saver-logo",style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(C,{rid:e,size:i})})}function A({rid:e,now:t,width:n,height:o}){const i=Math.min(.22*n,.32*o),s=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),l=t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',timeZone:'Europe/London'});return(0,S.jsxs)(c.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*i},children:[(0,S.jsx)(C,{rid:e,size:.7*i}),(0,S.jsx)(f.T,{size:i,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*i},children:s}),(0,S.jsx)(f.T,{size:.24*i,style:{textAlign:'center'},children:l})]})}function N({rid:e,now:t,width:n,height:o}){const i=(0,k.useStore)(e=>e.bookings),s=(0,I.venueYmd)(t),l=t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),a=i.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),u=a.reduce((e,t)=>e+t.partySize,0),h=a.filter(e=>'seated'!==e.status&&'finished'!==e.status&&e.time>=l).sort((e,t)=>e.time.localeCompare(t.time)).slice(0,3),p=Math.min(n/12,o/9);return(0,S.jsxs)(c.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*p},children:[(0,S.jsx)(C,{rid:e,size:2*p}),(0,S.jsx)(f.T,{size:.5*p,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(c.default,{style:{flexDirection:'row',gap:1.4*p,justifyContent:'center'},children:[(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:u}),(0,S.jsx)(f.T,{size:.42*p,children:1===u?'cover':'covers'})]}),(0,S.jsxs)(c.default,{style:{alignItems:'center'},children:[(0,S.jsx)(f.T,{size:1.6*p,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(f.T,{size:.42*p,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(f.T,{size:.4*p,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(f.T,{size:.4*p,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function R({rid:e,paths:t,width:n,height:i}){const[l,a]=(0,o.useState)([]),[u,d]=(0,o.useState)(0),h=(0,o.useRef)(new s.default.Value(1)).current;return(0,o.useEffect)(()=>{let e=!0;return Promise.all(t.map(b.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,o.useEffect)(()=>{if(l.length<2)return;const e=setInterval(()=>{s.default.timing(h,{toValue:0,duration:600,useNativeDriver:!1}).start(()=>{d(e=>(e+1)%l.length),s.default.timing(h,{toValue:1,duration:600,useNativeDriver:!1}).start()})},8e3);return()=>clearInterval(e)},[l.length]),l.length?(0,S.jsx)(s.default.Image,{testID:"saver-photos",source:{uri:l[u%l.length]},style:{width:n,height:i,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${u%l.length+1} of ${l.length}`}):(0,S.jsx)(c.default,{testID:"saver-photos-empty",children:(0,S.jsx)(C,{rid:e,size:.4*Math.min(n,i)})})}},1339,[5,828,34,283,336,236,402,102,426,821,873,794,1026,1000,1320,1340,2,1341,1342,874,858,25]); @@ -1426,10 +1426,10 @@ __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.guestDeposit=u,e.guestRowText=function(o,p){const d=o.partySize,b=`${d} ${1===d?'person':'people'}`,$=(0,n.tablesOf)(o.table??void 0),c=p.seated?"Seated"+($.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):$.length?(0,t.tableNumbers)(o.table):'No table yet',f=u(o),x=$.length?`table${$.length>1?'s':''} ${l($.map(t.plainTableNumber))}`:'no table yet',D=!!o.dog,m=(0,s.allergyLine)(o),w=[o.time,p.name,m?`allergy noted: ${m}`:'',b,p.seated?'seated':'',f?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:p.name,people:b,deposit:f?.text??null,depositWarn:!!f?.warn,table:c,dog:D,allergy:m,a11y:w}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]),s=r(_d[3]);const p=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,d=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,l=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function u(t){const n=(0,o.depositBadge)(t,p);if(!n)return null;const s=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===s||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${p(t)} of ${p(u)} paid`,spoken:`deposit ${d(t).replace(' pounds','')} of ${d(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1343,[860,14,1025,1344]); __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])},1344,[861]); __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])},1345,[34,102,797,821,25]); -__d(function(_g,r,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:S,name:D,view:P,now:I,onClose:L,onDetails:v,onDone:N,otherDay:T,turnBase:W=90,onPickOnPlan:H}){const[_,z]=(0,l.useState)(!1),M=(0,j.useBookingWrite)(),[A,G]=(0,l.useState)(!1),[O,F]=(0,l.useState)(!1),[R,q]=(0,l.useState)(!1),E=(0,k.guestRowText)(S,{name:D,seated:'seated'===S.status&&!T}),J='seated'===S.status&&!T,K=S.table?J?`Seated \xb7 ${(0,a.tableCardLabel)(S.table)}`:(0,a.tableCardLabel)(S.table):J?'Seated':'No table yet',Q=T?[]:(0,y.guestActions)(S,D,P,I).filter(e=>'details'!==e.id),U=(0,g.tableActions)(S,D),V={id:'details',label:'Guest details',a11y:`Guest details, ${D}`},X=async t=>{const s={...S,table:t};t!==S.table&&await u.repo.bookings.update(S.id,{table:t}),await(0,b.seatBookingNow)(e,s),N(`${D} seated at ${(0,y.tableWords)(t)}.`),L()},Y=async t=>'seat'===t.id&&t.table?X(t.table):'pick'===t.id?z(e=>!e):'details'===t.id?(L(),v(S)):'finished'===t.id?('seated'===S.status?await(0,b.finishBookingNow)(e,S):await u.repo.bookings.setStatus(S.id,'finished'),N('seated'===S.status&&S.table?`${D} finished. ${(0,y.tableWords)(S.table).replace(/^t/,'T')} needs clearing.`:`${D} finished.`),L()):'noshow'===t.id?(await u.repo.bookings.setStatus(S.id,'noshow'),N(`${D} marked as a no-show.`),L()):void 0,Z=_?(0,y.freeTablesNow)(P,S.partySize).slice(0,8):[];if(A)return(0,w.jsx)(h.TablePicker,{rid:e,booking:S,name:D,turnBase:W,onClose:L,onSaved:N,onPickOnPlan:H?e=>{L(),H(S,e)}:void 0});if(O)return(0,w.jsx)(f.CancelWalkInConfirm,{rid:e,b:S,onClose:L,onDone:N});if(R)return(0,w.jsx)(p.CancelBookingConfirm,{rid:e,b:S,name:D,onClose:L,onDone:N});const ee=[...Q];return(0,w.jsxs)(c.Sheet,{visible:!0,onClose:L,title:`${S.time} \xb7 ${D}`,maxWidth:560,testID:"guest-actions",children:[(0,w.jsx)(o.default,{accessible:!0,accessibilityLabel:E.a11y,testID:"guest-actions-summary",children:(0,w.jsxs)(c.T,{size:18,children:[E.people,E.deposit?(0,w.jsxs)(c.T,{size:18,weight:"semibold",colour:E.depositWarn?x.colours.amber:x.colours.goldLight,children:[" \xb7 ",E.deposit]}):null," \xb7 ",K]})}),(0,w.jsx)(t.ShowNumberButton,{b:S}),(0,w.jsxs)(o.default,{style:{gap:10},children:[ee.map(e=>(0,w.jsxs)(n.default.Fragment,{children:[(0,w.jsx)(c.Button,{kind:B(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:M.hint,disabled:'details'!==e.id&&!M.ok,testID:`guest-act-${e.id}`,onPress:()=>Y(e),style:C}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,w.jsxs)(c.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&_?(0,w.jsxs)(o.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===Z.length?(0,w.jsx)(c.Muted,{children:"No free tables right now."}):null,Z.map(e=>(0,w.jsx)(c.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${D} at table ${e.table}, ${e.seats} seats`,accessibilityHint:M.hint,disabled:!M.ok,testID:`guest-pick-${e.table}`,onPress:()=>X(e.table),style:C},e.table))]}):null]},e.id)),U.map(t=>(0,w.jsx)(c.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:M.hint,disabled:!M.ok,testID:`guest-act-${t.id}`,style:C,onPress:async()=>{if(M.ok){if('assign'===t.id)return G(!0);await(0,h.saveBookingTables)(e,S,[]),N(`${D}: table taken off.`),L()}}},t.id)),!T&&(0,f.canCancelWalkIn)(S)?(0,w.jsx)(c.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${S.ref}, ${S.partySize} Covers`,accessibilityHint:M.hint,disabled:!M.ok,testID:"guest-act-cancelwalkin",onPress:()=>F(!0),style:C}):null,(0,$.canCancelBooking)(S)?(0,w.jsx)(c.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${D}, ${S.time}, ${S.partySize} Covers`,accessibilityHint:M.hint,disabled:!M.ok,testID:"guest-act-cancelbooking",onPress:()=>q(!0),style:C}):null,(0,w.jsx)(c.Button,{kind:"ghost",label:V.label,accessibilityLabel:V.a11y,testID:"guest-act-details",onPress:()=>Y(V),style:C})]}),(0,w.jsx)(c.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:L,style:C})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=e(l),o=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),f=r(d[12]),p=r(d[13]),$=r(d[14]),x=r(d[15]),j=r(d[16]),w=r(d[17]);const C={minHeight:64},B=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1346,[1347,860,1025,34,102,794,1119,874,1349,1343,1118,1116,1132,1133,1134,821,1312,25]); +__d(function(_g,r,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:D,name:v,view:I,now:P,onClose:L,onDetails:z,onDone:H,otherDay:N,turnBase:T=90,onPickOnPlan:W,onEdit:_}){const[A,E]=(0,l.useState)(null),[F,M]=(0,l.useState)(!1),R=(0,w.useBookingWrite)(),[G,O]=(0,l.useState)(!1),[U,q]=(0,l.useState)(!1),[J,K]=(0,l.useState)(!1),Q=(0,k.guestRowText)(D,{name:v,seated:'seated'===D.status&&!N}),V='seated'===D.status&&!N,X=D.table?V?`Seated \xb7 ${(0,a.tableCardLabel)(D.table)}`:(0,a.tableCardLabel)(D.table):V?'Seated':'No table yet',Y=N?[]:(0,y.guestActions)(D,v,I,P).filter(e=>'details'!==e.id),Z=(0,g.tableActions)(D,v),ee={id:'details',label:'Guest details',a11y:`Guest details, ${v}`},te=async t=>{const s={...D,table:t};t!==D.table&&await u.repo.bookings.update(D.id,{table:t}),await(0,b.seatBookingNow)(e,s),H(`${v} seated at ${(0,y.tableWords)(t)}.`),L()},se=async t=>'seat'===t.id&&t.table?te(t.table):'pick'===t.id?M(e=>!e):'details'===t.id?(L(),z(D)):'finished'===t.id?('seated'===D.status?await(0,b.finishBookingNow)(e,D):await u.repo.bookings.setStatus(D.id,'finished'),H('seated'===D.status&&D.table?`${v} finished. ${(0,y.tableWords)(D.table).replace(/^t/,'T')} needs clearing.`:`${v} finished.`),L()):'noshow'===t.id?(await u.repo.bookings.setStatus(D.id,'noshow'),H(`${v} marked as a no-show.`),L()):void 0,ae=F?(0,y.freeTablesNow)(I,D.partySize,!0).slice(0,12):[];if(G)return(0,C.jsx)(p.TablePicker,{rid:e,booking:D,name:v,turnBase:T,onClose:L,onSaved:H,onPickOnPlan:W?e=>{L(),W(D,e)}:void 0});if(U)return(0,C.jsx)(f.CancelWalkInConfirm,{rid:e,b:D,onClose:L,onDone:H});if(J)return(0,C.jsx)($.CancelBookingConfirm,{rid:e,b:D,name:v,onClose:L,onDone:H});const ie=[...Y];return(0,C.jsxs)(c.Sheet,{visible:!0,onClose:L,title:`${D.time} \xb7 ${v}`,maxWidth:560,testID:"guest-actions",children:[(0,C.jsx)(o.default,{accessible:!0,accessibilityLabel:Q.a11y,testID:"guest-actions-summary",children:(0,C.jsxs)(c.T,{size:18,children:[Q.people,Q.deposit?(0,C.jsxs)(c.T,{size:18,weight:"semibold",colour:Q.depositWarn?j.colours.amber:j.colours.goldLight,children:[" \xb7 ",Q.deposit]}):null," \xb7 ",X]})}),(0,C.jsx)(t.ShowNumberButton,{b:D}),(0,C.jsxs)(o.default,{style:{gap:10},children:[ie.map(e=>(0,C.jsxs)(n.default.Fragment,{children:[(0,C.jsx)(c.Button,{kind:B(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:R.hint,disabled:'details'!==e.id&&!R.ok,testID:`guest-act-${e.id}`,onPress:()=>se(e),style:S}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,C.jsxs)(c.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&F?(0,C.jsxs)(o.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ae.length?(0,C.jsx)(c.Muted,{children:"No free tables right now."}):null,A?(0,C.jsxs)(o.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:A.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:j.colours.amber,backgroundColor:j.colours.amberBg},children:[(0,C.jsx)(c.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:A.ask}),(0,C.jsx)(c.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!R.ok,accessibilityHint:R.hint,onPress:()=>{const e=A.table;E(null),te(e)},style:S}),(0,C.jsx)(c.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>E(null),style:S})]}):ae.map(e=>(0,C.jsx)(c.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,g.overCapacityAsk)([e.table],e.seats,D.partySize);t?E({table:e.table,ask:t}):te(e.table)},style:S},e.table))]}):null]},e.id)),Z.map(t=>(0,C.jsx)(c.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:R.hint,disabled:!R.ok,testID:`guest-act-${t.id}`,style:S,onPress:async()=>{if(R.ok){if('assign'===t.id)return O(!0);await(0,p.saveBookingTables)(e,D,[]),H(`${v}: table taken off.`),L()}}},t.id)),!N&&(0,f.canCancelWalkIn)(D)?(0,C.jsx)(c.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${D.ref}, ${D.partySize} Covers`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-cancelwalkin",onPress:()=>q(!0),style:S}):null,(0,x.canCancelBooking)(D)?(0,C.jsx)(c.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${v}, ${D.time}, ${D.partySize} Covers`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-cancelbooking",onPress:()=>K(!0),style:S}):null,!_||D.walkIn||['cancelled','noshow'].includes(D.status)||N&&!(D.date>=(0,h.ymd)(P))?null:(0,C.jsx)(c.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${v}, ${D.time}. Date, time, covers, table, anything.`,accessibilityHint:R.hint,disabled:!R.ok,testID:"guest-act-edit",onPress:()=>{L(),_(D)},style:S}),(0,C.jsx)(c.Button,{kind:"ghost",label:ee.label,accessibilityLabel:ee.a11y,testID:"guest-act-details",onPress:()=>se(ee),style:S})]}),(0,C.jsx)(c.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:L,style:S})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=e(l),o=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),k=r(d[9]),g=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),$=r(d[14]),x=r(d[15]),j=r(d[16]),w=r(d[17]),C=r(d[18]);const S={minHeight:64},B=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1346,[1347,860,1025,34,102,794,1119,874,1349,1343,1118,858,1116,1132,1133,1134,821,1312,25]); __d(function(g,r,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)(h.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(h.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=h.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,h.canShowNumber)(e,!y||(0,b.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 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,h.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,h.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]),b=r(d[7]),h=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1347,[34,379,402,102,874,1003,892,1023,1348,872,821,794,25]); __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')}`}},1348,[]); -__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1349,[1025,1100]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a,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.maxSeatsc[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},1349,[1025,1100]); __d(function(g,_r,_i,_a,_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 I}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const l=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,n.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,C.jsxs)(m.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,C.jsx)(x.T,{size:13,weight:"semibold",colour:T.colours.gold,children:"NEXT HOUR"}),(0,C.jsxs)(h.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,C.jsx)(x.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,C.jsxs)(m.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?T.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?T.colours.amber:'#3C78B5'},children:[(0,C.jsx)(x.T,{size:13,weight:"semibold",children:e.time}),(0,C.jsxs)(x.T,{size:13,children:[(0,p.privName)(e,s)," \xb7 ",e.partySize]}),(0,C.jsx)(x.T,{size:12,colour:T.colours.muted,accessibilityLabel:e.table?(0,a.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,a.tableNumbers)(e.table)}`:'no table'}),(0,C.jsx)(x.T,{size:12,colour:t<0?T.colours.amber:T.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,C.jsx)(x.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,C.jsx)(x.T,{size:12,children:v.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,C.jsxs)(x.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,C.jsxs)(x.Row,{gap:4,children:[(0,C.jsx)(m.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:v.STATUS[e].colour}}),(0,C.jsx)(x.T,{size:12,colour:T.colours.muted,children:v.STATUS[e].label})]},e)),(0,C.jsx)(x.T,{size:12,colour:T.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,u.useState)(20);return(0,u.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,u.useEffect)(()=>{l<=0&&s()},[l]),(0,C.jsxs)(x.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,C.jsx)(x.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,C.jsx)(x.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return B}}),_e.TableSheet=function({rid:e,name:t,view:s,plan:i,todays:c,now:h,privacy:w,turnBase:S,onClose:I,onWalkIn:B,onMove:D,onDetails:z}){const M=s[t],N=j.useFloor.getState(),[P,R]=(0,u.useState)(!1),[L,A]=(0,u.useState)(M?.note??''),[W,O]=(0,u.useState)(!1),H=(0,$.useBookingWrite)();if(!M)return null;const F=M.booking,E=['seated','mains','dessert','bill'].includes(M.status),_=c.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,n.minsBetween)(h,(0,v.startOf)(e)))-Math.abs((0,n.minsBetween)(h,(0,v.startOf)(t)))),G=e=>e.partySize<=M.table.maxSeats,U=M.next??M.due,V=(0,v.turnFor)(M.covers||M.table.maxSeats,S);return(0,C.jsxs)(x.Sheet,{visible:!0,onClose:I,title:`${(0,a.tableNumbers)(t)} \xb7 ${v.STATUS[M.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===M.status?(0,C.jsx)(x.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{j.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,C.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(x.Badge,{kind:"neutral",label:`${M.table.minSeats}\u2013${M.table.maxSeats} seats`}),F?(0,C.jsx)(x.Badge,{kind:"gold",label:`${(0,p.privName)(F,w)} \xb7 ${F.partySize} \xb7 ${M.seatedMins}m`}):null,F?(0,C.jsx)(x.Badge,{kind:M.seatedMins>(0,v.durOf)(F,S)?'red':'neutral',label:`Turn about ${(0,v.durOf)(F,S)} min \xb7 free about ${(0,n.hm)((0,v.endOf)(F,S))} (est.)`}):(0,C.jsx)(x.Badge,{kind:"neutral",label:`Turn estimate for ${M.table.maxSeats}: about ${V} min`}),M.next?(0,C.jsx)(x.Badge,{kind:"blue",label:`Next: ${M.next.time} ${(0,p.privName)(M.next,w)} (${M.next.partySize})`}):null,M.allergy?(0,C.jsx)(x.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,F??U?(0,C.jsx)(k.DepositChip,{b:F??U,money:!0,testID:"table-sheet-deposit"}):null]}),F??U?(0,C.jsx)(o.BookingTableButton,{rid:e,booking:F??U,turnBase:S,testID:"table-sheet-table-btn"}):null,F&&F.walkIn?(0,C.jsx)(r.CancelWalkInButton,{rid:e,b:F,big:!0}):null,F&&F.walkIn?(0,C.jsx)(r.ReinstateWalkInButton,{rid:e,b:F,today:(0,n.ymd)(new Date)}):null,!E&&'blocked'!==M.status&&U?(0,C.jsx)(x.Button,{label:`Seat ${(0,p.privName)(U,w)}`,accessibilityLabel:`Seat ${(0,p.privName)(U,w)}, ${U.time} booking, ${U.partySize} ${1===U.partySize?'person':'people'}, at table ${t}`,accessibilityHint:H.hint,disabled:!H.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!H.ok)return;const s=U;await y.repo.bookings.update(s.id,{table:s.table&&(0,j.tablesOf)(s.table).includes(t)?s.table:t}),await y.repo.bookings.setStatus(s.id,'seated'),(0,f.resetTableLive)(e,t),I()}}):null,!E&&'blocked'!==M.status&&U&&(0,v.startOf)(U)<=h?(0,C.jsxs)(x.Row,{gap:8,children:[(0,C.jsx)(x.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,p.privName)(U,w)}, ${U.time} booking, without seating`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await y.repo.bookings.setStatus(U.id,'finished'),I())}}),(0,C.jsx)(x.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,p.privName)(U,w)}, ${U.time} booking`,accessibilityHint:H.hint,disabled:!H.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{H.ok&&(await y.repo.bookings.setStatus(U.id,'noshow'),I())}})]}):null,E||'blocked'===M.status?null:(0,C.jsxs)(x.Row,{gap:8,children:[(0,C.jsx)(x.Button,{label:"Seat walk-in here",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&('dirty'===M.status&&j.useFloor.getState().setLive(e,t,{dirty:!1}),I(),B(t))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,C.jsx)(x.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:H.hint,disabled:!H.ok,onPress:()=>{H.ok&&O(!W)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),W?(0,C.jsxs)(m.default,{style:{gap:6},children:[0===_.length?(0,C.jsx)(x.Muted,{children:"No bookings left to seat today."}):null,_.slice(0,8).map(s=>(0,C.jsxs)(b.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,p.privName)(s,w)} ${s.time}`,onPress:async()=>{await y.repo.bookings.update(s.id,{table:t}),await y.repo.bookings.setStatus(s.id,'seated'),(0,f.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:G(s)?T.colours.border:T.colours.amber,backgroundColor:T.colours.surface2},children:[(0,C.jsxs)(x.T,{weight:"semibold",children:[s.time," \xb7 ",(0,p.privName)(s,w)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,a.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),G(s)?null:(0,C.jsxs)(x.T,{size:12,colour:T.colours.amber,children:["Bigger than this table (",M.table.maxSeats," max)"]})]},s.id))]}):null,E?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(x.T,{size:14,colour:T.colours.muted,children:"Course / status"}),(0,C.jsx)(x.Row,{wrap:!0,gap:6,children:v.STAGES.map(s=>(0,C.jsx)(x.Chip,{label:v.STAGE_LABEL[s],selected:M.status===s,onPress:()=>N.setLive(e,t,{stage:s})},s))}),(0,C.jsxs)(x.Row,{wrap:!0,gap:8,children:[F?(0,C.jsx)(x.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),D(t)},testID:"move-party"}):null,(0,C.jsx)(x.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{F&&await y.repo.bookings.setStatus(F.id,'finished'),N.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,C.jsxs)(x.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(x.Button,{kind:"secondary",label:'blocked'===M.status?'Unblock table':'Block table',onPress:()=>{N.setLive(e,t,{blocked:'blocked'!==M.status}),I()},testID:"block-table"}),(0,C.jsx)(x.Button,{kind:"ghost",label:M.note?'Edit note':'Note',onPress:()=>R(!P)}),F||U?(0,C.jsx)(x.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),z(F??U)},testID:"guest-details"}):null]}),P?(0,C.jsxs)(x.Row,{gap:6,children:[(0,C.jsx)(l.TextInput,{accessibilityLabel:"Table note",value:L,onChangeText:A,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[x.styles.input,{flex:1}]}),(0,C.jsx)(x.Button,{small:!0,label:"Save",onPress:()=>{N.setLive(e,t,{note:L.trim()||void 0}),R(!1)}})]}):null,w?(0,C.jsx)(x.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,i.joins.some(e=>e.tables.includes(t))?(0,C.jsxs)(x.Muted,{children:["Joins with ",i.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",i.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:a,todays:i,waiting:o,now:r,privacy:c,busy:h,onToast:w}){const[k,$]=(0,u.useState)(''),[B,D]=(0,u.useState)(2),z=(0,j.useFloor)(e=>e.smsLog);return(0,C.jsxs)(I,{title:`Waitlist (${o.length})`,right:(0,C.jsxs)(x.Muted,{children:["new party about ",(0,S.estimateWait)(o.length+1,t.settings.turnMins,h)," min"]}),testID:"waitlist-panel",children:[0===o.length?(0,C.jsx)(x.Muted,{children:"Nobody waiting."}):null,o.map((l,o)=>{const u=(0,v.suggestTable)(s,i,a,l.partySize,r,(0,v.turnFor)(l.partySize,t.settings.turnMins)),b=(0,S.estimateWait)(o+1,t.settings.turnMins,h),k=Math.max(0,(0,n.minsBetween)(new Date(l.joinedAt),r)),$=z.find(t=>t.rid===e&&t.text.includes(`#${l.number} `));return(0,C.jsxs)(m.default,{style:{backgroundColor:T.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(x.T,{weight:"semibold",children:["#",l.number," ",(0,p.pv)(l.name,c)," \xb7 ",l.partySize]}),(0,C.jsxs)(x.T,{size:12,colour:k>b?T.colours.amber:T.colours.muted,children:["waited ",k,"m \xb7 quoted about ",b,"m"]})]}),u?(0,C.jsxs)(x.T,{size:12,colour:u.clashes?T.colours.amber:T.colours.ok,children:["Best table: ",u.table," (",u.why,")"]}):(0,C.jsx)(x.T,{size:12,colour:T.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,C.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(x.Button,{small:!0,label:$||'notified'===l.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${l.number}`,onPress:()=>{j.useFloor.getState().logSms(e,r.toISOString(),`#${l.number} ${l.partySize}: Your table at ${t.name} is ready.`),y.repo.waitlist.setStatus(l.id,'notified'),w(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),u?(0,C.jsx)(x.Button,{small:!0,kind:"success",label:`Seat at ${u.table}`,onPress:async()=>{await y.repo.waitlist.setStatus(l.id,'seated'),await y.repo.bookings.seatWalkIn(e,l.partySize,u.table,`From waitlist #${l.number}`),(0,f.resetTableLive)(e,u.table),w(`Waitlist #${l.number} seated at ${u.table}`)}}):null,(0,C.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>y.repo.waitlist.setStatus(l.id,'removed')})]}),'notified'===l.status?(0,C.jsx)(x.Badge,{kind:"ok",label:`Told table ready${$?` ${(0,n.hm)(new Date($.at))}`:''} `}):null]},l.id)}),(0,C.jsxs)(x.Row,{gap:6,children:[(0,C.jsx)(l.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:k,onChangeText:$,style:[x.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,C.jsx)(b.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:T.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(x.T,{weight:"bold",colour:T.colours.gold,children:B})}),(0,C.jsx)(x.Button,{small:!0,label:"Add",disabled:k.trim().length<2,onPress:()=>{y.repo.waitlist.join(e,k.trim(),B),$('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:l,now:a,walkInCount:o,staffOn:r,onSummary:u}){const c=o+l.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)),f=h?c/h:1,p=f>=1.1?T.colours.amber:f>=.85?T.colours.ok:T.colours.blue,y=Array.from({length:8},(e,t)=>{const s=(0,n.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,n.addMins)(s,15),o=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,v.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:o,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...y.map(e=>e.covers)),k=y.filter(e=>e.future&&e.covers>j),S=t.nextHour?.covers??0,$=Math.ceil(S/16);return(0,C.jsxs)(I,{title:"Pace & kitchen",right:(0,C.jsx)(x.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,C.jsxs)(m.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${c} vs forecast ${h}`,style:{gap:4},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{size:14,children:"Covers so far"}),(0,C.jsxs)(x.T,{weight:"bold",colour:p,children:[c," ",(0,C.jsxs)(x.T,{size:13,colour:T.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,C.jsx)(m.default,{style:{height:10,borderRadius:5,backgroundColor:(0,s.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,C.jsx)(m.default,{style:{width:`${Math.min(100,75*f)}%`,height:10,borderRadius:5,backgroundColor:p}})}),(0,C.jsxs)(x.Muted,{children:[f>=1.1?'Ahead of forecast':f>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,i.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,C.jsx)(x.T,{size:13,colour:T.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,C.jsx)(m.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:y.map((e,t)=>(0,C.jsxs)(m.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,C.jsx)(x.T,{size:10,colour:T.colours.muted,children:e.covers||''}),(0,C.jsx)(m.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?T.colours.red:e.future?'#6B5A3A':T.colours.gold}}),(0,C.jsx)(x.T,{size:9,colour:4===t?T.colours.gold:T.colours.muted,children:(0,n.hm)(e.from)})]},t))}),k.map(e=>(0,C.jsxs)(x.T,{size:13,colour:T.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,n.hm)(e.from),"\u2013",(0,n.hm)((0,n.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),$>r?(0,C.jsxs)(x.T,{size:13,colour:T.colours.amber,children:["\u26a0 Next hour about ",S," Covers with ",r," on: about ",$-r," more on the floor suggested."]}):(0,C.jsxs)(x.T,{size:13,colour:T.colours.ok,children:["Staffing looks OK for the next hour (",r," on)."]}),(0,C.jsx)(x.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:u,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const o=t.filter(e=>['seated','finished'].includes(e.status)),r=o.reduce((e,t)=>e+t.partySize,0)+a,u=t.filter(e=>e.walkIn),c=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,n.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,j.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{children:e}),(0,C.jsx)(x.T,{weight:"semibold",children:t})]},e);return(0,C.jsxs)(x.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(r)),h('Bookings seated',`${o.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${u.length} parties \xb7 ${u.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',c.length?`${Math.round(c.reduce((e,t)=>e+t,0)/c.length)} min`:'\u2014'),h('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),h('"Table ready" texts',`${b} (texts not set up yet, none sent)`),(0,C.jsx)(x.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return j.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),o=_r(d[5]),r=_r(d[6]),n=_r(d[7]),u=_r(d[8]),c=_r(d[9]);_r(d[10]);var b=e(_r(d[11])),h=e(_r(d[12])),m=e(_r(d[13])),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),y=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]),$=_r(d[24]),C=_r(d[25]);const I=({title:e,right:t,children:s,testID:l})=>(0,C.jsxs)(m.default,{testID:l,style:{backgroundColor:T.colours.surface,borderRadius:14,borderWidth:1,borderColor:T.colours.border,padding:10,gap:6},children:[(0,C.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(x.T,{weight:"semibold",colour:T.colours.gold,children:e}),t]}),s]});const B=e=>(0,C.jsxs)(m.default,{style:{gap:6},children:[(0,C.jsxs)(x.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,C.jsxs)(x.Muted,{children:[e.time," \xb7 ",e.table?(0,j.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,C.jsx)(k.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,C.jsx)(c.BookingNeeds,{b:e,big:!0}),e.notes?(0,C.jsxs)(x.T,{children:["Notes: ",e.notes]}):(0,C.jsx)(x.Muted,{children:"No notes."}),e.allergies.length?(0,C.jsx)(m.default,{style:{backgroundColor:T.colours.redBg,borderRadius:8,padding:8},children:(0,C.jsxs)(x.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,w.allergenLabel)(e.allergen)} \u2014 ${(0,w.severityLabel)(e.severity)}`).join('; ')]})}):(0,C.jsx)(x.Muted,{children:"No allergies declared."}),(0,C.jsx)(t.ShowNumberButton,{b:e},`num-${e.id}`)]});const D=!0},1350,[1347,828,827,860,1140,1114,1132,858,34,1102,236,402,295,102,794,1119,1338,874,1025,861,1112,1100,1297,821,1312,25]); __d(function(g,_r,_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.']}]},1351,[827,34,236,402,102,794,874,1025,1352,821,1353,1355,25]); __d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},1352,[]); @@ -1495,7 +1495,7 @@ __d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModu __d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4);return(0,f.jsxs)(n.default,{style:{gap:14},children:[g.map(t=>{const u=b.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(n.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(o.default,{testID:`more-page-${t.id}`,accessibilityRole:"button",accessibilityLabel:t.title,onPress:()=>e('more',t.id),style:({pressed:e})=>({padding:12,borderTopWidth:l?1:0,borderColor:i.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,f.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),t.badge?(0,f.jsx)(s.Badge,{kind:"gold",label:t.badge}):null,(0,f.jsx)(s.T,{colour:i.colours.muted,children:"\u203a"})]})},t.id))})]},t):null}),(0,f.jsxs)(s.Muted,{center:!0,children:['staff'===l?'Staff app preview':'Managers app'," \xb7 ",t.APP_VERSION," \xb7 ",'live'===c.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});var t=r(d[0]);r(d[1]);var o=e(r(d[2])),n=e(r(d[3])),s=r(d[4]),l=r(d[5]),i=r(d[6]),u=r(d[7]),c=r(d[8]),f=r(d[9]);const b=[],p=e=>{e.forEach(e=>{b.some(t=>t.id===e.id)||b.push(e)})},g=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const h=e=>b.find(t=>t.id===e)},1412,[1015,34,402,102,794,892,821,1084,988,25]); __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'}},1413,[]); __d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1414,[860,34,102,794,892,1025,858,1087,1085,988,1086,5,1000,821,25]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=E,_e.signInWithText=H,_e.SignInWithLink=V,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId);return!h.IS_CAR&&(v.includes(h.APP_VARIANT)&&!b.PITCH&&!e&&!M())},_e.InviteGate=function(){const[e,H]=(0,u.useState)(p.useSession.persist.hasHydrated()),[D,F]=(0,u.useState)(p.START_INVITE||p.START_HANDOVER?'checking':'done'),[W,L]=(0,u.useState)(null),[K,U]=(0,u.useState)(0),[G,Y]=(0,u.useState)(!1),[$,B]=(0,u.useState)(null),X=(0,p.useSession)(e=>e.meId),Q=(0,p.useSession)(e=>!X||!!e.welcomed[X]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>H(!0));return p.useSession.persist.hasHydrated()&&H(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!v.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_HANDOVER&&!p.START_INVITE&&!z){z=!0;const n=await(0,I.claimChromeHandover)(p.START_HANDOVER);if(!t)return;if('ok'===n.status&&n.id.staffRef){R(N(n.id.staffRef)??E({id:n.id.staffRef,name:n.id.displayName||n.id.staffRef,role:'owner'===n.id.role?'owner':'manager'===n.id.role?'manager':'staff',level:'head_chef'===n.id.role?'Head Chef':void 0,job:'',active:!0}))}else if('refused'===n.status&&!e)return L(n.message),void F('done')}if(p.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&L(e)});if(!t)return;if('refused'===e.kind)return L(e.message),void F('done');if('offline'===e.kind)return Y(!0),void(n=setTimeout(()=>{t&&U(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void F('bad')}const o=N(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,I.signedInHereAs)(o.id)){if(await(0,I.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),B(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}F('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,K]),!v.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!X){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t,{app:s,message:l})})}if(G)return j('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===D)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!X&&!b.PITCH)return W&&/already been used/i.test(W)?j(x,'invite-app-used'):W&&(0,S.isPhoneLinked)(W)?j(S.PHONE_LINKED_TEXT,'invite-phone-linked'):W?j(W,'invite-app-refused'):j(P,'invite-app-notsetup');if('bad'===D)return(0,w.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,w.jsx)(T.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,w.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F('done')}),(0,w.jsx)(T.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(W&&!X&&(0,S.isPhoneLinked)(W))return(0,w.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:24,weight:"bold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,w.jsx)(T.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,w.jsx)(T.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(W&&!X)return(0,w.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,w.jsx)(T.Muted,{center:!0,children:W}),(0,w.jsx)(T.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,w.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>L(null)})]});if($&&!X)return(0,w.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,w.jsx)(T.Muted,{center:!0,children:$}),(0,w.jsx)(V,{})]});if(!X&&!b.PITCH&&!M())return(0,w.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:W?'This link can\u2019t be used here':'Sign in to CoverCharge'}),W?(0,w.jsx)(T.Muted,{center:!0,children:W}):null,(0,w.jsx)(T.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,w.jsx)(V,{})]});const q=(0,p.rosterPerson)(X);return q&&!Q&&_(q)?(0,w.jsx)(k.LaunchWelcome,{p:q,onDone:()=>p.useSession.getState().markWelcomed(q.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),m=_r(d[12]),k=_r(d[13]),T=_r(d[14]),I=_r(d[15]),b=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),w=_r(d[20]);const x='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',j=(e,n)=>(0,w.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,w.jsx)(T.T,{size:22,weight:"bold",center:!0,children:e})}),v=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const N=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return R(t),_(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=N(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,I.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=N(o.id.staffRef)??E({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return R(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function V(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,w.jsxs)(f.default,{style:{gap:6},children:[(0,w.jsx)(T.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsx)(T.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,w.jsx)(T.T,{size:13,colour:m.colours.red,children:t}):null]})}let z=!1;const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1415,[5,1416,1417,1418,1419,1420,34,236,41,102,872,1003,821,1421,794,988,2,1093,1002,892,25]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=E,_e.signInWithText=H,_e.SignInWithLink=V,_e.useSignedOutGate=function(){const e=(0,p.useSession)(e=>e.meId),n=(0,T.useSync)(e=>'device'===e.kind&&!!e.venueId);return h.IS_CAR?!b.PITCH&&!n:j.includes(h.APP_VARIANT)&&!b.PITCH&&!e&&!M()},_e.InviteGate=function(){const[e,H]=(0,u.useState)(p.useSession.persist.hasHydrated()),[D,F]=(0,u.useState)(p.START_INVITE||p.START_HANDOVER?'checking':'done'),[W,L]=(0,u.useState)(null),[K,U]=(0,u.useState)(0),[G,Y]=(0,u.useState)(!1),[$,B]=(0,u.useState)(null),X=(0,p.useSession)(e=>e.meId),Q=(0,p.useSession)(e=>!X||!!e.welcomed[X]);if((0,u.useEffect)(()=>{const e=p.useSession.persist.onFinishHydration(()=>H(!0));return p.useSession.persist.hasHydrated()&&H(!0),e},[]),(0,u.useEffect)(()=>{if(!e||!j.includes(h.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=p.useSession.getState().meId;if(p.START_HANDOVER&&!p.START_INVITE&&!z){z=!0;const n=await(0,T.claimChromeHandover)(p.START_HANDOVER);if(!t)return;if('ok'===n.status&&n.id.staffRef){R(N(n.id.staffRef)??E({id:n.id.staffRef,name:n.id.displayName||n.id.staffRef,role:'owner'===n.id.role?'owner':'manager'===n.id.role?'manager':'staff',level:'head_chef'===n.id.role?'Head Chef':void 0,job:'',active:!0}))}else if('refused'===n.status&&!e)return L(n.message),void F('done')}if(p.START_INVITE&&!(e&&await(0,T.signedInHereAs)(e)&&await(0,T.rememberedInviteHere)(p.START_INVITE))){const e=await O(p.START_INVITE,e=>{t&&L(e)});if(!t)return;if('refused'===e.kind)return L(e.message),void F('done');if('offline'===e.kind)return Y(!0),void(n=setTimeout(()=>{t&&U(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void F('bad')}const o=N(p.useSession.getState().meId),s=o&&!1!==A.useOwner.getState().staff.find(e=>e.id===o.id)?.active;if(o&&!s)p.useSession.getState().signOut();else if(o&&!_(o)&&!p.START_INVITE&&await(0,T.signedInHereAs)(o.id)){if(await(0,T.forgetSignInHere)(),!t)return;p.useSession.getState().signOut(),B(C(o.app))}else if(o&&!_(o)){const e=(0,p.appUrl)(o.app,p.START_INVITE);if(e)return void window.location.replace(e)}F('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,K]),!j.includes(h.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t.QueuedVenueWelcome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(s.GreensideStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(r.AbbotsfordStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?'This link cannot be used here. Ask your authorised manager.':G?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!X)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(l.KirktonStaffHome,{app:p.APP_NAME[h.APP_VARIANT]??'Team',message:W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(o.IsolatedStaffHome&&(n.IS_WILDINGS||n.IS_KIRKMICHAEL||n.IS_SOUTERS)&&!X){const t=o.IsolatedStaffHome,s=p.APP_NAME[h.APP_VARIANT]??'Team',r=n.IS_WILDINGS?'Wildings':n.IS_KIRKMICHAEL?'Kirkmichael':'Souter\u2019s',l=W?`This link can\u2019t be used here. ${W}`:G?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==D?'bad'===D?'This link is not recognised. Open the complete private link your manager gave you.':void 0:`Opening your personal ${r} app\u2026`;return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}],children:(0,w.jsx)(t,{app:s,message:l})})}if(G)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===D)return(0,w.jsx)(f.default,{style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3}]});if((0,y.inPhoneApp)()&&!X&&!b.PITCH)return W&&/already been used/i.test(W)?v(x,'invite-app-used'):W&&(0,S.isPhoneLinked)(W)?v(S.PHONE_LINKED_TEXT,'invite-phone-linked'):W?v(W,'invite-app-refused'):v(P,'invite-app-notsetup');if('bad'===D)return(0,w.jsxs)(f.default,{testID:"invite-bad",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,w.jsx)(I.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,w.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F('done')}),(0,w.jsx)(I.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(W&&!X&&(0,S.isPhoneLinked)(W))return(0,w.jsxs)(f.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${S.PHONE_LINKED_TEXT}`,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:24,weight:"bold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,w.jsx)(I.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,w.jsx)(I.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(W&&!X)return(0,w.jsxs)(f.default,{testID:"invite-refused",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,w.jsx)(I.Muted,{center:!0,children:W}),(0,w.jsx)(I.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,w.jsx)(I.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>L(null)})]});if($&&!X)return(0,w.jsxs)(f.default,{testID:"invite-moved",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,w.jsx)(I.Muted,{center:!0,children:$}),(0,w.jsx)(V,{})]});if(!X&&!b.PITCH&&!M())return(0,w.jsxs)(f.default,{testID:"invite-signin",style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:W?'This link can\u2019t be used here':'Sign in to CoverCharge'}),W?(0,w.jsx)(I.Muted,{center:!0,children:W}):null,(0,w.jsx)(I.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,w.jsx)(V,{})]});const q=(0,p.rosterPerson)(X);return q&&!Q&&_(q)?(0,w.jsx)(k.LaunchWelcome,{p:q,onDone:()=>p.useSession.getState().markWelcomed(q.id)}):null};var n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]);_r(d[7]);var c=e(_r(d[8])),f=e(_r(d[9])),h=_r(d[10]),p=_r(d[11]),m=_r(d[12]),k=_r(d[13]),I=_r(d[14]),T=_r(d[15]),b=_r(d[16]),y=_r(d[17]),S=_r(d[18]),A=_r(d[19]),w=_r(d[20]);const x='This app copy has already been set up on another phone. Ask your manager for a new link.',P='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,n)=>(0,w.jsx)(f.default,{testID:n,style:[c.default.absoluteFill,{backgroundColor:m.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,w.jsx)(I.T,{size:22,weight:"bold",center:!0,children:e})}),j=['owner','staff','chef'],_=e=>'staff'===h.APP_VARIANT||e.app===h.APP_VARIANT,C=e=>`You now use ${p.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){p.useSession.getState().signIn(e.id);const n=A.useOwner.getState();A.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const N=e=>{const n=(0,p.rosterPerson)(e);if(n)return n;const t=e?A.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function O(e,n){const t=await(0,p.personForInvite)(e);if(t)return R(t),_(t)?((0,T.claimInvite)(e).then(e=>{if('refused'===e.status&&p.useSession.getState().meId===t.id&&(p.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==p.useSession.getState().meId){const n=N(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const o=await(0,T.claimInvite)(e);if('refused'===o.status)return{kind:'refused',message:o.message};if('offline'===o.status)return{kind:'offline'};if('ok'!==o.status||!o.id.staffRef)return{kind:'bad'};const s=N(o.id.staffRef)??E({id:o.id.staffRef,name:o.id.displayName||o.id.staffRef,role:'owner'===o.id.role?'owner':'manager'===o.id.role?'manager':'staff',level:'head_chef'===o.id.role?'Head Chef':void 0,job:'',active:!0});return R(s),{kind:'ok',p:s}}async function H(e,n=()=>{}){const t=(0,p.inviteFromText)(e);if(!t)return'bad';const o=await O(t,n);if('refused'===o.kind)return{refused:o.message};if('bad'===o.kind||'offline'===o.kind)return'bad';const s=o.p;if(!_(s)){const e=(0,p.appUrl)(s.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function V(){const[e,n]=(0,u.useState)(''),[t,o]=(0,u.useState)('');return(0,w.jsxs)(f.default,{style:{gap:6},children:[(0,w.jsx)(I.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsx)(I.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await H(e,o);o('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,w.jsx)(I.T,{size:13,colour:m.colours.red,children:t}):null]})}let z=!1;const M=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1415,[5,1416,1417,1418,1419,1420,34,236,41,102,872,1003,821,1421,794,988,2,1093,1002,892,25]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QueuedVenueWelcome=function({app:e,message:n}){const h=c.queuedVenues[u.VENUE_RID];return(0,l.jsxs)(t.default,{testID:"queued-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,l.jsx)(s.RestaurantHero,{rid:u.VENUE_RID,size:220}),(0,l.jsx)(o.T,{size:24,weight:"bold",center:!0,children:e}),(0,l.jsxs)(o.Card,{children:[(0,l.jsx)(o.T,{weight:"bold",children:"Manager setup needed"}),(0,l.jsx)(o.Muted,{children:n||'No manager or staff access has been set up. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,l.jsx)(o.Muted,{center:!0,children:"Table requests need a venue manager to confirm. Deposits, payments, ordering and loyalty are off."}),(0,l.jsxs)(o.Muted,{center:!0,children:["To confirm: ",h.gatesToConfirm.join(', '),"."]})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6])},1416,[34,102,873,794,5,6,25]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IsolatedStaffHome",{enumerable:!0,get:function(){return t}});const t=null},1417,[]); __d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GreensideStaffHome=function({app:e,message:n}){return(0,o.jsxs)(t.default,{testID:"greenside-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,o.jsx)(s.RestaurantHero,{rid:"greenside",size:240}),(0,o.jsx)(l.T,{size:24,weight:"bold",center:!0,children:e}),(0,o.jsxs)(l.Card,{children:[(0,o.jsx)(l.T,{weight:"bold",children:"Manager setup needed"}),(0,o.jsx)(l.Muted,{children:n||'No manager or staff access has been set up yet. The authorised manager must be added before the team can sign in. No personal links have been created.'})]}),(0,o.jsx)(l.Muted,{center:!0,children:"Cash only. Table requests need a Greenside manager to confirm. Deposits and payments are off."}),(0,o.jsx)(l.Muted,{center:!0,children:"Still needed: authorised manager, staff list, table plan and Covers, menu and allergen sign-off, deposit policy and public email confirmation."})]})},r(d[0]);var e,n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),o=r(d[4])},1418,[34,102,873,794,25]); diff --git a/staff-app/admin.html b/staff-app/admin.html index b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 3acca5d401798bbaecdd813c04fedb4342236d3b..a0f060f3b80cfabf78f4accb40661fc3832608e9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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 c0cadaf7dbcaed5ca0ab8edb5ffc87ccf8d355d4..47adbcbda219577bcd5713eac0bae9784df58a73 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-16aaa45811"; +const V = "cc-staff-530e902bcc"; const BASE = "/staff-app/"; -const PRECACHE = ["/staff-app/apple-touch-icon.png", "/staff-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/staff-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/staff-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/staff-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/staff-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/staff-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/staff-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/staff-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/staff-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/staff-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/staff-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/staff-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/staff-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/staff-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/staff-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/staff-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/staff-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/staff-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/staff-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/staff-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/staff-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/staff-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/staff-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/staff-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/staff-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/staff-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/staff-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/staff-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/staff-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/staff-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/staff-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/staff-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/staff-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/staff-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/staff-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/staff-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/staff-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/staff-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/staff-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/staff-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/staff-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/staff-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/staff-app/brand-logo.png", "/staff-app/favicon.ico", "/staff-app/icon-192.png", "/staff-app/icon-512.png", "/staff-app/icon-maskable-192.png", "/staff-app/icon-maskable-512.png", "/staff-app/manifest.webmanifest", "/staff-app/index.html", "/staff-app/_expo/static/js/web/bundle.js?v=16aaa458119527d057f871111e025b3bb53e13b617233ac15e9a871c34a1893e"]; +const PRECACHE = ["/staff-app/apple-touch-icon.png", "/staff-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/staff-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/staff-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/staff-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/staff-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/staff-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/staff-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/staff-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/staff-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/staff-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/staff-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/staff-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/staff-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/staff-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/staff-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/staff-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/staff-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/staff-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png", "/staff-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/staff-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/staff-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/staff-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/staff-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/staff-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/staff-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/staff-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/staff-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/staff-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/staff-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/staff-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/staff-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/staff-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/staff-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/staff-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/staff-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/staff-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/staff-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/staff-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/staff-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/staff-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/staff-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/staff-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/staff-app/brand-logo.png", "/staff-app/favicon.ico", "/staff-app/icon-192.png", "/staff-app/icon-512.png", "/staff-app/icon-maskable-192.png", "/staff-app/icon-maskable-512.png", "/staff-app/manifest.webmanifest", "/staff-app/index.html", "/staff-app/_expo/static/js/web/bundle.js?v=530e902bcc9799bd126670f5aa9f6b1bcd0c5d6239bfc3ba46407d5afc4943ed"]; // 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 b320af2a3a62231f6c0c0266092cc3c2bee3cebc..25903257a1966b8b52c6714fac38157d15e976d9 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); })(); - +